Sha256: b442b8ef8a75600c5aff4afe8dbc59037d0acdc9423a48c40f0e22444d5d6d2c
Contents?: true
Size: 1.12 KB
Versions: 1
Compression:
Stored size: 1.12 KB
Contents
module Granite module Form module Model module Attributes module Reflections class ReferenceOne < Base def self.build(_target, generated_methods, name, *args) options = args.extract_options! generate_methods name, generated_methods new(name, options) end 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
granite-form-0.2.0 | lib/granite/form/model/attributes/reflections/reference_one.rb |