Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

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

sheab opened this issue Sep 9, 2011 · 0 comments

Comments

@sheab
Copy link

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant