concerto / concerto-hardware

A Rails Engine for managing Bandshell-powered Concerto hardware
Other
7 stars 2 forks source link

Rails 4: Player Model Time Attributes broken #27

Closed mikldt closed 9 years ago

mikldt commented 9 years ago

It seems the setter from attr_accessor via our time_accessor method is being overwritten. Everytime a call is made, for example to wkday_on_time=, it seems to get sucked up by ActiveModel, which attempts to interpret it is a DB field. wkday_on_time= is called in :after_find so the plugin is non-viable while this bug exists.

ActiveModel seems to be doing some funny things these days (aliasing method_missing for one). Some investigation is required to see if the on-the-fly attr_accessor approach is still valid.

ActiveModel::MissingAttributeError in ConcertoHardware::PlayersController#show
can't write unknown attribute `wkday_on_time'
vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.6/lib/active_record/attribute_methods/write.rb:93:in `write_attribute_with_type_cast'
vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.6/lib/active_record/attribute_methods/write.rb:58:in `write_attribute'
vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.6/lib/active_record/attribute_methods/dirty.rb:68:in `write_attribute'
vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.6/lib/active_record/attribute_methods.rb:395:in `[]='
vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.6/lib/active_record/aggregations.rb:255:in `block (2 levels) in writer_method'
vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.6/lib/active_record/aggregations.rb:255:in `each'
vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.6/lib/active_record/aggregations.rb:255:in `block in writer_method'
/home/mike/dev/concerto-hardware/app/models/concerto_hardware/player.rb:107:in `block in retrieve_screen_on_off'
/home/mike/dev/concerto-hardware/app/models/concerto_hardware/player.rb:102:in `each'
/home/mike/dev/concerto-hardware/app/models/concerto_hardware/player.rb:102:in `retrieve_screen_on_off'