Layouts

91 views
Skip to first unread message

Alfredo Barrero

unread,
May 7, 2014, 6:27:45 AM5/7/14
to rubyonra...@googlegroups.com
Hi guys, can someone tell me why I can't use routes like "user_path" in custom layouts like 'user-layout.html.erb' ???

Thanks & regards.

S Ahmed

unread,
May 7, 2014, 6:40:28 AM5/7/14
to rubyonra...@googlegroups.com
does the route exist? what is the error you get?

try rake routes to see if user_path exists.


On Wed, May 7, 2014 at 6:27 AM, Alfredo Barrero <abarr...@gmail.com> wrote:
Hi guys, can someone tell me why I can't use routes like "user_path" in custom layouts like 'user-layout.html.erb' ???

Thanks & regards.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/989a71d9-1b0c-43e6-a5d4-b7d0e180ce1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alfredo Barrero

unread,
May 7, 2014, 6:44:26 AM5/7/14
to rubyonra...@googlegroups.com
Yes, I'm trying all the routes and no one works. It says 'cannot find user_path'. These are the routes that I have.

 user GET    /users/:id(.:format)         users#show
                PATCH  /users/:id(.:format)         users#update
                PUT    /users/:id(.:format)         users#update
                DELETE /users/:id(.:format)         users#destroy

In the application.layout those routes are working, I have to specify any special route tu use a different layout?.


Thanks

bertly_the_coder

unread,
May 7, 2014, 6:50:26 AM5/7/14
to rubyonra...@googlegroups.com
it's users_path

Alfredo Barrero

unread,
May 7, 2014, 6:52:41 AM5/7/14
to rubyonra...@googlegroups.com
No. In case that would be the problem I could use any other route but that is not the case. I cannot use any other route in the custom layout...


You received this message because you are subscribed to a topic in the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rubyonrails-talk/fE1n2Fsq0oU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rubyonrails-ta...@googlegroups.com.

To post to this group, send email to rubyonra...@googlegroups.com.

bertly_the_coder

unread,
May 7, 2014, 6:58:15 AM5/7/14
to rubyonra...@googlegroups.com
How exactly are you trying to use the routes? Do you have some code you could share?

Alfredo Barrero

unread,
May 7, 2014, 7:01:31 AM5/7/14
to rubyonra...@googlegroups.com
Yes sure.
'layouts/user-layout.html.erb'

<div class="btn-group btn-group-lg"><%= link_to 'Log out', user_path , method: :delete %></div>

I have a few more layouts and it does not work neither. But it does in 'application.html.erb'. I think that some route configuration have to be set before this but I don´t know what.

Thanks

Michael

unread,
May 7, 2014, 7:06:50 AM5/7/14
to rubyonra...@googlegroups.com
I would use "pry" for this case.
"binding.pry" in user-layout.html.erb and find out what is the problem

Alfredo Barrero

unread,
May 7, 2014, 7:10:50 AM5/7/14
to rubyonra...@googlegroups.com
I don't know what exactly is that... But have to be an easier way to fix this.
To unsubscribe from this group and all its topics, send an email to rubyonrails-talk+unsub...@googlegroups.com.

Alfredo Barrero

unread,
May 7, 2014, 7:13:09 AM5/7/14
to rubyonra...@googlegroups.com
Ok I don´t know what I did but now it works.... :( so sorry

Colin Law

unread,
May 7, 2014, 7:19:36 AM5/7/14
to rubyonra...@googlegroups.com
On 7 May 2014 12:10, Alfredo Barrero <abarr...@gmail.com> wrote:
> I don't know what exactly is that... But have to be an easier way to fix
> this.

Using a debugger is sometimes the right way to find problems. Learn
how to use it and you will save a lot of time in the long run.

Colin

Alfredo Barrero

unread,
May 7, 2014, 7:22:31 AM5/7/14
to rubyonra...@googlegroups.com
Ok, I will take a look on it. Thanks.

Could you please take a look at my other post related with Ajax functionality please?.

Thanks & regards.

Alfredo.
> --
> You received this message because you are subscribed to a topic in the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/rubyonrails-talk/fE1n2Fsq0oU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLtNK%3DLTMmrqXywtPyY03ig6BFP873H8Kad47XHyMp8kvg%40mail.gmail.com.

Pratap Patil

unread,
May 7, 2014, 10:00:17 AM5/7/14
to rubyonra...@googlegroups.com
Hi guys
   Firstly rake routes on console , check existing path is available. Not available then need define path in route file

Duong vong veasna

unread,
May 19, 2014, 10:57:32 PM5/19/14
to rubyonra...@googlegroups.com
Hi guys
I have problem when i try to link to my new page, can any one help me.

thanks and regard.

get "link/home"
  get "link/about"

Colin Law

unread,
May 20, 2014, 2:38:09 AM5/20/14
to rubyonra...@googlegroups.com
On 20 May 2014 03:57, Duong vong veasna <veasna...@gmail.com> wrote:
> Hi guys
> I have problem when i try to link to my new page, can any one help me.
>
> thanks and regard.
>
> get "link/home"
> get "link/about"

Probably someone will help if you describe the problem. Also I am not
sure what this has to do with the subject of the thread (Layouts). If
it is not a follow on from the previous post please start a new
thread.

Colin
Reply all
Reply to author
Forward
0 new messages