Module: ScopedId::Concern::ClassMethods
- Defined in:
- lib/scoped_id/concern.rb
Instance Method Summary collapse
Instance Method Details
#scoped_id(attr_name, options = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/scoped_id/concern.rb', line 16 def scoped_id(attr_name, = {}) scope = [:scope] if scope.nil? raise ArgumentError.new(":scope is not defined. It is a mandatory option of scoped_id.") end scoped_ids_definitions << ScopedIdDefinition.new(attr_name, scope) attr_readonly attr_name validates_uniqueness_of attr_name, scope: scope, allow_nil: true end |
#scoped_ids_definitions ⇒ Object
29 30 31 |
# File 'lib/scoped_id/concern.rb', line 29 def scoped_ids_definitions @scoped_ids_definitions ||= [] end |