Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Commits on Oct 27, 2012
  1. fix AM::Serializers titles [ci skip]

    Francesco Rodriguez authored
Commits on Aug 4, 2012
  1. @vijaydev

    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. @fxn
Commits on Jul 31, 2012
  1. update ActiveModel::Serializers documentation [ci skip]

    Francesco Rodriguez authored
  2. add documentation to ActiveModel #from_json method [ci skip]

    Francesco Rodriguez authored
Commits on Jul 3, 2012
  1. @acapilleri

    small refactoring of as_json method

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

    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. change AMS::JSON.include_root_in_json default value to false

    Francesco Rodriguez 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. @jonleighton

    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. @josevalim

    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. @josevalim

    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. @bobbytables
Commits on Oct 4, 2011
  1. @bobbytables
Commits on Sep 22, 2011
  1. @josevalim

    Refactor AMo as_json.

    josevalim authored
  2. @mattetti

    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. @joefiorini
Commits on Jun 3, 2011
  1. @vijaydev
Commits on Sep 7, 2010
  1. @mackuba @jeremy

    fixed some issues with JSON encoding

    mackuba 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. @bensie

    to_json => as_json

    bensie authored
Commits on Aug 10, 2010
  1. @spastorino

    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. @fxn
Commits on Jul 16, 2010
  1. @neerajdotname
Commits on Jun 14, 2010
  1. @rizwanreza
Commits on Jun 7, 2010
  1. @josevalim
Commits on May 4, 2010
  1. @rubymerchant @jeremy

    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. @dhh
Commits on Aug 14, 2009
  1. @josh

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

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

    Kill AMo ivar attributes helper

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

    Add basic JSON serializer to AMo

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