enum_attr messes up custom setters on .new and .create #29

Open
sheab opened this Issue Sep 9, 2011 · 0 comments

Comments

Projects
None yet
1 participant

sheab commented Sep 9, 2011

# user.rb
# t.enum :rank
# t.string :name
class User < ActiveRecord::Base
    enum_attr :rank, %w{user administrator}

    def name=(_name)
        self[:name] = "#{_name.upcase} + THE GREAT"
    end
end

Then

User.new(:name => "bob").name =>
"bob"

User.create(:name => "bob").name =>
"bob"

When the return should be "BOB THE GREAT"

When enum_attr is commented out, it works correctly.

Using current version of enumerated_attribute (0.2.16) and Rails 3.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment