Securails

By default, all ActiveRecord attributes are writable. This leads to security problems:

This gem makes all attributes protected by default. To use individual attributes for mass assignment, please make them explicitely assignable using attr_accessible. More info here.

Installation

  1. Add the gem to your Gemfile.

    gem 'securails'
    
  2. Update your gem bundle.

    $ bundle install
    

Usage

Your app is safe by just including the gem. Now you have make those attributes that are safe to be changed by users accessible.

class Company < ActiveRecord::Base

  # Allow access to the 'name' attribute.
  attr_accessible :name
end