Notes posted by skalee
RSS feed
Changing time/date separators
@hayafirst — it is possible to remove that “:” or change it to something else. Just pass `:time_separator` option. Inspect ActionView::Helpers::DateTimeSelector#separator method for more.

Don't mix attr_accessible and attr_protected within single class.
Don’t use constructs like this one, they won’t work:
class User < ActiveRecord::Base attr_accessible :name attr_protected :id, :password_digest, :created_at, :updated_at, as: :admin end
Instead, use the same method for all roles:
class User < ActiveRecord::Base attr_accessible :name attr_accessible :name, :login, as: :admin end
—
You may want to add following to your `/config/initializers`:
class ActiveRecord::Base class << self alias :original_inherited :inherited def inherited subclass original_inherited subclass subclass.attr_accessible subclass.attr_accessible(subclass.attribute_names.map(&:to_sym) - [:id, :created_at, :updated_at], as: :admin) end end end

Don't allow mass assignments on model
Replying to elfo’s comment, you can achieve it easier, just add following line to `/config/application.rb`.
config.active_record.whitelist_attributes = true
All attributes in all models will be mass assignment protected by default. You can still use attr_accessible or attr_protected to override it.