cleaner reading of unread parameter

This commit is contained in:
Steven Fuchs 2011-12-23 11:36:20 -05:00
parent 1519cdd672
commit cd75c6ea67

View file

@ -11,7 +11,7 @@ class NotificationsController < VannaController
def update(opts=params) def update(opts=params)
note = Notification.where(:recipient_id => current_user.id, :id => opts[:id]).first note = Notification.where(:recipient_id => current_user.id, :id => opts[:id]).first
if note if note
note.update_attributes(:unread => opts[:unread] || false ) note.update_attributes(:unread => opts[:unread].to_s == "true" )
{} {}
else else
Response.new :status => 404 Response.new :status => 404