rails/rails — Issue #3585: setting active_model attribute using hash method not working
Author: jshow
Created: 2011-11-09 16:46:01+00:00
State: open

Rails 3.1.1
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.4.0] (MRI)

Company.rb < ActiveRecord::Base
attr_accessor :postal_code_or_city
end

rails console
Loading development environment (Rails 3.1.1)

> c = Company.new
> c[:postal_code_or_city] = 'k9j2p3'
=> "k9j2p3"
> c.postal_code_or_city
=> nil

> c.send("postal_code_or_city=", "90210")
=> "90210"
ruby-1.9.2-p290 > c.postal_code_or_city
=> "90210"

is this the expected behaviour ?

thanks.