-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
When doing
c = Category.new
c.name = "Foobar"
c.name_changed? # Returns true
name_changed? returns true, as one would expect, but when you create a new Category by doing
c = Category.new(:name => "Foobar")
c.name_changed? # Returns false
name_changed? returns false, is this how its supposed to work? As its not quite what I was expecting and feels much like a bug!
My Model can be found below for reference.
- app/models/category.rb
class Category
include Mongoid::Document
include Mongoid::Timestamps
field :name, :type => String
field :slug, :type => String
attr_accessible :name
validates :name,
:presence => true
end