Exclamation mark in Rails model method not found when object is passed in -
using rails 3.2. have following mailer action:
# shop.rb class shop < activerecord::base def deliver_update_notification!(user) version = self.versions(user).last editormailer.updated_spot(self, version).deliver end end # shops_controller.rb class shopscontroller < applicationcontroller def update @shop = shop.find(params[:id]) if @shop.update_attributes(params[:shop]) @shop.deliver_update_notification!(current_user) redirect_to shop_path(@shop) else render 'edit' end end end
somehow when pass in current_user
object method deliver_update_notification!
, throws error saying method cannot found. if changed method not accept object, method works. why behaving way?
also, don't remember why have exclamation mark in method. saw somewhere. what's purpose of exclamation mark?
thanks.
exclamation marks supposed indicate method "dangerous" , edits value of object calls it. not sure how define bang methods can not use '!' , make dangerous method on own.
Comments
Post a Comment