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

Ticket #8760: deprecate_arb_human_attribute_name.diff

File deprecate_arb_human_attribute_name.diff, 2.0 kB (added by kampers, 2 years ago)
  • activerecord/lib/active_record/validations.rb

    old new  
    189189          if attr == "base" 
    190190            full_messages << msg 
    191191          else 
    192             full_messages << @base.class.human_attribute_name(attr) + " " + msg 
     192            full_messages << attr.humanize + " " + msg 
    193193          end 
    194194        end 
    195195      end 
  • activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb

    old new  
    8989      # ===== Examples 
    9090      #  Column.new('sales_stage', ...).human_name #=> 'Sales stage' 
    9191      def human_name 
    92         Base.human_attribute_name(@name) 
     92        @name.humanize 
    9393      end 
    9494 
    9595      # Used to convert from Strings to BLOBs 
  • activerecord/lib/active_record/base.rb

    old new  
    892892 
    893893      # Transforms attribute key names into a more humane format, such as "First name" instead of "first_name". Example: 
    894894      #   Person.human_attribute_name("first_name") # => "First name" 
    895       # Deprecated in favor of just calling "first_name".humanize 
     895      # This is deprecated in favor of calling "first_name".humanize directly. 
    896896      def human_attribute_name(attribute_key_name) #:nodoc: 
    897897        attribute_key_name.humanize 
    898898      end 
     899      deprecate :human_attribute_name => 'use humanize inflector instead' 
    899900 
    900901      # True if this isn't a concrete subclass needing a STI type condition. 
    901902      def descends_from_active_record?