From 8750c9a1cfb055fb45a798fee952953b6db829ad Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sun, 6 Nov 2011 18:58:55 +0530 Subject: fix markups for plus in AR guide --- .../guides/source/active_record_querying.textile | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/railties/guides/source/active_record_querying.textile b/railties/guides/source/active_record_querying.textile index a132d85ef9..8526d8511b 100644 --- a/railties/guides/source/active_record_querying.textile +++ b/railties/guides/source/active_record_querying.textile @@ -1287,19 +1287,19 @@ User.where(:id => 1).joins(:posts).explain may yield -+----+-------------+-------+-------+---------------+---------+---------+-------+------+-------------+ +------------------------------------------------------------------------------------------ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | -+----+-------------+-------+-------+---------------+---------+---------+-------+------+-------------+ +------------------------------------------------------------------------------------------ | 1 | SIMPLE | users | const | PRIMARY | PRIMARY | 4 | const | 1 | | | 1 | SIMPLE | posts | ALL | NULL | NULL | NULL | NULL | 1 | Using where | -+----+-------------+-------+-------+---------------+---------+---------+-------+------+-------------+ +------------------------------------------------------------------------------------------ 2 rows in set (0.00 sec) under MySQL. Active Record performs a pretty printing that emulates the one of the database -shells. So, the same query running with the PostreSQL adapter would yield instead +shells. So, the same query running with the PostgreSQL adapter would yield instead QUERY PLAN @@ -1324,17 +1324,17 @@ User.where(:id => 1).includes(:posts).explain yields -+----+-------------+-------+-------+---------------+---------+---------+-------+------+------- +------------------------------------------------------------------------------------ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | -+----+-------------+-------+-------+---------------+---------+---------+-------+------+------- +------------------------------------------------------------------------------------ | 1 | SIMPLE | users | const | PRIMARY | PRIMARY | 4 | const | 1 | | -+----+-------------+-------+-------+---------------+---------+---------+-------+------+------- +------------------------------------------------------------------------------------ 1 row in set (0.00 sec) -+----+-------------+-------+------+---------------+------+---------+------+------+------------- +------------------------------------------------------------------------------------- | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | -+----+-------------+-------+------+---------------+------+---------+------+------+------------- +------------------------------------------------------------------------------------- | 1 | SIMPLE | posts | ALL | NULL | NULL | NULL | NULL | 1 | Using where | -+----+-------------+-------+------+---------------+------+---------+------+------+------------- +------------------------------------------------------------------------------------- 1 row in set (0.00 sec) -- cgit v1.2.3 From 759906d51272534941843fc80ae9f579b28c336c Mon Sep 17 00:00:00 2001 From: Dalibor Nasevic Date: Sun, 6 Nov 2011 14:43:11 +0100 Subject: Fixed stale doc in AbstractController::Layouts --- actionpack/lib/abstract_controller/layouts.rb | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/actionpack/lib/abstract_controller/layouts.rb b/actionpack/lib/abstract_controller/layouts.rb index 10aa34c76b..bbf5efe565 100644 --- a/actionpack/lib/abstract_controller/layouts.rb +++ b/actionpack/lib/abstract_controller/layouts.rb @@ -213,7 +213,7 @@ module AbstractController # true:: raise an ArgumentError # # ==== Parameters - # * String, Symbol, false - The layout to use. + # * layout - The layout to use. # # ==== Options (conditions) # * :only - A list of actions to apply this layout to. @@ -310,14 +310,10 @@ module AbstractController # This will be overwritten by _write_layout_method def _layout; end - # Determine the layout for a given name and details, taking into account - # the name type. + # Determine the layout for a given name, taking into account the name type. # # ==== Parameters # * name - The name of the template - # * details - A list of details to restrict - # the lookup to. By default, layout lookup is limited to the - # formats specified for the current request. def _layout_for_option(name) case name when String then name @@ -330,15 +326,12 @@ module AbstractController end end - # Returns the default layout for this controller and a given set of details. + # Returns the default layout for this controller. # Optionally raises an exception if the layout could not be found. # # ==== Parameters - # * details - A list of details to restrict the search by. This - # might include details like the format or locale of the template. - # * require_layout - If this is true, raise an ArgumentError - # with details about the fact that the exception could not be - # found (defaults to false) + # * require_layout - If set to true and layout is not found, + # an ArgumentError exception is raised (defaults to false) # # ==== Returns # * template - The template object for the default layout (or nil) -- cgit v1.2.3 From 55b203dac1eb4b3430b313112b8d5a53b1016b4e Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Mon, 7 Nov 2011 11:56:50 +0900 Subject: self.up, self.down => up, down --- activerecord/README.rdoc | 4 ++-- activerecord/lib/active_record/base.rb | 4 ++-- .../active_record/connection_adapters/abstract/schema_definitions.rb | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/activerecord/README.rdoc b/activerecord/README.rdoc index b5db57569c..70922ef864 100644 --- a/activerecord/README.rdoc +++ b/activerecord/README.rdoc @@ -150,7 +150,7 @@ A short rundown of some of the major features: * Database agnostic schema management with Migrations. class AddSystemSettings < ActiveRecord::Migration - def self.up + def up create_table :system_settings do |t| t.string :name t.string :label @@ -162,7 +162,7 @@ A short rundown of some of the major features: SystemSetting.create :name => "notice", :label => "Use notice?", :value => 1 end - def self.down + def down drop_table :system_settings end end diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index feeebb7131..3558ae3545 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -760,7 +760,7 @@ module ActiveRecord #:nodoc: # values, eg: # # class CreateJobLevels < ActiveRecord::Migration - # def self.up + # def up # create_table :job_levels do |t| # t.integer :id # t.string :name @@ -774,7 +774,7 @@ module ActiveRecord #:nodoc: # end # end # - # def self.down + # def down # drop_table :job_levels # end # end diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb index 3f69f75565..6f135b56b5 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb @@ -46,13 +46,13 @@ module ActiveRecord # +change_table+ is actually of this type: # # class SomeMigration < ActiveRecord::Migration - # def self.up + # def up # create_table :foo do |t| # puts t.class # => "ActiveRecord::ConnectionAdapters::TableDefinition" # end # end # - # def self.down + # def down # ... # end # end @@ -479,4 +479,3 @@ module ActiveRecord end end - -- cgit v1.2.3 From aff9e68cb5996c95bc5c7304d996343ea2382d3b Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Mon, 7 Nov 2011 14:03:33 +0900 Subject: document fix: remove_column takes multiple column_names --- activerecord/lib/active_record/migration.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index 2fb1b8f7a3..d70c7d1d34 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -112,8 +112,8 @@ module ActiveRecord # a column but keeps the type and content. # * change_column(table_name, column_name, type, options): Changes # the column to a different type using the same parameters as add_column. - # * remove_column(table_name, column_name): Removes the column named - # +column_name+ from the table called +table_name+. + # * remove_column(table_name, column_names): Removes the column listed in + # +column_names+ from the table called +table_name+. # * add_index(table_name, column_names, options): Adds a new index # with the name of the column. Other options include # :name, :unique (e.g. -- cgit v1.2.3 From 979f3f894bf1034d4e9ee5ab9e285713f63c2824 Mon Sep 17 00:00:00 2001 From: Alexey Vakhov Date: Tue, 8 Nov 2011 18:01:19 +0400 Subject: Fix small typo in link_to_function doc --- actionpack/lib/action_view/helpers/javascript_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionpack/lib/action_view/helpers/javascript_helper.rb b/actionpack/lib/action_view/helpers/javascript_helper.rb index 1adcd716f8..842f4c23a3 100644 --- a/actionpack/lib/action_view/helpers/javascript_helper.rb +++ b/actionpack/lib/action_view/helpers/javascript_helper.rb @@ -94,7 +94,7 @@ module ActionView # If +html_options+ has an :onclick, that one is put before +function+. Once all # the JavaScript is set, the helper appends "; return false;". # - # The +href+ attribute of the tag is set to "#" unles +html_options+ has one. + # The +href+ attribute of the tag is set to "#" unless +html_options+ has one. # # link_to_function "Greeting", "alert('Hello world!')", :class => "nav_link" # # => Greeting -- cgit v1.2.3 From 1ffd5ec91069167043c8ecd0d949098f566d88eb Mon Sep 17 00:00:00 2001 From: Joost Baaij Date: Tue, 8 Nov 2011 16:27:15 +0100 Subject: Replace example with SQL placeholder syntax. This works just fine, is less code, and reduces the risk of someone implementing a SQL injection vulnerability. --- railties/guides/source/association_basics.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/railties/guides/source/association_basics.textile b/railties/guides/source/association_basics.textile index 6829eb8ef4..451653655f 100644 --- a/railties/guides/source/association_basics.textile +++ b/railties/guides/source/association_basics.textile @@ -1234,7 +1234,7 @@ If you need to evaluate conditions dynamically at runtime, use a proc: class Customer < ActiveRecord::Base has_many :latest_orders, :class_name => "Order", - :conditions => proc { "orders.created_at > #{10.hours.ago.to_s(:db).inspect}" } + :conditions => proc { ["orders.created_at > ?, 10.hours.ago] } end -- cgit v1.2.3