Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on Mar 4, 2013
  1. Yves Senn

    `has_secure_password` is not invalid when assigning empty Strings.

    senny authored
    Closes #9535.
    
    With 692b3b6 the `password=` setter does no longer set blank passwords.
    This triggered validation errors when assigning empty Strings to `password`
    and `password_confirmation`.
    
    This patch only sets the confirmation if it is not `blank?`.
  2. Yves Senn
Commits on Feb 26, 2013
  1. Rafael Mendonça França

    Update CHANGELOGS

    rafaelfranca authored
Commits on Feb 25, 2013
  1. David Heinemeier Hansson

    Preparing for 4.0.0.beta1 release

    dhh authored
Commits on Feb 24, 2013
  1. Xavier Noria
Commits on Dec 26, 2012
  1. Rafael Mendonça França
  2. Rafael Mendonça França
Commits on Dec 21, 2012
  1. Rafael Mendonça França
Commits on Dec 20, 2012
  1. Carlos Antonio da Silva

    Fix Action Mailer changelog indenation to match other changelogs

    carlosantoniodasilva authored
    Also some minor improvements to other changelogs. [ci skip]
  2. Carlos Antonio da Silva
Commits on Dec 15, 2012
  1. Roberto Vasquez Angel Steve Klabnik

    Add `ActiveModel::Validations::AbsenceValidator`, a validator to chec…

    robotex82 authored steveklabnik committed
    …k the absence of attributes.
    
    Add `ActiveModel::Errors#add_on_present` method. Adds error messages to present attributes.
Commits on Dec 14, 2012
  1. Carlos Antonio da Silva
Commits on Dec 1, 2012
  1. Renato Mascarenhas

    Reset attributes should not report changes.

    rmascarenhas authored
    When resetting an attribute, you expect it to return to the state it was
    before any changes. Namely, this fixes this unexpected behavior:
    
    ~~~ruby
    model.name = "Bob"
    model.reset_name!
    model.name_changed? #=> true
    ~~~
Commits on Nov 29, 2012
  1. Rafael Mendonça França
Commits on Nov 28, 2012
  1. Steve Klabnik

    Specify type of singular association during serialization

    steveklabnik authored
    When serialising a class, specify the type of any singular associations, if
    necessary. Rails already correctly specifies the :type of any enumerable
    association (e.g. a has_many association), but made no attempt to do so for
    non-enumerables (e.g. a has_one association).
    We must specify the :type of any STI association. A has_one
    association to a class which uses single-table inheritance is an example of
    this type of association.
    
    Fixes #7471
Commits on Nov 26, 2012
  1. Rafael Mendonça França

    Merge pull request #7282 from xHire/validates_length_of_fix

    rafaelfranca authored
    Length validation handles correctly nil. Fix #7180
    
    Conflicts:
    	activemodel/CHANGELOG.md
  2. Michal Zima

    Length validation handles correctly nil. Fix #7180

    xHire authored
    When nil or empty string are not allowed, they are not valid.
Commits on Nov 25, 2012
  1. Yves Senn
Commits on Nov 14, 2012
  1. Trevor Turk
Commits on Oct 18, 2012
  1. Jan Berdajs
Commits on Oct 3, 2012
  1. Rafael Mendonça França

    Revert "Merge pull request #7826 from sikachu/master-validators-kind"

    rafaelfranca authored
    This reverts commit 4e9f53f, reversing
    changes made to 6b802cd.
    
    Revert "Don't use tap in this case."
    
    This reverts commit 454d820.
    
    Reason: Is not a good idea to add options to this method since we can do
    the same thing using method composition.
    
        Person.validators_on(:name).select { |v| v.kind == :presence }
    
    Also it avoids to change the method again to add more options.
  2. Prem Sichanugrist

    Make `.validators_on` accept `:kind` option

    sikachu authored
    This will filter out the validators on a particular attribute based on
    its kind.
Commits on Sep 19, 2012
  1. Guillermo Iguaran
Commits on Sep 7, 2012
  1. Carlos Antonio da Silva

    Update Active Model xml serialization test to reflect a change in bui…

    carlosantoniodasilva authored
    …lder
    
    Due to a change in builder, nil values and empty strings now generates
    closed tags, so instead of this:
    
        <pseudonyms nil=\"true\"></pseudonyms>
    
    It generates this:
    
        <pseudonyms nil=\"true\"/>
    
    Document this change in Rails so that people can track it down easily if
    necessary.
Commits on Aug 28, 2012
  1. Xavier Noria

    CHANGELOGs are now per branch

    fxn authored
    Changes in old branches needed to be manually synched in CHANGELOGs of newer ones.
    This has proven to be brittle, sometimes one just forgets this manual step.
    With this commit we switch to CHANGELOGs per branch. When a new major version is
    cut from master, the CHANGELOGs in master start being blank.
    
    A link to the CHANGELOG of the previous branch allows anyone interested to
    follow the history.
Commits on Aug 24, 2012
  1. Gabriel Sobrinho
Commits on Aug 16, 2012
  1. Rafael Mendonça França

    Merge pull request #7024 from bogdan/strict_validation_custom_exception

    rafaelfranca authored
    AM::Validation#validates: custom exception for :strict option
    
    Conflicts:
    	activemodel/CHANGELOG.md
Commits on Aug 14, 2012
  1. Anthony Alberto

    Following the false issue reporting I did here : #6958

    anthonyalberto authored
    - Enable propagation of :skip_types, :dasherize and :camelize on included models by default
    - Adding the option to override this propagation on a per-include basis (:include => { :model => { :dasherize => false } }
    - Enough tests to prove it works
    - Updated activemodel CHANGELOG.md
    
    Squashed my commits
Commits on Aug 11, 2012
  1. Rafael Mendonça França

    Sync CHANGELOGs [ci skip]

    rafaelfranca authored
Commits on Aug 6, 2012
  1. Bogdan Gusiev
Commits on Jun 14, 2012
  1. Jan Berdajs
Commits on Jun 6, 2012
  1. Francesco Rodríguez

    change AMS::JSON.include_root_in_json default value to false

    frodsan authored
    Changes:
    
    * Update `include_root_in_json` default value to false for default value
      to false for `ActiveModel::Serializers::JSON`.
    * Remove unnecessary change to include_root_in_json option in
      wrap_parameters template.
    * Update `as_json` documentation.
    * Fix JSONSerialization tests.
    
    Problem:
    
    It's confusing that AM serializers behave differently from AR,
    even when AR objects include AM serializers module.
    
        class User < ActiveRecord::Base; end
    
        class Person
          include ActiveModel::Model
          include ActiveModel::AttributeMethods
          include ActiveModel::Serializers::JSON
    
          attr_accessor :name, :age
    
          def attributes
            instance_values
          end
        end
    
        user.as_json
        => {"id"=>1, "name"=>"Konata Izumi", "age"=>16, "awesome"=>true}
        # root is not included
    
        person.as_json
        => {"person"=>{"name"=>"Francesco", "age"=>22}}
        # root is included
    
        ActiveRecord::Base.include_root_in_json
        => false
    
        Person.include_root_in_json
        => true
    
        # different default values for include_root_in_json
    
    Proposal:
    
    Change the default value of AM serializers to false, update
    the misleading documentation and remove unnecessary change
    to false of include_root_in_json option with AR objects.
    
        class User < ActiveRecord::Base; end
    
        class Person
          include ActiveModel::Model
          include ActiveModel::AttributeMethods
          include ActiveModel::Serializers::JSON
    
          attr_accessor :name, :age
    
          def attributes
            instance_values
          end
        end
    
        user.as_json
        => {"id"=>1, "name"=>"Konata Izumi", "age"=>16, "awesome"=>true}
        # root is not included
    
        person.as_json
        => {"name"=>"Francesco", "age"=>22}
        # root is not included
    
        ActiveRecord::Base.include_root_in_json
        => false
    
        Person.include_root_in_json
        => false
    
        # same behaviour, more consistent
    
    Fixes #6578.
Commits on Jun 1, 2012
  1. Rafael Mendonça França
Commits on May 28, 2012
  1. Steve Purcell

    Don't enable validations when passing false hash values to ActiveMode…

    purcell authored
    …l.validates
    
    Passing a falsey option value for a validator currently causes that validator to
    be enabled, just like "true":
    
        ActiveModel.validates :foo, :presence => false
    
    This is rather counterintuitive, and makes it inconvenient to wrap `validates` in
    methods which may conditionally enable different validators.
    
    As an example, one is currently forced to write:
    
          def has_slug(source_field, options={:unique => true})
            slugger = Proc.new { |r| r[:slug] = self.class.sluggify(r[source_field]) if r[:slug].blank? }
            before_validation slugger
            validations = { :presence => true, :slug => true }
            if options[:unique]
              validations[:uniqueness] = true
            end
            validates :slug, validations
          end
    
    because the following reasonable-looking alternative fails to work as expected:
    
          def has_slug(source_field, options={:unique => true})
            slugger = Proc.new { |r| r[:slug] = self.class.sluggify(r[source_field]) if r[:slug].blank? }
            before_validation slugger
            validates :slug, :presence => true, :slug => true, :uniqueness => options[:unique]
          end
    
    (This commit includes a test, and all activemodel and activerecord tests pass as before.)
Commits on Apr 24, 2012
  1. Brian Cardarella

    Reordered changelog entry

    bcardarella authored
Something went wrong with that request. Please try again.