Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on Oct 27, 2012
  1. Francesco Rodríguez
Commits on Aug 4, 2012
  1. Vijay Dev

    Merge branch 'master' of github.com:lifo/docrails

    vijaydev authored
    Conflicts:
    	activemodel/lib/active_model/secure_password.rb
    	activerecord/lib/active_record/associations/collection_proxy.rb
Commits on Aug 2, 2012
  1. Xavier Noria
Commits on Jul 31, 2012
  1. Francesco Rodríguez
  2. Francesco Rodríguez
Commits on Jul 3, 2012
  1. Angelo Capilleri

    small refactoring of as_json method

    acapilleri authored
    with this change root has always one assignment
Commits on Jun 15, 2012
  1. Jon Leighton

    Simplify AR configuration code.

    jonleighton authored
    Get rid of ActiveModel::Configuration, make better use of
    ActiveSupport::Concern + class_attribute, etc.
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 Dec 28, 2011
  1. Jon Leighton

    Support configuration on ActiveRecord::Model.

    jonleighton authored
    The problem: We need to be able to specify configuration in a way that
    can be inherited to models that include ActiveRecord::Model. So it is
    no longer sufficient to put 'top level' config on ActiveRecord::Base,
    but we do want configuration specified on ActiveRecord::Base and
    descendants to continue to work.
    
    So we need something like class_attribute that can be defined on a
    module but that is inherited when ActiveRecord::Model is included.
    
    The solution: added ActiveModel::Configuration module which provides a
    config_attribute macro. It's a bit specific hence I am not putting this
    in Active Support or making it a 'public API' at present.
Commits on Nov 30, 2011
  1. José Valim

    Revert "Implement ArraySerializer and move old serialization API to a…

    josevalim authored
    … new namespace."
    
    This reverts commit 8896b4f.
    
    Conflicts:
    
    	activemodel/lib/active_model.rb
    	activemodel/lib/active_model/serializable.rb
    	activemodel/lib/active_model/serializer.rb
    	activemodel/test/cases/serializer_test.rb
Commits on Nov 23, 2011
  1. José Valim

    Implement ArraySerializer and move old serialization API to a new nam…

    josevalim authored
    …espace.
    
    The following constants were renamed:
    
      ActiveModel::Serialization     => ActiveModel::Serializable
      ActiveModel::Serializers::JSON => ActiveModel::Serializable::JSON
      ActiveModel::Serializers::Xml  => ActiveModel::Serializable::XML
    
    The main motivation for such a change is that `ActiveModel::Serializers::JSON`
    was not actually a serializer, but a module that when included allows the target to be serializable to JSON.
    
    With such changes, we were able to clean up the namespace to add true serializers as the ArraySerializer.
Commits on Oct 5, 2011
  1. Robert Ross
Commits on Oct 4, 2011
  1. Robert Ross
Commits on Sep 22, 2011
  1. José Valim

    Refactor AMo as_json.

    josevalim authored
  2. Matt Aimonetti

    fixed a bug with the json serialization when the class setting is set…

    mattetti authored
    … to not include the root, but an instance is serialized with the root option passed as true
Commits on Jul 2, 2011
  1. Joe Fiorini
Commits on Jun 3, 2011
  1. Vijay Dev
Commits on Sep 7, 2010
  1. Jakub Suder Jeremy Kemper

    fixed some issues with JSON encoding

    jsuder authored jeremy committed
    - as_json in ActiveModel should return a hash
      and handle :only/:except/:methods options
    - Array and Hash should call as_json on their elements
    - json methods should not modify options argument
    
    [#5374 state:committed]
    
    Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Commits on Aug 25, 2010
  1. James Miller

    to_json => as_json

    bensie authored
Commits on Aug 10, 2010
  1. Santiago Pastorino

    ActiveModel::Base doesn't exist, include_root_in_json is a class_attr…

    spastorino authored
    …ibute for the classes which includes this module
Commits on Aug 6, 2010
  1. Xavier Noria
Commits on Jul 16, 2010
  1. Neeraj Singh
Commits on Jun 14, 2010
  1. Rizwan Reza
Commits on Jun 7, 2010
  1. José Valim
Commits on May 4, 2010
  1. Jatinder Singh Jeremy Kemper

    Active Model JSON serializer now supports custom root option

    rubymerchant authored jeremy committed
    [#4515 state:committed]
    
    Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Commits on Jan 4, 2010
  1. David Heinemeier Hansson
Commits on Aug 14, 2009
  1. Joshua Peek

    Break up concerns for choosing what attributes should be serialized a…

    josh authored
    …nd the actual serializer
Commits on Jul 21, 2009
  1. Joshua Peek

    Kill AMo ivar attributes helper

    josh authored
Commits on Jul 4, 2009
  1. Joshua Peek
  2. Joshua Peek
  3. Joshua Peek
Commits on Jun 18, 2009
  1. Joshua Peek

    Add basic JSON serializer to AMo

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