Sha256: 6cd1377e9b18f3f14dea33281aa48ef74e2bdea46dce92a013fe8a00b3bf9760
Contents?: true
Size: 928 Bytes
Versions: 4
Compression:
Stored size: 928 Bytes
Contents
module Granite module Form module Model module Attributes module Reflections class ReferenceOne < Base def self.generate_methods(name, target) target.class_eval <<-RUBY, __FILE__, __LINE__ + 1 def #{name} attribute('#{name}').read end def #{name}= value attribute('#{name}').write(value) end def #{name}? attribute('#{name}').query end def #{name}_before_type_cast attribute('#{name}').read_before_type_cast end RUBY end def inspect_reflection "#{name}: (reference)" end def association @association ||= options[:association].to_s end end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems