Skip to content
This repository has been archived by the owner on Sep 18, 2019. It is now read-only.

Attrio default doesn't work in ActiveRecord models #2

Open
Sephi-Chan opened this issue Jun 2, 2013 · 0 comments
Open

Attrio default doesn't work in ActiveRecord models #2

Sephi-Chan opened this issue Jun 2, 2013 · 0 comments

Comments

@Sephi-Chan
Copy link

With the following code:

class Format < ActiveRecord::Base
  include Attrio

  define_attributes(inspect: false) do
    attr :teams_count, Integer, default: 2
  end
end

The following test fails:

class FormatTest < ActiveSupport::TestCase
  test "Teams count of a format should default to 2" do
    Format.create(name: 'Foo')
    assert_equal 2, Format.first.teams_count
  end
end

The saved value of teams_count is nil.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant