top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

Rails: Why I can't use routes like "user_path" in custom layouts like user-layout.html.erb

+1 vote
Rails: Why I can't use routes like "user_path" in custom layouts like user-layout.html.erb
posted May 7, 2014 by Sonu Jindal

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button
Does the route exist? what is the error you get? try rake routes to see if user_path exists.
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?.

Similar Questions
+1 vote

I would like to have a form in which some of the fields are linked to model and some fields are not. When I use FORM_FOR tag it binds to a particular model and I cannot create form fields that aren't correspond to one of the column name of the table (Model). Hence what I think is I should use FORM_TAG instead of FORM_FOR so that it contains whatever the form fields it want but one thing I can't find by googling is how can I connect specific fields to a model leaving other fields free of model?

In other words, If I have 5 text_fields in a form how can I link only 3 text_fields to a model and leave other 2 fields free?

0 votes

I am proposing to have multiple domain name pointing towards a single site. On the site I would like to display the domains name that was used. How can I obtain the name of the domain that the user entered to access my site?

0 votes

I was reading the docs for primary key on postgresql and I saw that there was a way to add a custom stored procedure that returns a UUID. There is a test case as well that uses a custom uuid generator**********cf1762922d330a8/activerecord/test/cases/adapters/postgresql/uuid_test.rb#L193

But I was not sure how to to implement this myself. Like in the test case where do I place my_uuid_generator() and how to implement it in my rails application?

0 votes

How can I use ruby on rails input field selector?

This is form:

   validators: {
     notEmpty: {
       message: 'The company name is required and cannot be empty'
Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.