{"id":640,"date":"2022-08-30T15:04:43","date_gmt":"2022-08-30T15:04:43","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/extending-refinery-engine-into-home-view-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:04:43","modified_gmt":"2022-08-30T15:04:43","slug":"extending-refinery-engine-into-home-view-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/extending-refinery-engine-into-home-view-collection-of-common-programming-errors\/","title":{"rendered":"Extending Refinery Engine into Home View-Collection of common programming errors"},"content":{"rendered":"<p>I have a custom engine in Refinery named Works. I would like it to be available to the home page. I&#8217;ve extended the Pages Controller as follows:<\/p>\n<pre><code>Refinery::PagesController.class_eval do\n\nbefore_filter :find_all_works, :only =&gt; [:home]\n\nprotected\n\n  def find_all_works\n    @works = Refinery::Works::Work\n  end\n\n\n\n end\n<\/code><\/pre>\n<p>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:<\/p>\n<pre><code>Refinery::PagesController.class_eval do\n\nbefore_filter :find_all_works, :only =&gt; [:home]\n\nprotected\n\n  def find_all_works\n    @works = Refinery::Works::Work\n  end\n\n\n\nend\n<\/code><\/pre>\n<p>It gives me the error, &#8220;undefined method `each'&#8221;. Any thoughts?<\/p>\n<p id=\"rop\"><small>Originally posted 2013-11-09 21:09:44. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I have a custom engine in Refinery named Works. I would like it to be available to the home page. I&#8217;ve extended the Pages Controller as follows: Refinery::PagesController.class_eval do before_filter :find_all_works, :only =&gt; [: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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-640","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/640","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=640"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/640\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=640"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=640"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=640"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}