diff options
Diffstat (limited to 'activerecord/test/models/topic.rb')
-rw-r--r-- | activerecord/test/models/topic.rb | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/activerecord/test/models/topic.rb b/activerecord/test/models/topic.rb index 21c23ed2a2..db04735d01 100644 --- a/activerecord/test/models/topic.rb +++ b/activerecord/test/models/topic.rb @@ -2,18 +2,18 @@ class Topic < ActiveRecord::Base scope :base, -> { all } scope :written_before, lambda { |time| if time - where 'written_on < ?', time + where "written_on < ?", time end } - scope :approved, -> { where(:approved => true) } - scope :rejected, -> { where(:approved => false) } + scope :approved, -> { where(approved: true) } + scope :rejected, -> { where(approved: false) } scope :scope_with_lambda, lambda { all } - scope :by_lifo, -> { where(:author_name => 'lifo') } - scope :replied, -> { where 'replies_count > 0' } + scope :by_lifo, -> { where(author_name: "lifo") } + scope :replied, -> { where "replies_count > 0" } - scope 'approved_as_string', -> { where(:approved => true) } + scope "approved_as_string", -> { where(approved: true) } scope :anonymous_extension, -> { all } do def one 1 @@ -22,7 +22,7 @@ class Topic < ActiveRecord::Base scope :with_object, Class.new(Struct.new(:klass)) { def call - klass.where(:approved => true) + klass.where(approved: true) end }.new(self) @@ -33,10 +33,10 @@ class Topic < ActiveRecord::Base end has_many :replies, dependent: :destroy, foreign_key: "parent_id", autosave: true - has_many :approved_replies, -> { approved }, class_name: 'Reply', foreign_key: "parent_id", counter_cache: 'replies_count' + has_many :approved_replies, -> { approved }, class_name: "Reply", foreign_key: "parent_id", counter_cache: "replies_count" - has_many :unique_replies, :dependent => :destroy, :foreign_key => "parent_id" - has_many :silly_unique_replies, :dependent => :destroy, :foreign_key => "parent_id" + has_many :unique_replies, dependent: :destroy, foreign_key: "parent_id" + has_many :silly_unique_replies, dependent: :destroy, foreign_key: "parent_id" serialize :content @@ -84,8 +84,8 @@ class Topic < ActiveRecord::Base end def set_email_address - unless self.persisted? - self.author_email_address = 'test@test.com' + unless persisted? + self.author_email_address = "test@test.com" end end @@ -113,6 +113,6 @@ end module Web class Topic < ActiveRecord::Base - has_many :replies, :dependent => :destroy, :foreign_key => "parent_id", :class_name => 'Web::Reply' + has_many :replies, dependent: :destroy, foreign_key: "parent_id", class_name: "Web::Reply" end end |