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

Changeset 7235

Show
Ignore:
Timestamp:
07/25/07 02:50:35 (1 year ago)
Author:
rick
Message:

misc doc fixes + Add ActiveResource to Rails::Info. Closes #8741, #9008, #9089 [kampers]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activerecord/lib/active_record/validations.rb

    r7215 r7235  
    361361      # * <tt>allow_nil</tt> - Skip validation if attribute is nil. 
    362362      # * <tt>if</tt> - Specifies a method, proc or string to call to determine if the validation should 
    363       # occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }).  The 
    364       # method, proc or string should return or evaluate to a true or false value. 
    365       # * <tt>unless</tt> - Specifies a method, proc or string to call to determine if the validation should 
    366       # not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }).  The 
    367       # method, proc or string should return or evaluate to a true or false value.       
     363      #   occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }).  The 
     364      #   method, proc or string should return or evaluate to a true or false value. 
     365      # * <tt>unless</tt> - Specifies a method, proc or string to call to determine if the validation should 
     366      #   not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }).  The 
     367      #   method, proc or string should return or evaluate to a true or false value.       
    368368      def validates_each(*attrs) 
    369369        options = attrs.last.is_a?(Hash) ? attrs.pop.symbolize_keys : {} 
     
    403403      # * <tt>on</tt> - Specifies when this validation is active (default is :save, other options :create, :update) 
    404404      # * <tt>if</tt> - Specifies a method, proc or string to call to determine if the validation should 
    405       # occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }).  The 
    406       # method, proc or string should return or evaluate to a true or false value. 
    407       # * <tt>unless</tt> - Specifies a method, proc or string to call to determine if the validation should 
    408       # not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }).  The 
    409       # method, proc or string should return or evaluate to a true or false value.       
     405      #   occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }).  The 
     406      #   method, proc or string should return or evaluate to a true or false value. 
     407      # * <tt>unless</tt> - Specifies a method, proc or string to call to determine if the validation should 
     408      #   not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }).  The 
     409      #   method, proc or string should return or evaluate to a true or false value.       
    410410      def validates_confirmation_of(*attr_names) 
    411411        configuration = { :message => ActiveRecord::Errors.default_error_messages[:confirmation], :on => :save } 
     
    434434      # * <tt>allow_nil</tt> - Skip validation if attribute is nil. (default is true) 
    435435      # * <tt>accept</tt> - Specifies value that is considered accepted.  The default value is a string "1", which 
    436       # makes it easy to relate to an HTML checkbox. 
    437       # * <tt>if</tt> - Specifies a method, proc or string to call to determine if the validation should 
    438       # occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }).  The 
    439       # method, proc or string should return or evaluate to a true or false value. 
    440       # * <tt>unless</tt> - Specifies a method, proc or string to call to determine if the validation should 
    441       # not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }).  The 
    442       # method, proc or string should return or evaluate to a true or false value.       
     436      #   makes it easy to relate to an HTML checkbox. 
     437      # * <tt>if</tt> - Specifies a method, proc or string to call to determine if the validation should 
     438      #   occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }).  The 
     439      #   method, proc or string should return or evaluate to a true or false value. 
     440      # * <tt>unless</tt> - Specifies a method, proc or string to call to determine if the validation should 
     441      #   not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }).  The 
     442      #   method, proc or string should return or evaluate to a true or false value.       
    443443      def validates_acceptance_of(*attr_names) 
    444444        configuration = { :message => ActiveRecord::Errors.default_error_messages[:accepted], :on => :save, :allow_nil => true, :accept => "1" } 
     
    468468      # * <tt>on</tt> - Specifies when this validation is active (default is :save, other options :create, :update) 
    469469      # * <tt>if</tt> - Specifies a method, proc or string to call to determine if the validation should 
    470       # occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }).  The 
    471       # method, proc or string should return or evaluate to a true or false value. 
    472       # * <tt>unless</tt> - Specifies a method, proc or string to call to determine if the validation should 
    473       # not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }).  The 
    474       # method, proc or string should return or evaluate to a true or false value. 
     470      #   occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }).  The 
     471      #   method, proc or string should return or evaluate to a true or false value. 
     472      # * <tt>unless</tt> - Specifies a method, proc or string to call to determine if the validation should 
     473      #   not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }).  The 
     474      #   method, proc or string should return or evaluate to a true or false value. 
    475475      # 
    476476      # === Warning 
     
    525525      # * <tt>on</tt> - Specifies when this validation is active (default is :save, other options :create, :update) 
    526526      # * <tt>if</tt> - Specifies a method, proc or string to call to determine if the validation should 
    527       # occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }).  The 
    528       # method, proc or string should return or evaluate to a true or false value. 
    529       # * <tt>unless</tt> - Specifies a method, proc or string to call to determine if the validation should 
    530       # not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }).  The 
    531       # method, proc or string should return or evaluate to a true or false value.       
     527      #   occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }).  The 
     528      #   method, proc or string should return or evaluate to a true or false value. 
     529      # * <tt>unless</tt> - Specifies a method, proc or string to call to determine if the validation should 
     530      #   not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }).  The 
     531      #   method, proc or string should return or evaluate to a true or false value.       
    532532      def validates_length_of(*attrs) 
    533533        # Merge given options with defaults. 
     
    613613      # * <tt>allow_nil</tt> - If set to true, skips this validation if the attribute is null (default is: false) 
    614614      # * <tt>if</tt> - Specifies a method, proc or string to call to determine if the validation should 
    615       # occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }).  The 
    616       # method, proc or string should return or evaluate to a true or false value. 
    617       # * <tt>unless</tt> - Specifies a method, proc or string to call to determine if the validation should 
    618       # not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }).  The 
    619       # method, proc or string should return or evaluate to a true or false value. 
     615      #   occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }).  The 
     616      #   method, proc or string should return or evaluate to a true or false value. 
     617      # * <tt>unless</tt> - Specifies a method, proc or string to call to determine if the validation should 
     618      #   not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }).  The 
     619      #   method, proc or string should return or evaluate to a true or false value. 
    620620      def validates_uniqueness_of(*attr_names) 
    621621        configuration = { :message => ActiveRecord::Errors.default_error_messages[:taken], :case_sensitive => true } 
     
    664664      # * <tt>on</tt> Specifies when this validation is active (default is :save, other options :create, :update) 
    665665      # * <tt>if</tt> - Specifies a method, proc or string to call to determine if the validation should 
    666       # occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }).  The 
    667       # method, proc or string should return or evaluate to a true or false value. 
    668       # * <tt>unless</tt> - Specifies a method, proc or string to call to determine if the validation should 
    669       # not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }).  The 
    670       # method, proc or string should return or evaluate to a true or false value. 
     666      #   occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }).  The 
     667      #   method, proc or string should return or evaluate to a true or false value. 
     668      # * <tt>unless</tt> - Specifies a method, proc or string to call to determine if the validation should 
     669      #   not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }).  The 
     670      #   method, proc or string should return or evaluate to a true or false value. 
    671671      def validates_format_of(*attr_names) 
    672672        configuration = { :message => ActiveRecord::Errors.default_error_messages[:invalid], :on => :save, :with => nil } 
     
    692692      # * <tt>allow_nil</tt> - If set to true, skips this validation if the attribute is null (default is: false) 
    693693      # * <tt>if</tt> - Specifies a method, proc or string to call to determine if the validation should 
    694       # occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }).  The 
    695       # method, proc or string should return or evaluate to a true or false value. 
    696       # * <tt>unless</tt> - Specifies a method, proc or string to call to determine if the validation should 
    697       # not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }).  The 
    698       # method, proc or string should return or evaluate to a true or false value. 
     694      #   occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }).  The 
     695      #   method, proc or string should return or evaluate to a true or false value. 
     696      # * <tt>unless</tt> - Specifies a method, proc or string to call to determine if the validation should 
     697      #   not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }).  The 
     698      #   method, proc or string should return or evaluate to a true or false value. 
    699699      def validates_inclusion_of(*attr_names) 
    700700        configuration = { :message => ActiveRecord::Errors.default_error_messages[:inclusion], :on => :save } 
     
    722722      # * <tt>allow_nil</tt> - If set to true, skips this validation if the attribute is null (default is: false) 
    723723      # * <tt>if</tt> - Specifies a method, proc or string to call to determine if the validation should 
    724       # occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }).  The 
    725       # method, proc or string should return or evaluate to a true or false value. 
    726       # * <tt>unless</tt> - Specifies a method, proc or string to call to determine if the validation should 
    727       # not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }).  The 
    728       # method, proc or string should return or evaluate to a true or false value. 
     724      #   occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }).  The 
     725      #   method, proc or string should return or evaluate to a true or false value. 
     726      # * <tt>unless</tt> - Specifies a method, proc or string to call to determine if the validation should 
     727      #   not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }).  The 
     728      #   method, proc or string should return or evaluate to a true or false value. 
    729729      def validates_exclusion_of(*attr_names) 
    730730        configuration = { :message => ActiveRecord::Errors.default_error_messages[:exclusion], :on => :save } 
     
    765765      # * <tt>on</tt> Specifies when this validation is active (default is :save, other options :create, :update) 
    766766      # * <tt>if</tt> - Specifies a method, proc or string to call to determine if the validation should 
    767       # occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }).  The 
    768       # method, proc or string should return or evaluate to a true or false value. 
    769       # * <tt>unless</tt> - Specifies a method, proc or string to call to determine if the validation should 
    770       # not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }).  The 
    771       # method, proc or string should return or evaluate to a true or false value. 
     767      #   occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }).  The 
     768      #   method, proc or string should return or evaluate to a true or false value. 
     769      # * <tt>unless</tt> - Specifies a method, proc or string to call to determine if the validation should 
     770      #   not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }).  The 
     771      #   method, proc or string should return or evaluate to a true or false value. 
    772772      def validates_associated(*attr_names) 
    773773        configuration = { :message => ActiveRecord::Errors.default_error_messages[:invalid], :on => :save } 
     
    801801      # * <tt>even</tt> Specifies the value must be an even number 
    802802      # * <tt>if</tt> - Specifies a method, proc or string to call to determine if the validation should 
    803       # occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }).  The 
    804       # method, proc or string should return or evaluate to a true or false value. 
    805       # * <tt>unless</tt> - Specifies a method, proc or string to call to determine if the validation should 
    806       # not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }).  The 
    807       # method, proc or string should return or evaluate to a true or false value. 
     803      #   occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }).  The 
     804      #   method, proc or string should return or evaluate to a true or false value. 
     805      # * <tt>unless</tt> - Specifies a method, proc or string to call to determine if the validation should 
     806      #   not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }).  The 
     807      #   method, proc or string should return or evaluate to a true or false value. 
    808808      def validates_numericality_of(*attr_names) 
    809809        configuration = { :on => :save, :only_integer => false, :allow_nil => false } 
  • trunk/railties/builtin/rails_info/rails/info.rb

    r4134 r7235  
    2020 
    2121      def components 
    22         %w( active_record action_pack action_web_service action_mailer active_support ) 
     22        %w( active_record action_pack action_web_service active_resource action_mailer active_support ) 
    2323      end 
    2424       
     
    9090   
    9191    # Versions of each Rails component (Active Record, Action Pack,  
    92     # Action Web Service, Action Mailer, and Active Support). 
     92    # Action Web Service, Active Resource, Action Mailer, and Active Support). 
    9393    components.each do |component| 
    9494      property "#{component.titlecase} version" do  
  • trunk/railties/CHANGELOG

    r7233 r7235  
    11*SVN* 
     2 
     3* Add ActiveResource to Rails::Info.  Closes #8741 [kampers] 
    24 
    35* use Gem.find_name instead of search when freezing gems.  Prevent false positives for other gems with rails in the name. Closes #8729 [wselman] 
  • trunk/railties/doc/README_FOR_APP

    r7102 r7235  
    11Use this README file to introduce your application and point to useful places in the API for learning more. 
    2 Run "rake doc:app" to generate API documentation for your models and controllers. 
     2Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries. 
  • trunk/railties/test/rails_info_test.rb

    r4912 r7235  
    7171    assert_property 'Active Support version', ActiveSupport::VERSION::STRING 
    7272  end 
     73   
     74  def test_components_exist 
     75    Rails::Info.components.each do |component| 
     76      dir = File.dirname(__FILE__) + "/../../" + component.gsub('_', '') 
     77      assert File.directory?(dir), "#{component.classify} does not exist" 
     78    end 
     79  end 
    7380 
    7481protected