News for hackers. Stuff that matters.
Re:Chapter 6 of the Rails Tutorial, 2nd Edition is out ("Mod... by danneu on Friday January 27, 2012 @08:08PM (#3520966)
You can still use attr_accessible in the controller-layer.

    class AccountsController < ApplicationController
      include ActiveModel::MassAssignmentSecurity

      attr_accessible :first_name, :last_name
      ...
http://api.rubyonrails.org/classes/ActiveModel/MassAssignmen... explicitly states: Note that using Hash#except or Hash#slice in place of attr_accessible to sanitize attributes won’t provide sufficient protection.

I agree with you, though. Model-level attr_accessible, if nothing else, is flatly annoying. I feel inconvenienced by a measure that's supposed to protect against malicious users. And I feel like the terrorists have already won. I'm no MVC guru, but it makes sense to me that the Controller would deal with what amounts to the params that are on their way to the model. Why should the model have to worry about mass assignment?

Re:Chapter 6 of the Rails Tutorial, 2nd Edition is out ("Mod... by snprbob86 on Friday January 27, 2012 @08:50PM (#3521069)
`except` is a bad idea because it's a black-list, but what's wrong with using `slice` as a white-list?

(Anyway, I just grepped our code and there is only ONE usage of slice in a controller anyway, the rest are explicit, non-mass assignments)