Jesus Castello


30 Experience
0 Lessons Completed
0 Questions Solved


Posted in Archive old pages to a static page

You could try using render_to_string & save the rendered view in your database, then when you need to show this report you can render :html that.

Just an idea, not tested :)

Posted in Controller loop for has_many_through associations

Can you try changing the order of your has_many?

Like this:

has_many :item_linkers, inverse_of: :item
has_many :recipes, through: :item_linkers

Instead of:

has_many :items, :through => :item_linkers
has_many :item_linkers, inverse_of: :recipe


Let me know if that helps :)

Posted in Working with rails caching

What does Rails.cache.class return?

There are different caching backends. If you're using NullStore or if the backend service is not available (server not running) Rails will not complain, but it'll produce the results you're seeeing.