Murray Catto

Joined

2,220 Experience
22 Lessons Completed
0 Questions Solved

Activity

Loved the nifty regx trick.
Also liked the

if(user = User.find_by(....))
 user
else 
...
end

Didn't know you could define values in if statements and use them to return, will definately be using this in my day to day.

Will the source code for this project be available after the next episode?

Posted in Rails Fragment Caching with Permissions Discussion

I think simply caching based off of a simple key such as

Rails.cache.fetch("post-#{post.id}-#{post.owner?(current_user)}") do .... end

Would be better as you would only get a max of two fragment caches per post and not need the extra js or bloat the clients browser with unnecessary html. 🤔

logo Created with Sketch.

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

© 2023 GoRails, LLC. All rights reserved.