Module: Popularable::Concern
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/concerns/popularable.rb
Instance Method Summary collapse
Instance Method Details
#bump_popularity!(popularity_add_value = 1, popularity_event_time = Time.now) ⇒ Object
65 66 67 68 69 |
# File 'lib/concerns/popularable.rb', line 65 def bump_popularity!( popularity_add_value = 1, popularity_event_time = Time.now ) popularable_popularity_event = self.popularable_popularity_events.find_or_create_by( popularity_event_date: popularity_event_time.to_date ) popularable_popularity_event.update_attributes( popularity: popularable_popularity_event.popularity.to_i + popularity_add_value ) end |