This project is archived and is in readonly mode.

#1901 ✓invalid
Adam S

objects created by find_or_create_by_ methods do not call after_initalize/after_create

Reported by Adam S | February 7th, 2009 @ 01:20 AM | in 2.x

class MyModel < ActiveRecord::Base

def after_initialize
  attrib1 = 'value'
end

end

class MyModelTest < ActiveSupport::TestCase

test "attrib should be value"
  test_model = MyModel.find_or_create_by_attrib2('I like cats')
  assert_equal 'value', test_model.attrib1
end

end

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages