Skip to main content
5 events
when toggle format what by license comment
Jan 20, 2017 at 12:32 comment added Flambino @BrunoFacca Glad to help. And it's true: Avoid logic in the view! However, I'd argue that calling to_sentence is really more about presentation which makes it a view-concern. It's sort of in the same vein as "humanizing" a timestamp to say "1 minute ago", or rounding a float for display. But calling map is a not quite as nice - it'd be good to move that to a UserHelper method, actually
Jan 20, 2017 at 12:27 vote accept BrunoF
Jan 20, 2017 at 12:27 comment added BrunoF I'll definitely implement a counter cache in this and other models too. About generating the entire sentences at the view, I had thought about it, but after reading many times that we should avoid placing logic in the view, I attempted to place as much logic as possible in the model. However, looking at it from the perspective of separation of concerns, it makes sense to place it in the view. The application is already internationalized with i18n, so your suggestion should fit right in. Your reply was very helpful, thank you!
Jan 19, 2017 at 20:24 comment added Marc-Andre Wow, a :counter_cache, I was going to be tempted to do something similar.
Jan 19, 2017 at 19:52 history answered Flambino CC BY-SA 3.0