Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Don't enable validations when passing false hash values to ActiveModel.validates | Steve Purcell | 2012-05-28 | 1 | -0/+5 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.) | ||||
* | Merge pull request #4785 from ↵ | José Valim | 2012-05-25 | 1 | -0/+22 |
|\ | | | | | | | | | ayamomiji/add-self-to-allow-method-name-using-ruby-keyword add `self.` to allow method name using ruby keyword | ||||
| * | fix `alias_attribute` will raise a syntax error if make an alias on a | ayaya | 2012-05-14 | 1 | -0/+22 |
| | | | | | | | | column that named as a ruby keyword | ||||
* | | changed xml type datetime to dateTime, fixes #6328 | Angelo capilleri | 2012-05-23 | 1 | -1/+1 |
| | | | | | | | | | | | | | | | | | | 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 | ||||
* | | Merge pull request #6215 from erichmenge/fix_has_secure_password | Aaron Patterson | 2012-05-17 | 4 | -10/+33 |
|\ \ | | | | | | | Fix has secure password | ||||
| * | | Updated tests for has_secure_password. | Erich Menge | 2012-05-08 | 4 | -10/+33 |
| |/ | |||||
* | | Improve logging of ActiveModel::MassAssignmentSecurity::Sanitizer | Naoto Takai | 2012-05-17 | 2 | -5/+5 |
| | | |||||
* | | Kill whitespaces :scissors: | Carlos Antonio da Silva | 2012-05-15 | 1 | -1/+1 |
| | | |||||
* | | Merge pull request #6284 from acapilleri/dup_validation | Carlos Antonio da Silva | 2012-05-15 | 1 | -0/+15 |
|\ \ | | | | | | | clean the erros if an object that includes validation is duped. | ||||
| * | | clean the erros if an object that includes validations errors is duped. ↵ | Angelo Capilleri | 2012-05-13 | 1 | -0/+15 |
| | | | | | | | | | | | | Fixes #5953 | ||||
* | | | updating define_attribute_methods documentation | Francesco Rodriguez | 2012-05-14 | 1 | -1/+1 |
| | | | |||||
* | | | allow define_attribute_methods to pass multiple values | Francesco Rodriguez | 2012-05-14 | 1 | -6/+13 |
|/ / | |||||
* | | Remove useless load path modifications | Santiago Pastorino | 2012-05-11 | 1 | -3/+0 |
| | | |||||
* | | Use respond_to?(:to_ary) rather than is_a?(Enumerable) to detect ↵ | Jon Leighton | 2012-05-11 | 2 | -0/+35 |
|/ | | | | collection-thing. | ||||
* | notify_observers should be public | Marc-Andre Lafortune | 2012-04-30 | 1 | -2/+9 |
| | |||||
* | Merge pull request #6063 from marcandre/observer_extra_args | Aaron Patterson | 2012-04-30 | 1 | -2/+9 |
|\ | | | | | Allow extra arguments for Observers | ||||
| * | Allow extra arguments for Observers | Marc-Andre Lafortune | 2012-04-30 | 1 | -2/+9 |
| | | |||||
* | | build fix for observing_test.rb | Arun Agrawal | 2012-04-30 | 1 | -1/+1 |
| | | | | | | introduced here 17c990b153f8635874c006a7460ee95817543fc1 | ||||
* | | Merge pull request #6072 from marcandre/observer_simplify_test | Santiago Pastorino | 2012-04-30 | 1 | -11/+4 |
|\ \ | | | | | | | Observer: simplify tests | ||||
| * | | Observer: simplify tests | Marc-Andre Lafortune | 2012-04-29 | 1 | -11/+4 |
| |/ | |||||
* | | Merge pull request #6071 from marcandre/observer_redef | Jeremy Kemper | 2012-04-29 | 1 | -2/+13 |
|\ \ | | | | | | | Fix Observer by acting on singleton class. Fixes #3505. | ||||
| * | | Fix Observer by acting on singleton class [#3505] | Marc-Andre Lafortune | 2012-04-29 | 1 | -2/+13 |
| |/ | | | | | | | Also [issue #1034] [pull #6068] | ||||
* | | Merge pull request #5942 from ↵ | Aaron Patterson | 2012-04-29 | 4 | -9/+33 |
|\ \ | | | | | | | | | | | | | bcardarella/confirmation_error_message_on_confirmation_attribute confirmation validation error attribute | ||||
| * | | Support i18n attributes for confirmation | Brian Cardarella | 2012-04-24 | 2 | -2/+21 |
| | | | |||||
| * | | confirmation validation error attribute | Brian Cardarella | 2012-04-23 | 4 | -9/+14 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. | ||||
* | | | Generate appropriate error more judiciously | Marc-Andre Lafortune | 2012-04-29 | 1 | -0/+15 |
| |/ |/| | |||||
* | | Do not modify options hash in human_attribute_name, remove reverse_merge | Carlos Antonio da Silva | 2012-04-28 | 1 | -2/+8 |
| | | |||||
* | | Merge pull request #5841 from oscardelben/rename_count_observers | José Valim | 2012-04-24 | 1 | -1/+1 |
|\ \ | | | | | | | Rename Observing#count_observers to Observing#observers_count | ||||
| * | | Rename Observing#count_observers to Observing#observers_count | Oscar Del Ben | 2012-04-14 | 1 | -1/+1 |
| |/ | |||||
* / | Fix secure_password setter | Oscar Del Ben | 2012-04-24 | 1 | -0/+6 |
|/ | |||||
* | test against ruby features in order to fix tests on Ruby 2.0 | Aaron Patterson | 2012-03-26 | 1 | -1/+9 |
| | |||||
* | Merge pull request #5374 from ↵ | José Valim | 2012-03-23 | 1 | -24/+0 |
|\ | | | | | | | | | nertzy/remove_deprecated_partial_path_from_active_model_naming Remove ActiveModel::Naming#partial_path | ||||
| * | Remove ActiveModel::Naming#partial_path | Grant Hutchins | 2012-03-10 | 1 | -24/+0 |
| | | | | | | It was deprecated in 3.2 | ||||
* | | Revert "AM::MassAssingmentSecurity: improve performance" | José Valim | 2012-03-15 | 1 | -1/+1 |
| | | | | | | | | | | | | It introduces backwards incompatible changes in the API. This reverts commit 7d1379ffdbbaf01e99833dc06611b7e4f3799522. | ||||
* | | AM::MassAssingmentSecurity: improve performance | Bogdan Gusiev | 2012-03-14 | 1 | -1/+1 |
| | | |||||
* | | Fix comments about to_partial_path | Grant Hutchins | 2012-03-10 | 1 | -1/+1 |
|/ | |||||
* | Make sure serializable hash with :include always returns string keys | Carlos Antonio da Silva | 2012-03-09 | 1 | -13/+13 |
| | |||||
* | Add docs with usage examples for ActiveModel::Model | Carlos Antonio da Silva | 2012-03-03 | 1 | -0/+7 |
| | | | | | Also add test to ensure basic model does not explode when initialized with nil. | ||||
* | Add ActiveModel::Model, a mixin to make Ruby objects to work with AP inmediatly | Guillermo Iguaran | 2012-03-02 | 1 | -0/+19 |
| | |||||
* | AM::Errors: allow :full_messages parameter for #as_json | Bogdan Gusiev | 2012-02-20 | 1 | -0/+10 |
| | |||||
* | Fix sanitize_for_mass_assigment when role is nil | Fabio Yamate | 2012-02-15 | 1 | -0/+7 |
| | | | | | | | There is an example in Rails documentation that suggests implementing assign_attributes method for ActiveModel interface, that by default sends option role with nil. Since mass_assignment_authorizer never is called without args, we can move the default value internally. | ||||
* | Make sure serializable hash with :methods option returns always string keys | Carlos Antonio da Silva | 2012-02-13 | 1 | -3/+3 |
| | |||||
* | Cleanup extra spaces | Carlos Antonio da Silva | 2012-02-13 | 1 | -45/+44 |
| | |||||
* | test title changed corresponding to the test | prasath | 2012-02-09 | 1 | -1/+1 |
| | |||||
* | Merge pull request #4930 from ask4prasath/ordered_hash_replaced | Aaron Patterson | 2012-02-08 | 3 | -4/+4 |
|\ | | | | | Replacing ordered hash to ruby hash on active model | ||||
| * | replacing ordered hash to ruby hash | prasath | 2012-02-08 | 3 | -4/+4 |
| | | |||||
* | | Trim down Active Model API by removing valid? and errors.full_messages | José Valim | 2012-02-07 | 1 | -5/+1 |
|/ | |||||
* | To infinity… and beyond! | Niels Ganser | 2012-02-06 | 1 | -0/+18 |
| | | | | | | | Allow infinite values for validates_length_of. Particularly useful for prettily defining an open ended range such as validates_length_of :human_stupidity, :within => 0..Float::INFINITY | ||||
* | Generate strict validation error messages with attribute name | Carlos Antonio da Silva | 2012-02-01 | 1 | -3/+12 |
| | |||||
* | Removed unwanted intializer and replaced with ruby default collect method | prasath | 2012-01-27 | 1 | -2/+1 |
| |