| Commit message (Collapse) | Author | Age | Files | Lines |
|\ |
|
| | |
|
| |
| |
| |
| |
| | |
* Moved the simplest case--enable/disable all on all--to the top.
* Made clear what "ORM" means to avoid having to teach people how to solve "uninitialized constant ORM"
errors in their test reports.
|
| |
| |
| |
| | |
security (http://homakov.blogspot.co.uk/2012/05/saferweb-injects-in-various-ruby.html)
|
|\ \
| | |
| | | |
Compact array of values added to PermissionSet instance
|
| |/ |
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|\
| |
| |
| |
| | |
kuroda/translation_of_deeply_nested_model_attributes
Fix human attribute_name to handle deeply nested attributes
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When a model nests another model that also nests yet another model
using accepts_nested_attributes_for method, its Errors object can
have an attribute name with "contacts.addresses.street" style.
In this case, the dots within the namespace should be substituted
with slashes so that we can provide the translation under the
"activemodel.attributes.person/contacts/addresses.street" key.
This commit is related to #3859.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.)
|
|\ \ |
|
| | | |
|
|\ \ \
| |/ /
|/| |
| | |
| | | |
ayamomiji/add-self-to-allow-method-name-using-ruby-keyword
add `self.` to allow method name using ruby keyword
|
| | |
| | |
| | |
| | | |
column that named as a ruby keyword
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
XmlMini define the xml 'datatime', but according to
http://www.w3.org/TR/xmlschema-2/#dateTime could be better
change this to 'dateTime' with upper case letter 'T.
So 'DateTime' and 'Time' are redefined from 'datetime' to 'dateTime'
add the changing to the changelog
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This reverts commit cae1ca7d1be9c79c7ef012a1f62aef9d3bb815f8, reversing
changes made to da97cf016a8ffd1f54f804cd881f393e5d6efc18.
These changes break the build, it needs more investigation.
|
|\ \ \
| | | |
| | | | |
Call undefine_attribute_methods only when defining new attributes
|
| | | | |
|
|\ \ \ \
| |/ / /
|/| | | |
Remove sort on attributes.keys
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | | |
Fix has secure password
|
| | | | |
| | | | |
| | | | |
| | | | | |
options to turn validations off.
|
|\ \ \ \ \
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Conflicts:
activerecord/lib/active_record/core.rb
|
| | | | | | |
|
| | | | | | |
|
| | | | | | |
|
| | | | | | |
|
| |_|_|_|/
|/| | | | |
|
| | | | | |
|
|\ \ \ \ \
| |/ / / /
|/| | | | |
clean the erros if an object that includes validation is duped.
|
| | | | |
| | | | |
| | | | |
| | | | | |
Fixes #5953
|
|\ \ \ \ \
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Conflicts:
actionpack/lib/action_view/helpers/asset_tag_helper.rb
|
| |/ / / / |
|
| | | | | |
|
| | | | | |
|
|\ \ \ \ \
| |/ / / /
|/| | | | |
Use the more idiomatic tap method
|
| | | | | |
|
| | | | | |
|
| | | | | |
|
| |/ / /
|/| | |
| | | |
| | | | |
collection-thing.
|
| | | | |
|
| |_|/
|/| | |
|
|\ \ \ |
|
| | | | |
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | | |
Allow extra arguments for Observers
|
| | | | | |
|