Class: Formol::Post
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Formol::Post
- Defined in:
- app/models/formol/post.rb
Instance Attribute Summary collapse
-
#created_by_topic ⇒ Object
Virtual attributes.
-
#quote_id ⇒ Object
Virtual attributes.
-
#register_user_as_subscriber(force_recompute = false) ⇒ Object
Read accessor for ‘register_user_as_subscriber’.
Class Method Summary collapse
-
.last_fives ⇒ Object
scope to get last five posts with reverse ordering usefull to have a little history when replying to a topic.
-
.ordered_for_listing ⇒ Object
scope for ordering posts conveniently for listing views order by id (no order is random with mysql).
-
.ready_for_listing ⇒ Object
scope to get posts conveniently prepared for listing.
Instance Attribute Details
#created_by_topic ⇒ Object
Virtual attributes
7 8 9 |
# File 'app/models/formol/post.rb', line 7 def created_by_topic @created_by_topic end |
#quote_id ⇒ Object
Virtual attributes
7 8 9 |
# File 'app/models/formol/post.rb', line 7 def quote_id @quote_id end |
#register_user_as_subscriber(force_recompute = false) ⇒ Object
Read accessor for ‘register_user_as_subscriber’
7 8 9 |
# File 'app/models/formol/post.rb', line 7 def register_user_as_subscriber @register_user_as_subscriber end |
Class Method Details
.last_fives ⇒ Object
scope to get last five posts with reverse ordering usefull to have a little history when replying to a topic
64 65 66 |
# File 'app/models/formol/post.rb', line 64 def last_fives order('formol_posts.id DESC').limit(5).includes(:user) end |
.ordered_for_listing ⇒ Object
scope for ordering posts conveniently for listing views order by id (no order is random with mysql)
53 54 55 |
# File 'app/models/formol/post.rb', line 53 def ordered_for_listing order('formol_posts.id ASC') end |
.ready_for_listing ⇒ Object
scope to get posts conveniently prepared for listing
58 59 60 |
# File 'app/models/formol/post.rb', line 58 def ready_for_listing ordered_for_listing.includes(:topic, { :user => :preference }) end |