Save 36% for Black Friday! Learn more

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. 🤔