diff options
author | Jon Leighton <j@jonathanleighton.com> | 2010-10-06 12:11:38 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2010-10-06 12:11:38 +0100 |
commit | c954d54e2f36bb53ced5e3655adc071dd233797e (patch) | |
tree | d84bf4bf51f65a1c817089c6fe37c3e9f20420d0 /actionpack/test/lib/controller/fake_models.rb | |
parent | f2b41914d6be935182d37e0c0d491352ac3de043 (diff) | |
parent | d40ca9cce241a8083756c993d6c99a79e62e050e (diff) | |
download | rails-c954d54e2f36bb53ced5e3655adc071dd233797e.tar.gz rails-c954d54e2f36bb53ced5e3655adc071dd233797e.tar.bz2 rails-c954d54e2f36bb53ced5e3655adc071dd233797e.zip |
Merge branch 'master' into nested_has_many_through
Diffstat (limited to 'actionpack/test/lib/controller/fake_models.rb')
-rw-r--r-- | actionpack/test/lib/controller/fake_models.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/actionpack/test/lib/controller/fake_models.rb b/actionpack/test/lib/controller/fake_models.rb index 8cb3b4940a..dba632e6df 100644 --- a/actionpack/test/lib/controller/fake_models.rb +++ b/actionpack/test/lib/controller/fake_models.rb @@ -55,6 +55,11 @@ class Post < Struct.new(:title, :author_name, :body, :secret, :written_on, :cost alias_method :secret?, :secret + def initialize(*args) + super + @persisted = false + end + def persisted=(boolean) @persisted = boolean end @@ -130,6 +135,20 @@ class CommentRelevance end end +class Sheep + extend ActiveModel::Naming + include ActiveModel::Conversion + + attr_reader :id + def to_key; id ? [id] : nil end + def save; @id = 1 end + def new_record?; @id.nil? end + def name + @id.nil? ? 'new sheep' : "sheep ##{@id}" + end +end + + class TagRelevance extend ActiveModel::Naming include ActiveModel::Conversion |