Has anyone ever had trouble doing this? Whenever I try to do so, it
doesn't seem to work:
in my model:
[code]
before_create :set_defaults
def set_defaults
self.submitted = false
end
[/code]
in my rspec test:
[code]
it "Should set 'submitted' to false before a create" do
@assignment = Assignment.new(:submitted => true)
@assignment.save
@assignment.submitted.should be_false
end
[/code]
and the result:
[code]
Assignment Should set 'submitted' to false before a create' FAILED
expected false, got true
[/code]
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---