aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/models/contact.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-02-21 08:47:37 +0100
committerJosé Valim <jose.valim@gmail.com>2010-02-21 09:08:59 +0100
commit9dd67fce25d3993a0ee494506ba246a45d395e3f (patch)
tree4185a25a3be50de5fcd29d387782145d49cd1dcc /activemodel/test/models/contact.rb
parentf81c6bc0404ba2a03eed0ec6c08bbac45661305f (diff)
downloadrails-9dd67fce25d3993a0ee494506ba246a45d395e3f.tar.gz
rails-9dd67fce25d3993a0ee494506ba246a45d395e3f.tar.bz2
rails-9dd67fce25d3993a0ee494506ba246a45d395e3f.zip
Add to_key and to_param methods to ActiveModel::Conversion.
Diffstat (limited to 'activemodel/test/models/contact.rb')
-rw-r--r--activemodel/test/models/contact.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/activemodel/test/models/contact.rb b/activemodel/test/models/contact.rb
index f9fb0af027..dbdb8539b7 100644
--- a/activemodel/test/models/contact.rb
+++ b/activemodel/test/models/contact.rb
@@ -1,7 +1,13 @@
class Contact
- attr_accessor :name, :age, :created_at, :awesome, :preferences
+ include ActiveModel::Conversion
+
+ attr_accessor :id, :name, :age, :created_at, :awesome, :preferences, :new_record
def initialize(options = {})
options.each { |name, value| send("#{name}=", value) }
end
+
+ def new_record?
+ defined?(@new_record) ? @new_record : true
+ end
end