How I can set 'attr_accessible' in order to NOT allow access to ANY of the fields FOR a model using Ruby on Rails?

后端 未结 4 982

If in a model file I have just this code:

class Users < ActiveRecord::Base
end

what this means? All attributes related to the model are acce

4条回答
  •  情书的邮戳
    2021-02-19 03:41

    Just set:

    class Users < ActiveRecord::Base
      attr_accessible #none
    end
    

    Like Pan Thomakos said (attr_accessible is the array of parameters that can be mass-ret. So if you send in no symbols, then no parameters will be accessible.

    This ticket was useful

提交回复
热议问题