Ruby on Rails
Saturday, November 21, 2015
i'm trying to follow these instructions:
in my categories_controller.rb
in my index.html.erb
in my _categories.html.erb
but this doesn't work i get unknown method wihtout_parents and couldn't figure out what without_parents was supposed to be so, i tried changing the line in the controller to @parent_categories = Category.where("parent_id=0") and it was on to the next error, now i get
-- in my categories_controller.rb
| def index | @parent_categories = Category.without_parents |
in my index.html.erb
| <ul> | <%= render @parent_categories %> | </ul> |
in my _categories.html.erb
| <ul> | <li> | <strong><%= category.name %></strong> | <ul> | <%= render category.categories %> | </ul> | </li> | </ul> |
but this doesn't work i get unknown method wihtout_parents and couldn't figure out what without_parents was supposed to be so, i tried changing the line in the controller to @parent_categories = Category.where("parent_id=0") and it was on to the next error, now i get
undefined method `categories' for #<Category:0xb1604e2c> My understanding is that in the statement, category is the partial view and categories means the entire collection, so then why doesn't rails recognize the meaning of categories as the entire collection and what's the story with "without_parents" ? ~ thanks, fugee
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-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/3a51da10-d83b-4a58-bc74-cfd9d21b704a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment