diff --git a/railties/guides/rails_guides/generator.rb b/railties/guides/rails_guides/generator.rb index 5a5ce54503ef2..eaa9d79ce8adf 100644 --- a/railties/guides/rails_guides/generator.rb +++ b/railties/guides/rails_guides/generator.rb @@ -237,8 +237,9 @@ def extract_anchors(html) end end - # Also, footnotes are rendered as paragraphs this way. + # Footnotes. anchors += Set.new(html.scan(/ -"ActiveRecord::Base".constantize # => ActiveRecord::Base - - -The name is assumed to be top-level, no matter whether it starts with "::" or not. No lexical context is taken into account: - - -C = 1 -module M - C = 2 - "C".constantize # => 1, same as "::C".constantize -end - - -NOTE: Defined in +active_support/core_ext/string/conversions.rb+. +h4(#string-conversions). Conversions h5. +ord+ @@ -2041,7 +2021,7 @@ This method receives an arbitrary number of action names, and an optional hash o NOTE: Defined in +active_support/core_ext/array/extract_options.rb+. -h4. Conversions +h4(#array-conversions). Conversions h5. +to_sentence+ @@ -2985,7 +2965,7 @@ Date.new(2010, 1, 31).change(:month => 2) # => ArgumentError: invalid date -h5. Durations +h5(#date-durations). Durations Durations can be added and substracted to dates: @@ -3191,7 +3171,7 @@ DateTime.current.change(:month => 2, :day => 30) # => ArgumentError: invalid date -h5. Durations +h5(#datetime-durations). Durations Durations can be added and substracted to datetimes: @@ -3304,7 +3284,7 @@ Both +local_time+ and +utc_time+ accept up to seven positional arguments: year, If the time to be constructed lies beyond the range supported by +Time+ in the runtime platform, usecs are discarded and a +DateTime+ object is returned instead. -h5. Durations +h5(#time-durations). Durations Durations can be added and substracted to time objects: diff --git a/railties/guides/source/association_basics.textile b/railties/guides/source/association_basics.textile index 17742a8d8c14f..dbef9463a989c 100644 --- a/railties/guides/source/association_basics.textile +++ b/railties/guides/source/association_basics.textile @@ -550,7 +550,7 @@ build_customer create_customer -h6. association(force_reload = false) +h6. _association_(force_reload = false) The association method returns the associated object, if any. If no associated object is found, it returns +nil+. @@ -560,7 +560,7 @@ The association method returns the associated object, if any. If the associated object has already been retrieved from the database for this object, the cached version will be returned. To override this behavior (and force a database read), pass +true+ as the +force_reload+ argument. -h6. _association_=(associate) +h6. _association_=(associate) The association= method assigns an associated object to this object. Behind the scenes, this means extracting the primary key from the associate object and setting this object's foreign key to the same value. @@ -568,7 +568,7 @@ The association= method assigns an associated object to this o @order.customer = @customer -h6. build_association(attributes = {}) +h6(#belongs_to-build_association). build_association(attributes = {}) The build_association method returns a new object of the associated type. This object will be instantiated from the passed attributes, and the link through this object's foreign key will be set, but the associated object will _not_ yet be saved. @@ -577,7 +577,7 @@ The build_association method returns a new object of the assoc :customer_name => "John Doe") -h6. create_association(attributes = {}) +h6(#belongs_to-create_association). create_association(attributes = {}) The create_association method returns a new object of the associated type. This object will be instantiated from the passed attributes, and the link through this object's foreign key will be set. In addition, the associated object _will_ be saved (assuming that it passes any validations). @@ -835,7 +835,7 @@ The association= method assigns an associated object to this o @supplier.account = @account -h6. build_association(attributes = {}) +h6(#has_one-build_association). build_association(attributes = {}) The build_association method returns a new object of the associated type. This object will be instantiated from the passed attributes, and the link through its foreign key will be set, but the associated object will _not_ yet be saved. @@ -843,7 +843,7 @@ The build_association method returns a new object of the assoc @account = @supplier.build_account(:terms => "Net 30") -h6. create_association(attributes = {}) +h6(#has_one-create_association). create_association(attributes = {}) The create_association method returns a new object of the associated type. This object will be instantiated from the passed attributes, and the link through its foreign key will be set. In addition, the associated object _will_ be saved (assuming that it passes any validations). @@ -985,7 +985,7 @@ The +:source_type+ option specifies the source association type for a +has_one : h6(#has_one-through). +:through+ -The +:through+ option specifies a join model through which to perform the query. +has_one :through+ associations were discussed in detail earlier in this guide. +The +:through+ option specifies a join model through which to perform the query. +has_one :through+ associations were discussed in detail earlier in this guide. h6(#has_one-validate). +:validate+ @@ -1136,7 +1136,7 @@ h6. collection.exists?(...) The collection.exists? method checks whether an object meeting the supplied conditions exists in the collection. It uses the same syntax and options as +ActiveRecord::Base.exists?+. -h6. collection.build(attributes = {}, ...) +h6(#has_many_collection_build). collection.build(attributes = {}, ...) The collection.build method returns one or more new objects of the associated type. These objects will be instantiated from the passed attributes, and the link through their foreign key will be created, but the associated objects will _not_ yet be saved. @@ -1367,7 +1367,7 @@ The +:source_type+ option specifies the source association type for a +has_many h6(#has_many-through). +:through+ -The +:through+ option specifies a join model through which to perform the query. +has_many :through+ associations provide a way to implement many-to-many relationships, as discussed earlier in this guide. +The +:through+ option specifies a join model through which to perform the query. +has_many :through+ associations provide a way to implement many-to-many relationships, as discussed earlier in this guide. h6(#has_many-uniq). +:uniq+ @@ -1553,7 +1553,7 @@ h6(#has_and_belongs_to_many-collection-exists). collection.exists?( The collection.exists? method checks whether an object meeting the supplied conditions exists in the collection. It uses the same syntax and options as +ActiveRecord::Base.exists?+. -h6. collection.build(attributes = {}) +h6(#has_and_belongs_to_many-collection-build). collection.build(attributes = {}) The collection.build method returns a new object of the associated type. This object will be instantiated from the passed attributes, and the link through the join table will be created, but the associated object will _not_ yet be saved.