Module: FlagThis::Flag
- Included in:
- Flag
- Defined in:
- lib/flag_methods.rb
Overview
including this module into your Flag model will give you finders and named scopes useful for working with Flags.
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(flag_model) ⇒ Object
6 7 8 9 10 |
# File 'lib/flag_methods.rb', line 6 def self.included(flag_model) flag_model.extend ClassMethods flag_model.scope :in_order, flag_model.order('created_at ASC') flag_model.scope :recent, flag_model.order('created_at DESC') end |
Instance Method Details
#is_flag_type?(type) ⇒ Boolean
12 13 14 |
# File 'lib/flag_methods.rb', line 12 def is_flag_type?(type) type.to_s == role.singularize.to_s end |