Skip to content
This repository

Oct 27, 2012

  1. Francesco Rodríguez

    fix AM::Serializers titles [ci skip]

    frodsan authored

Aug 04, 2012

  1. Vijay Dev

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

    Conflicts:
    	activemodel/lib/active_model/secure_password.rb
    	activerecord/lib/active_record/associations/collection_proxy.rb
    vijaydev authored

Aug 02, 2012

  1. Xavier Noria

    load active_support/core_ext/class/attribute in active_support/rails

    fxn authored

Jul 31, 2012

  1. Francesco Rodríguez

    update ActiveModel::Serializers documentation [ci skip]

    frodsan authored
  2. Francesco Rodríguez

    add documentation to ActiveModel #from_json method [ci skip]

    frodsan authored

Jul 03, 2012

  1. Angelo Capilleri

    small refactoring of as_json method

    with this change root has always one assignment
    acapilleri authored

Jun 15, 2012

  1. Jon Leighton

    Simplify AR configuration code.

    Get rid of ActiveModel::Configuration, make better use of
    ActiveSupport::Concern + class_attribute, etc.

Jun 06, 2012

  1. Francesco Rodríguez

    change AMS::JSON.include_root_in_json default value to false

    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.
    frodsan authored

Dec 28, 2011

  1. Jon Leighton

    Support configuration on ActiveRecord::Model.

    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.
    jonleighton authored

Nov 30, 2011

  1. José Valim

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

    … 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
    josevalim authored

Nov 23, 2011

  1. José Valim

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

    …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.
    josevalim authored

Oct 05, 2011

  1. Robert Ross

    Change one more place for JSON string to Hash

    bobbytables authored

Oct 04, 2011

  1. Robert Ross

    Fix as_json doc to say what it actually returns.

    bobbytables authored

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…

    … to not include the root, but an instance is serialized with the root option passed as true
    mattetti authored

Jul 02, 2011

  1. Joe Fiorini

    Enable passing root: false to #to_json

    joefiorini authored

Jun 03, 2011

  1. Vijay Dev

    use clearer variable name in examples

    vijaydev authored

Sep 07, 2010

  1. Jakub Suder

    fixed some issues with JSON encoding

    - 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>
    jsuder authored jeremy committed

Aug 25, 2010

  1. James Miller

    to_json => as_json

    bensie authored

Aug 10, 2010

  1. Santiago Pastorino

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

    …ibute for the classes which includes this module
    spastorino authored

Aug 06, 2010

  1. Xavier Noria

    edit pass to AMo::Serializers::JSON

    fxn authored

Jul 16, 2010

  1. Neeraj Singh

    adding proper markup to comment

Jun 14, 2010

  1. Rizwan Reza

    Added headings to serializers.

    rizwanreza authored

Jun 07, 2010

  1. José Valim

    Really make include_root_in_json default to true [#3770 state:resolved]

    josevalim authored

May 04, 2010

  1. Jatinder Singh

    Active Model JSON serializer now supports custom root option

    [#4515 state:committed]
    
    Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
    rubymerchant authored jeremy committed

Jan 04, 2010

  1. David Heinemeier Hansson

    Change the ActiveModel::Base.include_root_in_json default to true for…

    … Rails 3 [DHH]
    dhh authored

Aug 14, 2009

  1. Joshua Peek

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

    …nd the actual serializer
    josh authored

Jul 21, 2009

  1. Joshua Peek

    Kill AMo ivar attributes helper

    josh authored

Jul 04, 2009

  1. Joshua Peek

    Integrate AMo JSON serializer into AR

    josh authored
  2. Joshua Peek

    Initial extraction of AMo xml serializer

    josh authored
  3. Joshua Peek

    Ensure JSON serializer includes model naming

    josh authored

Jun 18, 2009

  1. Joshua Peek

    Add basic JSON serializer to AMo

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