diff options
Diffstat (limited to 'guides/source/4_0_release_notes.textile')
-rw-r--r-- | guides/source/4_0_release_notes.textile | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/guides/source/4_0_release_notes.textile b/guides/source/4_0_release_notes.textile index e1d6b42e6c..d430dca164 100644 --- a/guides/source/4_0_release_notes.textile +++ b/guides/source/4_0_release_notes.textile @@ -329,6 +329,20 @@ Moved into a separate gem <tt>sprockets-rails</tt>. h3. Active Record +* Add <tt>add_reference</tt> and <tt>remove_reference</tt> schema statements. Aliases, <tt>add_belongs_to</tt> and <tt>remove_belongs_to</tt> are acceptable. References are reversible. + +<ruby> +# Create a user_id column +add_reference(:products, :user) + +# Create a supplier_id, supplier_type columns and appropriate index +add_reference(:products, :supplier, polymorphic: true, index: true) + +# Remove polymorphic reference +remove_reference(:products, :supplier, polymorphic: true) +</ruby> + + * Add <tt>:default</tt> and <tt>:null</tt> options to <tt>column_exists?</tt>. <ruby> @@ -343,7 +357,7 @@ User.where(:age => 30) # => returns the relation User.where(:age => 30).to_a # => executes the query and returns the loaded objects, as before </ruby> -* Add <tt>collation</tt> and <tt>ctype</tt> support to PostgreSQL. These are available for PostgreSQL 8.4 or later. +* Add <tt>:collation</tt> and <tt>:ctype</tt> support to PostgreSQL. These are available for PostgreSQL 8.4 or later. <yaml> development: |