1.0.2 confusing show and index #20
Comments
Can you please post the full backtrace - I believe what's happening is that the |
There is no stack trace. You're correct. I was calling student_path without the |
I have the same identical type of issue. This happen with version 1.0.2 and also with 1.0.3, but is not present with the version 1.0.1 (I rolled back to it). Now seems to me that this problem is present when are called (in link_to for example) the path to edit and new action. How we can solve this issue? and what really is so different between the version 1.0.1 and the 1.0.2 and 1.0.3?? In my case it's important noting that I am using the id to call the method (edit or new require ID), the only thing that could let me worry can be the fact that I am using nested attributes and models and I am also using a route grouping method as you did JohnColvin... |
Can you share a line or section of code that is causing issues for issue? In my case, I was abusing path methods. I should have not been using them the way that I was. I corrected them and everything is working for me now. As far as I can tell, this isn't a bug. They are restricting some usage that should not have been allowed in the first place. |
I agree, I could share some code too. resources :profiles , :module => "members" do (NOTE this is an has_one association for users) No matter what I do, using the version of journey 1.0.2 or 1.0.3 through an error, and the error is the same of yours: No route matches {:action=>"show", :controller=>"members/profiles"} I believe there is an issue with the show action in someway with the new updated version of journey, what it is, is what really would love to understand. |
The error you're getting is indicative of you using the
you wouldn't get the error with
If you can, please post the template in a gist so I can have a look. |
Sorry but what you are pointing out is not what really happen (at least not directly). I land on the profile show view (user has one profile, and current_user is what pass the id to profile, after log in). When an user sign up, the app automatically create a record in the user model, a record in profile model, and a record in the nested resources of profile that have an has_one relation with the same profile; the other nested resources (the has_many ones) are not automatically created with the sign up process, but are optionally created later by the user if he/she want. Obviously this nested resources with has_many relationship are empty (there is no record) at the beginning. The error happen for this resources, using the new path or the edit path (obviously there is not an id for the nested resources yet, but there is the id of the user and the id of the profile). an example can be: ON PROFILE SHOW PAGE: <% if (@user == current_user) %> <%= link_to 'Profile Settings', edit_profile_path %> (NOTE NO GIVE ERROR)<%= link_to 'Account Settings', edit_user_registration_path %> (NOTE GIVE ERROR)<% end %> <%= link_to profile_path %> or also on the same page: <%= link_to "Add a new Living", new_profile_living_path(@Profile) %> (NOTE GIVE ERROR) The error is always the same: No route matches {:action=>"show", :controller=>"members/profiles"} in every case! |
This is where the error is: <%= link_to profile_path %> |
Why?!? Sent from my iPhone On Feb 23, 2012, at 3:50 AM, Andrew Whitereply@reply.github.com wrote:
|
You have the following routes: resources :profiles, :module => "members" do
resources :bios
resources :livings
end This gives the following routes:
Specifically this route:
Therefore you need to give <%= link_to profile_path(@user) %> |
@pixeltrix Ok You were super right.... I found the issue, was related with the <%= link_to profile_path %>, but was not in the code that I showed you before. Was a link in the header (I am actually using a partial for that), that was <%= link_to profile_path %> and this obviously couldn't work for the has_many association because nothing was created before, and then there was an id nil. This instead was working for the has_one association, I believe for the simple reason that this association were created with the user, and then they presented the same id of the user (probably if in the database I modify the id, and put different from the user, the code will throw the same error). I fixed the issue not using <%= link_to profile_path(@user) %> (because still this give an error), but using instead <%= link_to profile_path(current_user) %> Now everything works fine also with 1.0.3 !!! Apologize, but I have had the opportunity to look inside of the code just few minutes ago. Thanks again, for pointing me in the right direction. Anyway, I'd like to understand what changed between the version 1.0.1 and the 1.0.2 and 1.0.3....This was allowed before, then I deduct that was a bug in the older version? |
@Dinuz yes it was a bug - nil parameters were being converted to empty strings. |
I upgraded to 1.0.2 and an index path of mine (localhost:3000/students) was giving this error:
No route matches {:action=>"show", :controller=>"students"}
I went back to 1.0.1 and it went back to working.
Here's the students section of my routes file:
The text was updated successfully, but these errors were encountered: