Jesus Castello

Joined

30 Experience
0 Lessons Completed
0 Questions Solved

Activity

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

References:
https://github.com/rails/rails/issues/29123
https://stackoverflow.com/questions/44013983/activerecordhasmanythroughordererror

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.

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2021 GoRails, LLC. All rights reserved.