spec/mocks/comment.rb in association_callbacks-0.0.2 vs spec/mocks/comment.rb in association_callbacks-0.1.0
- old
+ new
@@ -1,26 +1,26 @@
class Comment < ActiveRecord::Base
- belongs_to :post, :inverse_of => :comments
+ belongs_to :post, inverse_of: :comments
- after_save :update_post_updated_at, :source => :post
+ after_save :update_post_updated_at, source: :post
before_create :set_post_title
- before_save :update_post_title, :source => :post
- after_destroy :source => :post do |comment, post|
- comment.update_attributes!(:orphan_from_id => post.id)
+ before_save :update_post_title, source: :post
+ after_destroy source: :post do |comment, post|
+ comment.update_attributes!(orphan_from_id: post.id)
end
private
def set_post_title
self.post_title = post.title
end
def update_post_title(post)
- update_attributes!(:post_title => post.title) if post.title_changed?
+ update_attributes!(post_title: post.title) if post.title_changed?
end
def update_post_updated_at
- update_attributes!(:post_updated_at => post.updated_at)
+ update_attributes!(post_updated_at: post.updated_at)
end
end
\ No newline at end of file