Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.
This project is archived and is in readonly mode.
ActiveRecord::Base#new and #create accepts both a Hash of attributes and a block:
User.create(:first_name => 'Jamie') do |u| u.is_admin = false end
This patch adds that same functionality to update_attributes:
user.update_attributes(:first_name => 'Jamie') do |u| u.is_admin = false end user.first_name #=> 'Jamie' user.is_admin #=> false
A use case for this is in the administration area, where authenticated users might be allowed to update attributes that are otherwise protected.
Edited by Rohit Arondekar for formatting.
Reported by Jakob S · April 3rd, 2011 @ 10:48 AM
/pwned by Lighthouse code formatting :(
Attached revised patch with docs for the changes.
April 3rd, 2011 @ 10:54 AM