Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #8760: deprecate_arb_human_attribute_name.2.diff

File deprecate_arb_human_attribute_name.2.diff, 2.0 kB (added by kampers, 1 year ago)

updated for trunk

  • activerecord/lib/active_record/validations.rb

    old new  
    176176          if attr == "base" 
    177177            full_messages << msg 
    178178          else 
    179             full_messages << @base.class.human_attribute_name(attr) + " " + msg 
     179            full_messages << attr.humanize + " " + msg 
    180180          end 
    181181        end 
    182182      end 
  • activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb

    old new  
    9494      # ===== Examples 
    9595      #  Column.new('sales_stage', ...).human_name #=> 'Sales stage' 
    9696      def human_name 
    97         Base.human_attribute_name(@name) 
     97        @name.humanize 
    9898      end 
    9999 
    100100      def extract_default(default) 
  • activerecord/lib/active_record/base.rb

    old new  
    11341134 
    11351135      # Transforms attribute key names into a more humane format, such as "First name" instead of "first_name". Example: 
    11361136      #   Person.human_attribute_name("first_name") # => "First name" 
    1137       # Deprecated in favor of just calling "first_name".humanize 
     1137      # This is deprecated in favor of calling "first_name".humanize directly. 
    11381138      def human_attribute_name(attribute_key_name) #:nodoc: 
    11391139        attribute_key_name.humanize 
    11401140      end 
     1141      deprecate :human_attribute_name => 'use humanize inflector instead' 
    11411142 
    11421143      # True if this isn't a concrete subclass needing a STI type condition. 
    11431144      def descends_from_active_record?