Sha256: 55ee47b8c7930066be487fe205c7eca02cfd09e203eac49e973abc61ba275dbb
Contents?: true
Size: 704 Bytes
Versions: 1
Compression:
Stored size: 704 Bytes
Contents
module Reform::Form::ActiveModel def self.included(base) base.class_eval do extend ClassMethods end end module ClassMethods def model(*args) @model_options = args # FIXME: make inheritable! main_model = args.last[:on] delegate main_model, :to => :model # #song => model.song delegate "persisted?", :to_key, :to_param, :to => main_model # #to_key => song.to_key alias_method args.first, main_model # #hit => model.song. end def property(name, options={}) delegate options[:on], :to => :model super end def model_name ActiveModel::Name.new(self, nil, @model_options.first.to_s.camelize) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
reform-0.1.0 | lib/reform/form/active_model.rb |