Class: Formol::Topic::Track
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Formol::Topic::Track
- Defined in:
- app/models/formol/topic/track.rb
Class Method Summary collapse
-
.mark_topic_for_user(topic, user) ⇒ Object
mark a given topic for a given user if track already exists, it will be updated otherwhise it will be created handle nil user if forum is browsed without being connected.
Instance Method Summary collapse
Class Method Details
.mark_topic_for_user(topic, user) ⇒ Object
mark a given topic for a given user if track already exists, it will be updated otherwhise it will be created handle nil user if forum is browsed without being connected
28 29 30 31 32 33 34 35 |
# File 'app/models/formol/topic/track.rb', line 28 def mark_topic_for_user(topic, user) return nil if user.nil? track = find_or_initialize_by_topic_id_and_user_id(topic.id, user.id) track.mark track end |
Instance Method Details
#mark ⇒ Object
38 39 40 |
# File 'app/models/formol/topic/track.rb', line 38 def mark save end |