Module: Utusemi::Core::ActiveRecord::AssociationMethods
- Defined in:
- lib/utusemi/core.rb
Instance Method Summary collapse
- #belongs_to(name, scope = nil, options = {}) ⇒ Object
- #has_many(name, scope = nil, options = {}, &extension) ⇒ Object
- #has_one(name, scope = nil, options = {}) ⇒ Object
Instance Method Details
#belongs_to(name, scope = nil, options = {}) ⇒ Object
290 291 292 293 294 295 296 |
# File 'lib/utusemi/core.rb', line 290 def belongs_to(name, scope = nil, = {}) check_deplicated_association_warning(:belongs_to, name, scope) utusemi_flag = scope.try(:delete, :utusemi) scope = utusemi_association_scope(:belongs_to, name, scope) if utusemi_flag super if !utusemi_flag || !method_defined?(name) define_utusemi_association_reader(name, utusemi_flag => true) end |
#has_many(name, scope = nil, options = {}, &extension) ⇒ Object
306 307 308 309 310 311 312 |
# File 'lib/utusemi/core.rb', line 306 def has_many(name, scope = nil, = {}, &extension) check_deplicated_association_warning(:has_many, name, scope) utusemi_flag = scope.try(:delete, :utusemi) scope = utusemi_association_scope(:has_many, name, scope) if utusemi_flag super if !utusemi_flag || !method_defined?(name) define_utusemi_association_reader(name, utusemi_flag => true) end |
#has_one(name, scope = nil, options = {}) ⇒ Object
298 299 300 301 302 303 304 |
# File 'lib/utusemi/core.rb', line 298 def has_one(name, scope = nil, = {}) check_deplicated_association_warning(:has_one, name, scope) utusemi_flag = scope.try(:delete, :utusemi) scope = utusemi_association_scope(:has_one, name, scope) if utusemi_flag super if !utusemi_flag || !method_defined?(name) define_utusemi_association_reader(name, utusemi_flag => true) end |