| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| |
| |
| |
| |
| | |
AM::Validation#validates: custom exception for :strict option
Conflicts:
activemodel/CHANGELOG.md
|
| | |
|
|/
|
|
|
|
|
|
|
|
|
| |
https://github.com/rails/rails/issues/6958
- 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
|
| |
|
|
|
|
| |
class has specified for validations to be skipped.
|
| |
|
| |
|
|
|
|
|
|
| |
`:within` option as alias of `:in` as documented.
Fix #7118
|
|\
| |
| | |
Dynamic finders for aliased attributes
|
| |
| |
| |
| |
| | |
previously dynamic finders only worked in combination with the actual
column name and not its alias defined with #alias_attribute
|
|/
|
|
|
|
| |
ActiveRecord json/xml serialization should use as base
serializable_hash, provided by ActiveModel. Add some more coverage
around options :only and :except for both json and xml serialization.
|
|
|
|
|
| |
Get rid of ActiveModel::Configuration, make better use of
ActiveSupport::Concern + class_attribute, etc.
|
|
|
|
| |
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
|
|\ \ \
| | | |
| | | | |
Fix has secure password
|
| |/ / |
|
| |/
|/| |
|
| | |
|
|\ \
| | |
| | | |
clean the erros if an object that includes validation is duped.
|
| | |
| | |
| | |
| | | |
Fixes #5953
|
| | | |
|
|/ / |
|
| | |
|
|/
|
|
| |
collection-thing.
|
| |
|
|\
| |
| | |
Allow extra arguments for Observers
|
| | |
|
| |
| |
| | |
introduced here 17c990b153f8635874c006a7460ee95817543fc1
|
|\ \
| | |
| | | |
Observer: simplify tests
|
| |/ |
|
|\ \
| | |
| | | |
Fix Observer by acting on singleton class. Fixes #3505.
|
| |/
| |
| |
| | |
Also [issue #1034] [pull #6068]
|
|\ \
| | |
| | |
| | |
| | | |
bcardarella/confirmation_error_message_on_confirmation_attribute
confirmation validation error attribute
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This will render the error message on :#{attribute}_confirmation instead
of on attribute itself. When rendering confirmation errors inline on the
form with form builders such as SimpleForm and Formtastic it is
confusing to the ender user to see the confirmation error message on the
attribute element. Instead it makes more sense to have this validation
error render on the confirmation field instead.
The i18n message has been updated for the confirmation validator error
message to include the original attribute name.
|
| |/
|/| |
|
| | |
|
|\ \
| | |
| | | |
Rename Observing#count_observers to Observing#observers_count
|
| |/ |
|
|/ |
|
| |
|
|\
| |
| |
| |
| | |
nertzy/remove_deprecated_partial_path_from_active_model_naming
Remove ActiveModel::Naming#partial_path
|