Extending Refinery Engine into Home View-Collection of common programming errors
I have a custom engine in Refinery named Works. I would like it to be available to the home page. I’ve extended the Pages Controller as follows:
Refinery::PagesController.class_eval do
before_filter :find_all_works, :only => [:home]
protected
def find_all_works
@works = Refinery::Works::Work
end
end
This allows the sever to boot up and the view to load without error but, the second I try to access the engine with something like:
Refinery::PagesController.class_eval do
before_filter :find_all_works, :only => [:home]
protected
def find_all_works
@works = Refinery::Works::Work
end
end
It gives me the error, “undefined method `each'”. Any thoughts?
Originally posted 2013-11-09 21:09:44.