Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##controller code
- #the trouble is that I have a table called 'categories', it contains categories of tutorials and projects.
- #unfortunately, some of these categories conflict.
- #the database is set up in an :acts_as_tree method - all tutorial categories belong to "tutorials".
- #the primary key id is unique, but the path (url-friendly name) by which I reference these categories is not.
- class TutorialsController < ApplicationController
- def list
- #show a list of all tutorials in a category (paginate this)
- categories = Category.find_by_path(params[:path])
- @category = categories.reject{|category| unless category.root.path == "tutorials"; return true; end}
- @tutorials = @category.tutorials
- end
- end
- #undefined method `reject' for #<Category:0x2b10bd0dc1b0>
- #is the new error I get when I attempt to run this code
Add Comment
Please, Sign In to add comment