Alexander Popov

Joined

230 Experience
2 Lessons Completed
0 Questions Solved

Activity

Posted in `fresh_when` usage for dynamic queries

@Nicolas Brousse I think your solution it correct, that's how I do it, too. You even don't need to pass the record, if you pass the etag option. I would write it like so:

fresh_when etag: @posts.to_a

Posted in Form Objects Design Pattern Discussion

Wow, I am struggling with multi-steps forms as well. I definitely would support the creation of an episode for multi-step forms!

Posted in Rails Counter Caches Discussion

Hi Chris,

I'd like to share a few thoughts with you.

Currently, there are plenty of tutorials and learning materials for junior to mid-level developers on various topics. However what I think is lacking is training materials on more advanced topics.

Take this episode for example. This episode is of very high quality, you explain how counter caching works very well. I think you have covered most of the important aspects of the basics. The thing is, there is already plenty of good materials out there, which cover the same. I think it would be really nice to have a more in-depth look at counter caching. For example:
* how do you count has_many :through associations;
* how do you count scoped has_many associations `article has_many :public_comments, -> { where(public: true) }, class_name: 'Comment'`;
* what about soft deleting - you don't actually destroy the child object, but just set its `deleted` attribute to `false` - how do you handle the restoring of the object (setting `deleted` back to `true`;
* what are the gotchas of implementing a counter cache on your own;

I think if you combine all those conditions, you can come up with some pretty challenging scenarios.

I know that it doesn't make much sense to jump right into the complicated stuff without covering the basics first, but I really wish to see more advanced-level stuff in the pro episodes.

Thank you and keep up the good work.