diff options
author | Paul Gallagher <gallagher.paul@gmail.com> | 2011-06-19 10:21:15 +0800 |
---|---|---|
committer | Paul Gallagher <gallagher.paul@gmail.com> | 2011-06-19 10:21:15 +0800 |
commit | 2b3d67fdaf2c78a5447316a90c54c7c9c520c71a (patch) | |
tree | 19cf0443c671ddf015c12b85e7022a2bd428b9ba /activemodel/lib/active_model | |
parent | b0d59907f733841280095b16c98a95574b3a0938 (diff) | |
parent | 6c705e33ef78d28d5d964a03edc627f31d7f8c25 (diff) | |
download | rails-2b3d67fdaf2c78a5447316a90c54c7c9c520c71a.tar.gz rails-2b3d67fdaf2c78a5447316a90c54c7c9c520c71a.tar.bz2 rails-2b3d67fdaf2c78a5447316a90c54c7c9c520c71a.zip |
Merge remote branch 'rails/master' into pg_schema_fu
Diffstat (limited to 'activemodel/lib/active_model')
-rw-r--r-- | activemodel/lib/active_model/mass_assignment_security/sanitizer.rb | 2 | ||||
-rw-r--r-- | activemodel/lib/active_model/naming.rb | 7 | ||||
-rw-r--r-- | activemodel/lib/active_model/translation.rb | 5 |
3 files changed, 6 insertions, 8 deletions
diff --git a/activemodel/lib/active_model/mass_assignment_security/sanitizer.rb b/activemodel/lib/active_model/mass_assignment_security/sanitizer.rb index ee43a6694f..bb0526adc3 100644 --- a/activemodel/lib/active_model/mass_assignment_security/sanitizer.rb +++ b/activemodel/lib/active_model/mass_assignment_security/sanitizer.rb @@ -19,7 +19,7 @@ module ActiveModel removed_keys = attributes.keys - sanitized_attributes.keys process_removed_attributes(removed_keys) if removed_keys.any? end - + def process_removed_attributes(attrs) raise NotImplementedError, "#process_removed_attributes(attrs) suppose to be overwritten" end diff --git a/activemodel/lib/active_model/naming.rb b/activemodel/lib/active_model/naming.rb index c7b9c41f46..4c1a82f413 100644 --- a/activemodel/lib/active_model/naming.rb +++ b/activemodel/lib/active_model/naming.rb @@ -21,7 +21,7 @@ module ActiveModel @partial_path = "#{@collection}/#{@element}".freeze @param_key = (namespace ? _singularize(@unnamespaced) : @singular).freeze @route_key = (namespace ? ActiveSupport::Inflector.pluralize(@param_key) : @plural).freeze - @i18n_key = self.underscore.tr('/', '.').to_sym + @i18n_key = self.underscore.to_sym end # Transform the model name into a more humane format, using I18n. By default, @@ -35,9 +35,8 @@ module ActiveModel @klass.respond_to?(:i18n_scope) defaults = @klass.lookup_ancestors.map do |klass| - [klass.model_name.i18n_key, - klass.model_name.i18n_key.to_s.tr('.', '/').to_sym] - end.flatten + klass.model_name.i18n_key + end defaults << options[:default] if options[:default] defaults << @human diff --git a/activemodel/lib/active_model/translation.rb b/activemodel/lib/active_model/translation.rb index c615311692..6d64c81b5f 100644 --- a/activemodel/lib/active_model/translation.rb +++ b/activemodel/lib/active_model/translation.rb @@ -44,9 +44,8 @@ module ActiveModel # Specify +options+ with additional translating options. def human_attribute_name(attribute, options = {}) defaults = lookup_ancestors.map do |klass| - [:"#{self.i18n_scope}.attributes.#{klass.model_name.i18n_key}.#{attribute}", - :"#{self.i18n_scope}.attributes.#{klass.model_name.i18n_key.to_s.tr('.', '/')}.#{attribute}"] - end.flatten + :"#{self.i18n_scope}.attributes.#{klass.model_name.i18n_key}.#{attribute}" + end defaults << :"attributes.#{attribute}" defaults << options.delete(:default) if options[:default] |