diff options
Diffstat (limited to 'railties/guides')
-rw-r--r-- | railties/guides/source/active_record_querying.textile | 3 | ||||
-rw-r--r-- | railties/guides/source/contributing_to_ruby_on_rails.textile | 2 | ||||
-rw-r--r-- | railties/guides/source/migrations.textile | 30 |
3 files changed, 34 insertions, 1 deletions
diff --git a/railties/guides/source/active_record_querying.textile b/railties/guides/source/active_record_querying.textile index 6ac5204ae5..3b4f2befda 100644 --- a/railties/guides/source/active_record_querying.textile +++ b/railties/guides/source/active_record_querying.textile @@ -1400,6 +1400,9 @@ A threshold of +nil+ disables automatic EXPLAINs. The default threshold in development mode is 0.5 seconds, and +nil+ in test and production modes. +INFO. Automatic EXPLAIN gets disabled if Active Record has no logger, regardless +of the value of the threshold. + h5. Disabling Automatic EXPLAIN Automatic EXPLAIN can be selectively silenced with +ActiveRecord::Base.silence_auto_explain+: diff --git a/railties/guides/source/contributing_to_ruby_on_rails.textile b/railties/guides/source/contributing_to_ruby_on_rails.textile index e082fd2941..aac5e13978 100644 --- a/railties/guides/source/contributing_to_ruby_on_rails.textile +++ b/railties/guides/source/contributing_to_ruby_on_rails.textile @@ -309,7 +309,7 @@ Rails follows a simple set of coding style conventions. * Two spaces, no tabs. * No trailing whitespace. Blank lines should not have any space. -* Indent after private/protected. +* Outdent private/protected from method definitions. Same indentation as the class/module. * Prefer +&&+/+||+ over +and+/+or+. * Prefer class << self block over self.method for class methods. * +MyClass.my_method(my_arg)+ not +my_method( my_arg )+ or +my_method my_arg+. diff --git a/railties/guides/source/migrations.textile b/railties/guides/source/migrations.textile index 66160f8b26..c11f8e221b 100644 --- a/railties/guides/source/migrations.textile +++ b/railties/guides/source/migrations.textile @@ -114,6 +114,7 @@ database independent way (you'll read about them in detail later): * +change_column+ * +change_table+ * +create_table+ +* +create_join_table+ * +drop_table+ * +remove_column+ * +remove_index+ @@ -384,6 +385,35 @@ end will append +ENGINE=BLACKHOLE+ to the SQL statement used to create the table (when using MySQL, the default is +ENGINE=InnoDB+). +h4. Creating a Join Table + +Migration method +create_join_table+ creates a HABTM join table. A typical use +would be + +<ruby> +create_join_table :products, :categories +</ruby> + +which creates a +categories_products+ table with two columns called +category_id+ and +product_id+. +These columns have the option +:null+ set to +false+ by default. + +You can pass the option +:table_name+ with you want to customize the table name. For example, + +<ruby> +create_join_table :products, :categories, :table_name => :categorization +</ruby> + +will create a +categorization+ table. + +By default, +create_join_table+ will create two columns with no options, but you can specify these +options using the +:column_options+ option. For example, + +<ruby> +create_join_table :products, :categories, :column_options => {:null => true} +</ruby> + +will create the +product_id+ and +category_id+ with the +:null+ option as +true+. + h4. Changing Tables A close cousin of +create_table+ is +change_table+, used for changing existing |