Module: HasComments::InstanceMethods
- Defined in:
- lib/has_comments.rb
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/has_comments.rb', line 14 def method_missing(method, *args ) case method when /first_\d+_comments/i self.comments.limit($1) when /last_\d+_comments/i self.comments.limit($1).order("created_at desc") else super end end |