From 8fc54a2e814b5c85ccfd798285a366347fd6a4e9 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 25 Feb 2011 14:17:57 -0800 Subject: only take the limit if there is a limit to take --- activerecord/lib/active_record/relation.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 3c7533ea48..b828cffa77 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -190,7 +190,7 @@ module ActiveRecord end stmt = arel.compile_update(Arel.sql(@klass.send(:sanitize_sql_for_assignment, updates))) - stmt.take limit + stmt.take limit if limit stmt.order(*order) stmt.key = table[primary_key] @klass.connection.update stmt.to_sql -- cgit v1.2.3 From 54a2bf66019d2694ff53f666765faf5bca927c09 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 25 Feb 2011 15:38:59 -0800 Subject: removing limits and offsets from COUNT queries unless both are specified. [#6268 state:resolved] --- activerecord/CHANGELOG | 9 +++++++ .../lib/active_record/relation/calculations.rb | 14 ++++++++++- activerecord/lib/active_record/test_case.rb | 1 + activerecord/test/cases/calculations_test.rb | 28 ++++++++++++++++++++++ 4 files changed, 51 insertions(+), 1 deletion(-) diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index 1f343f690c..92848c8a7d 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,14 @@ *Rails 3.1.0 (unreleased)* +* limits and offsets are removed from COUNT queries unless both are supplied. + For example: + + People.limit(1).count # => 'SELECT COUNT(*) FROM people' + People.offset(1).count # => 'SELECT COUNT(*) FROM people' + People.limit(1).offset(1).count # => 'SELECT COUNT(*) FROM people LIMIT 1 OFFSET 1' + + [lighthouse #6262] + * ActiveRecord::Associations::AssociationProxy has been split. There is now an Association class (and subclasses) which are responsible for operating on associations, and then a separate, thin wrapper called CollectionProxy, which proxies collection associations. diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index abc4c54109..c1842b1a96 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -204,7 +204,19 @@ module ActiveRecord relation.select_values = [select_value] - type_cast_calculated_value(@klass.connection.select_value(relation.to_sql), column_for(column_name), operation) + query_builder = relation.arel + + if operation == "count" + limit = relation.limit_value + offset = relation.offset_value + + unless limit && offset + query_builder.limit = nil + query_builder.offset = nil + end + end + + type_cast_calculated_value(@klass.connection.select_value(query_builder.to_sql), column_for(column_name), operation) end def execute_grouped_calculation(operation, column_name, distinct) #:nodoc: diff --git a/activerecord/lib/active_record/test_case.rb b/activerecord/lib/active_record/test_case.rb index 4e711c4884..29efbbcb8c 100644 --- a/activerecord/lib/active_record/test_case.rb +++ b/activerecord/lib/active_record/test_case.rb @@ -26,6 +26,7 @@ module ActiveRecord def assert_sql(*patterns_to_match) $queries_executed = [] yield + $queries_executed ensure failed_patterns = [] patterns_to_match.each do |pattern| diff --git a/activerecord/test/cases/calculations_test.rb b/activerecord/test/cases/calculations_test.rb index 3121f1615d..991b1ab181 100644 --- a/activerecord/test/cases/calculations_test.rb +++ b/activerecord/test/cases/calculations_test.rb @@ -109,6 +109,34 @@ class CalculationsTest < ActiveRecord::TestCase assert_equal [2, 6], c.keys.compact end + def test_limit_with_offset_is_kept + queries = assert_sql { Account.limit(1).offset(1).count } + assert_equal 1, queries.length + assert_match(/LIMIT/, queries.first) + assert_match(/OFFSET/, queries.first) + end + + def test_offset_without_limit_removes_offset + queries = assert_sql { Account.offset(1).count } + assert_equal 1, queries.length + assert_no_match(/LIMIT/, queries.first) + assert_no_match(/OFFSET/, queries.first) + end + + def test_limit_without_offset_removes_limit + queries = assert_sql { Account.limit(1).count } + assert_equal 1, queries.length + assert_no_match(/LIMIT/, queries.first) + assert_no_match(/OFFSET/, queries.first) + end + + def test_no_limit_no_offset + queries = assert_sql { Account.count } + assert_equal 1, queries.length + assert_no_match(/LIMIT/, queries.first) + assert_no_match(/OFFSET/, queries.first) + end + def test_should_group_by_summed_field_having_condition c = Account.sum(:credit_limit, :group => :firm_id, :having => 'sum(credit_limit) > 50') -- cgit v1.2.3 From f3e9cbc6955af8f430e75cf5d61e5940f7f46591 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Sat, 26 Feb 2011 16:05:15 -0800 Subject: use an attribute rather than a SQL literal --- activerecord/lib/active_record/relation/query_methods.rb | 2 +- activerecord/test/cases/base_test.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index f76681e880..4330d850fe 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -284,7 +284,7 @@ module ActiveRecord @implicit_readonly = false arel.project(*selects) else - arel.project(Arel.sql(@klass.quoted_table_name + '.*')) + arel.project(@klass.arel_table[Arel.star]) end end diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index 0ad20bb9bc..b62b5003e4 100644 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -134,6 +134,7 @@ class BasicsTest < ActiveRecord::TestCase fakepool = Class.new(Struct.new(:spec)) { def with_connection; yield self; end def connection_pool; self; end + def table_exists?(name); false; end def quote_table_name(*args); raise "lol quote_table_name"; end } -- cgit v1.2.3 From 86ad8a6c877636b4df7966233dff7fea377b0790 Mon Sep 17 00:00:00 2001 From: Jeff Kreeftmeijer Date: Mon, 14 Feb 2011 19:38:12 +0100 Subject: Make sure the Thor generator LoadError does not output --dev twice [#6431 state:resolved] Signed-off-by: Santiago Pastorino --- railties/lib/rails/generators/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/railties/lib/rails/generators/base.rb b/railties/lib/rails/generators/base.rb index 131eb6ff6f..dfecd2a6e4 100644 --- a/railties/lib/rails/generators/base.rb +++ b/railties/lib/rails/generators/base.rb @@ -3,7 +3,7 @@ begin rescue LoadError puts "Thor is not available.\nIf you ran this command from a git checkout " \ "of Rails, please make sure thor is installed,\nand run this command " \ - "as `ruby #{$0} #{ARGV.join(" ")} --dev`" + "as `ruby #{$0} #{(ARGV | ['--dev']).join(" ")}`" exit end -- cgit v1.2.3 From acf0688fdd85a6d6ac278446e81f365239acc198 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sun, 27 Feb 2011 21:14:11 -0200 Subject: failing test for i18n key collision with namespaced models --- activemodel/test/cases/translation_test.rb | 7 +++++++ activemodel/test/models/person.rb | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/activemodel/test/cases/translation_test.rb b/activemodel/test/cases/translation_test.rb index c299d6eb5e..1b1d972d5c 100644 --- a/activemodel/test/cases/translation_test.rb +++ b/activemodel/test/cases/translation_test.rb @@ -49,6 +49,13 @@ class ActiveModelI18nTests < ActiveModel::TestCase assert_equal 'person name attribute', Child.human_attribute_name('name') end + def test_translated_model_attributes_with_attribute_matching_namespaced_model_name + I18n.backend.store_translations 'en', :activemodel => {:attributes => {:person => {:gender => 'person gender'}, :"person/gender" => {:attribute => 'person gender attribute'}}} + + assert_equal 'person gender', Person.human_attribute_name('gender') + assert_equal 'person gender attribute', Person::Gender.human_attribute_name('attribute') + end + def test_translated_model_names I18n.backend.store_translations 'en', :activemodel => {:models => {:person => 'person model'} } assert_equal 'person model', Person.model_name.human diff --git a/activemodel/test/models/person.rb b/activemodel/test/models/person.rb index eb84f7a27d..7b7e8feebc 100644 --- a/activemodel/test/models/person.rb +++ b/activemodel/test/models/person.rb @@ -9,6 +9,10 @@ class Person end end +class Person::Gender + extend ActiveModel::Translation +end + class Child < Person end -- cgit v1.2.3 From a00bed0c48f469d1cd2de364bfaddbc724046195 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sun, 27 Feb 2011 21:23:59 -0200 Subject: Revert "Properly interpolate i18n keys in modules [#5572 state:resolved]" This breaks #6448, you should use :"module/class" as key for namespacing [#6448 state:committed] This reverts commit 8d30193b08bd2321a7a78a1f481bd5e4d4d45557. --- activemodel/lib/active_model/errors.rb | 4 ++-- activemodel/lib/active_model/naming.rb | 15 +++++---------- activemodel/lib/active_model/translation.rb | 2 +- .../test/cases/validations/i18n_validation_test.rb | 19 ------------------- activemodel/test/models/person.rb | 5 ----- 5 files changed, 8 insertions(+), 37 deletions(-) diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb index 5e3cf510b0..c2f0228785 100644 --- a/activemodel/lib/active_model/errors.rb +++ b/activemodel/lib/active_model/errors.rb @@ -295,8 +295,8 @@ module ActiveModel type = options.delete(:message) if options[:message].is_a?(Symbol) defaults = @base.class.lookup_ancestors.map do |klass| - [ :"#{@base.class.i18n_scope}.errors.models.#{klass.model_name.i18n_key}.attributes.#{attribute}.#{type}", - :"#{@base.class.i18n_scope}.errors.models.#{klass.model_name.i18n_key}.#{type}" ] + [ :"#{@base.class.i18n_scope}.errors.models.#{klass.model_name.underscore}.attributes.#{attribute}.#{type}", + :"#{@base.class.i18n_scope}.errors.models.#{klass.model_name.underscore}.#{type}" ] end defaults << options.delete(:message) diff --git a/activemodel/lib/active_model/naming.rb b/activemodel/lib/active_model/naming.rb index 3f430f94a6..eb9b847509 100644 --- a/activemodel/lib/active_model/naming.rb +++ b/activemodel/lib/active_model/naming.rb @@ -4,7 +4,7 @@ require 'active_support/core_ext/module/introspection' module ActiveModel class Name < String - attr_reader :singular, :plural, :element, :collection, :partial_path, :route_key, :param_key, :i18n_key + attr_reader :singular, :plural, :element, :collection, :partial_path, :route_key, :param_key alias_method :cache_key, :collection def initialize(klass, namespace = nil) @@ -20,7 +20,6 @@ module ActiveModel @partial_path = "#{@collection}/#{@element}".freeze @param_key = (namespace ? _singularize(@unnamespaced) : @singular).freeze @route_key = (namespace ? ActiveSupport::Inflector.pluralize(@param_key) : @plural).freeze - @i18n_key = _singularize(self, '.').to_sym end # Transform the model name into a more humane format, using I18n. By default, @@ -34,7 +33,7 @@ module ActiveModel @klass.respond_to?(:i18n_scope) defaults = @klass.lookup_ancestors.map do |klass| - klass.model_name.i18n_key + klass.model_name.underscore.to_sym end defaults << options[:default] if options[:default] @@ -45,10 +44,9 @@ module ActiveModel end private - - def _singularize(string, replacement='_') - ActiveSupport::Inflector.underscore(string).tr('/', replacement) - end + def _singularize(str) + ActiveSupport::Inflector.underscore(str).tr('/', '_') + end end # == Active Model Naming @@ -64,9 +62,6 @@ module ActiveModel # BookCover.model_name # => "BookCover" # BookCover.model_name.human # => "Book cover" # - # BookCover.model_name.i18n_key # => "book_cover" - # BookModule::BookCover.model_name.i18n_key # => "book_module.book_cover" - # # Providing the functionality that ActiveModel::Naming provides in your object # is required to pass the Active Model Lint test. So either extending the provided # method below, or rolling your own is required. diff --git a/activemodel/lib/active_model/translation.rb b/activemodel/lib/active_model/translation.rb index 920a133159..dbb76244e4 100644 --- a/activemodel/lib/active_model/translation.rb +++ b/activemodel/lib/active_model/translation.rb @@ -44,7 +44,7 @@ module ActiveModel # Specify +options+ with additional translating options. def human_attribute_name(attribute, options = {}) defaults = lookup_ancestors.map do |klass| - :"#{self.i18n_scope}.attributes.#{klass.model_name.i18n_key}.#{attribute}" + :"#{self.i18n_scope}.attributes.#{klass.model_name.underscore}.#{attribute}" end defaults << :"attributes.#{attribute}" diff --git a/activemodel/test/cases/validations/i18n_validation_test.rb b/activemodel/test/cases/validations/i18n_validation_test.rb index 5cb7bff4e7..e9f0e430fe 100644 --- a/activemodel/test/cases/validations/i18n_validation_test.rb +++ b/activemodel/test/cases/validations/i18n_validation_test.rb @@ -55,14 +55,6 @@ class I18nValidationTest < ActiveModel::TestCase assert_equal ["Person's name not found"], @person.errors.full_messages end - def test_errors_full_messages_translates_human_attribute_name_for_model_in_module_attributes - I18n.backend.store_translations('en', :activemodel => {:attributes => {:person_module => {:person => {:name => "Person in Module's name"}}}}) - person = PersonModule::Person.new - person.errors.add(:name, 'not found') - PersonModule::Person.expects(:human_attribute_name).with(:name, :default => 'Name').returns("Person in Module's name") - assert_equal ["Person in Module's name not found"], person.errors.full_messages - end - def test_errors_full_messages_uses_format I18n.backend.store_translations('en', :errors => {:format => "Field %{attribute} %{message}"}) @person.errors.add('name', 'empty') @@ -371,15 +363,4 @@ class I18nValidationTest < ActiveModel::TestCase assert_equal ["I am a custom error"], @person.errors[:title] end - def test_model_with_module_i18n_scope - I18n.backend.store_translations 'en', :activemodel => {:errors => {:models => {:person_module => {:person => {:blank => 'generic blank'}}}}} - PersonModule::Person.validates_presence_of :title - person = PersonModule::Person.new - person.valid? - assert_equal ['generic blank'], person.errors[:title] - - I18n.backend.store_translations 'en', :activemodel => {:errors => {:models => {:person_module => {:person => {:attributes => {:title => {:blank => 'title cannot be blank'}}}}}}} - person.valid? - assert_equal ['title cannot be blank'], person.errors[:title] - end end diff --git a/activemodel/test/models/person.rb b/activemodel/test/models/person.rb index 7b7e8feebc..e896e90f98 100644 --- a/activemodel/test/models/person.rb +++ b/activemodel/test/models/person.rb @@ -15,8 +15,3 @@ end class Child < Person end - -module PersonModule - class Person < ::Person - end -end -- cgit v1.2.3 From 801e314006ca755b94eccc6e7f80b1655168a250 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Mon, 28 Feb 2011 11:30:12 -0200 Subject: Add tests for register expansion methods with key = [] --- actionpack/test/template/asset_tag_helper_test.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/actionpack/test/template/asset_tag_helper_test.rb b/actionpack/test/template/asset_tag_helper_test.rb index a1a6b5f1d0..f3f628f31b 100644 --- a/actionpack/test/template/asset_tag_helper_test.rb +++ b/actionpack/test/template/asset_tag_helper_test.rb @@ -302,11 +302,16 @@ class AssetTagHelperTest < ActionView::TestCase assert_dom_equal %(\n), javascript_include_tag(:can_merge) end - def test_custom_javascript_expansions_with_undefined_symbol + def test_custom_javascript_expansions_with_nil_value ActionView::Helpers::AssetTagHelper::register_javascript_expansion :monkey => nil assert_raise(ArgumentError) { javascript_include_tag('first', :monkey, 'last') } end + def test_custom_javascript_expansions_with_empty_array_value + ActionView::Helpers::AssetTagHelper::register_javascript_expansion :monkey => [] + assert_dom_equal %(\n), javascript_include_tag('first', :monkey, 'last') + end + def test_custom_javascript_and_stylesheet_expansion_with_same_name ENV["RAILS_ASSET_ID"] = "" ActionView::Helpers::AssetTagHelper::register_javascript_expansion :robbery => ["bank", "robber"] @@ -379,11 +384,16 @@ class AssetTagHelperTest < ActionView::TestCase assert_dom_equal %(\n\n), stylesheet_link_tag('london', :cities) end - def test_custom_stylesheet_expansions_with_undefined_symbol + def test_custom_stylesheet_expansions_with_nil_value ActionView::Helpers::AssetTagHelper::register_stylesheet_expansion :monkey => nil assert_raise(ArgumentError) { stylesheet_link_tag('first', :monkey, 'last') } end + def test_custom_stylesheet_expansions_with_empty_array_value + ActionView::Helpers::AssetTagHelper::register_stylesheet_expansion :monkey => [] + assert_dom_equal %(\n), stylesheet_link_tag('first', :monkey, 'last') + end + def test_registering_stylesheet_expansions_merges_with_existing_expansions ENV["RAILS_ASSET_ID"] = "" ActionView::Helpers::AssetTagHelper::register_stylesheet_expansion :can_merge => ['bank'] -- cgit v1.2.3 From 53b17e9ad08ada8709f6610d33d1bf624e5ef2d0 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Mon, 28 Feb 2011 11:52:00 -0200 Subject: javascript_include_tag shouldn't raise if you register an expansion key with nil value --- .../helpers/asset_tag_helpers/javascript_tag_helpers.rb | 2 +- .../helpers/asset_tag_helpers/stylesheet_tag_helpers.rb | 2 +- actionpack/test/template/asset_tag_helper_test.rb | 12 ++++++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/actionpack/lib/action_view/helpers/asset_tag_helpers/javascript_tag_helpers.rb b/actionpack/lib/action_view/helpers/asset_tag_helpers/javascript_tag_helpers.rb index b9126af944..82bbfcc7d2 100644 --- a/actionpack/lib/action_view/helpers/asset_tag_helpers/javascript_tag_helpers.rb +++ b/actionpack/lib/action_view/helpers/asset_tag_helpers/javascript_tag_helpers.rb @@ -69,7 +69,7 @@ module ActionView def register_javascript_expansion(expansions) js_expansions = JavascriptIncludeTag.expansions expansions.each do |key, values| - js_expansions[key] = (js_expansions[key] || []) | Array(values) if values + js_expansions[key] = (js_expansions[key] || []) | Array(values) end end end diff --git a/actionpack/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb b/actionpack/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb index f3e041de95..a48c87b49a 100644 --- a/actionpack/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb +++ b/actionpack/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb @@ -46,7 +46,7 @@ module ActionView def register_stylesheet_expansion(expansions) style_expansions = StylesheetIncludeTag.expansions expansions.each do |key, values| - style_expansions[key] = (style_expansions[key] || []) | Array(values) if values + style_expansions[key] = (style_expansions[key] || []) | Array(values) end end end diff --git a/actionpack/test/template/asset_tag_helper_test.rb b/actionpack/test/template/asset_tag_helper_test.rb index f3f628f31b..1bf748af14 100644 --- a/actionpack/test/template/asset_tag_helper_test.rb +++ b/actionpack/test/template/asset_tag_helper_test.rb @@ -302,9 +302,13 @@ class AssetTagHelperTest < ActionView::TestCase assert_dom_equal %(\n), javascript_include_tag(:can_merge) end + def test_custom_javascript_expansions_with_undefined_symbol + assert_raise(ArgumentError) { javascript_include_tag('first', :unknown, 'last') } + end + def test_custom_javascript_expansions_with_nil_value ActionView::Helpers::AssetTagHelper::register_javascript_expansion :monkey => nil - assert_raise(ArgumentError) { javascript_include_tag('first', :monkey, 'last') } + assert_dom_equal %(\n), javascript_include_tag('first', :monkey, 'last') end def test_custom_javascript_expansions_with_empty_array_value @@ -384,9 +388,13 @@ class AssetTagHelperTest < ActionView::TestCase assert_dom_equal %(\n\n), stylesheet_link_tag('london', :cities) end + def test_custom_stylesheet_expansions_with_unknown_symbol + assert_raise(ArgumentError) { stylesheet_link_tag('first', :unknown, 'last') } + end + def test_custom_stylesheet_expansions_with_nil_value ActionView::Helpers::AssetTagHelper::register_stylesheet_expansion :monkey => nil - assert_raise(ArgumentError) { stylesheet_link_tag('first', :monkey, 'last') } + assert_dom_equal %(\n), stylesheet_link_tag('first', :monkey, 'last') end def test_custom_stylesheet_expansions_with_empty_array_value -- cgit v1.2.3 From a0629927b2b615a747eb223eb82e84b208d49188 Mon Sep 17 00:00:00 2001 From: Diego Carrion Date: Sun, 27 Feb 2011 22:54:02 -0300 Subject: added activesupport/test/tmp to gitignore [#6484 state:committed] Signed-off-by: Santiago Pastorino --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 35402a22f7..8daa1e4dcd 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ activerecord/doc actionpack/doc actionmailer/doc activesupport/doc +activesupport/test/tmp activemodel/test/fixtures/fixture_database.sqlite3 actionpack/test/tmp activesupport/test/fixtures/isolation_test -- cgit v1.2.3 From f42562f97bb791a7662fce0106a93eec211b2803 Mon Sep 17 00:00:00 2001 From: "Oriol Gual and Josep M. Bach" Date: Mon, 28 Feb 2011 14:31:29 +0100 Subject: Make ActiveSupport::Configurable work with modules [#6486 state:committed] Signed-off-by: Santiago Pastorino --- activesupport/lib/active_support/configurable.rb | 2 +- activesupport/test/configurable_test.rb | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/activesupport/lib/active_support/configurable.rb b/activesupport/lib/active_support/configurable.rb index 644db0b205..be19189c04 100644 --- a/activesupport/lib/active_support/configurable.rb +++ b/activesupport/lib/active_support/configurable.rb @@ -26,7 +26,7 @@ module ActiveSupport module ClassMethods def config - @_config ||= if superclass.respond_to?(:config) + @_config ||= if respond_to?(:superclass) && superclass.respond_to?(:config) superclass.config.inheritable_copy else # create a new "anonymous" class that will host the compiled reader methods diff --git a/activesupport/test/configurable_test.rb b/activesupport/test/configurable_test.rb index 9c773c1944..2b28e61815 100644 --- a/activesupport/test/configurable_test.rb +++ b/activesupport/test/configurable_test.rb @@ -21,6 +21,12 @@ class ConfigurableActiveSupport < ActiveSupport::TestCase assert_equal({ :foo => :bar }, Parent.config) end + test "adds a configuration hash to a module as well" do + mixin = Module.new { include ActiveSupport::Configurable } + mixin.config.foo = :bar + assert_equal({ :foo => :bar }, mixin.config) + end + test "configuration hash is inheritable" do assert_equal :bar, Child.config.foo assert_equal :bar, Parent.config.foo @@ -57,4 +63,4 @@ class ConfigurableActiveSupport < ActiveSupport::TestCase assert_respond_to child.config, :bar assert_respond_to child.new.config, :bar end -end \ No newline at end of file +end -- cgit v1.2.3 From a8dae084c9c1250d7d4a5a70800114b57fbceff6 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 28 Feb 2011 09:15:19 -0800 Subject: skip this on oracle --- activerecord/test/cases/calculations_test.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/activerecord/test/cases/calculations_test.rb b/activerecord/test/cases/calculations_test.rb index 991b1ab181..caf07a7357 100644 --- a/activerecord/test/cases/calculations_test.rb +++ b/activerecord/test/cases/calculations_test.rb @@ -110,6 +110,8 @@ class CalculationsTest < ActiveRecord::TestCase end def test_limit_with_offset_is_kept + return if current_adapter?(:OracleAdapter) + queries = assert_sql { Account.limit(1).offset(1).count } assert_equal 1, queries.length assert_match(/LIMIT/, queries.first) -- cgit v1.2.3 From 726599df984daca45afe5b969c74b416fcd6c11a Mon Sep 17 00:00:00 2001 From: Ben Orenstein Date: Mon, 28 Feb 2011 10:52:09 -0500 Subject: Remove redundant to_sym call. [#6483 state:committed] Signed-off-by: Santiago Pastorino --- activesupport/lib/active_support/ordered_options.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activesupport/lib/active_support/ordered_options.rb b/activesupport/lib/active_support/ordered_options.rb index 124e1a74f8..b40cbceb7e 100644 --- a/activesupport/lib/active_support/ordered_options.rb +++ b/activesupport/lib/active_support/ordered_options.rb @@ -31,7 +31,7 @@ module ActiveSupport #:nodoc: def method_missing(name, *args) if name.to_s =~ /(.*)=$/ - self[$1.to_sym] = args.first + self[$1] = args.first else self[name] end -- cgit v1.2.3 From de9713186d693652deed22cff121b43317e86ef0 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Mon, 28 Feb 2011 19:57:22 +0100 Subject: revises a few details in public/index.html --- .../generators/rails/app/templates/public/index.html | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/railties/lib/rails/generators/rails/app/templates/public/index.html b/railties/lib/rails/generators/rails/app/templates/public/index.html index 75d5edd06d..13a203dd08 100644 --- a/railties/lib/rails/generators/rails/app/templates/public/index.html +++ b/railties/lib/rails/generators/rails/app/templates/public/index.html @@ -52,7 +52,6 @@ clear: both; } - #header, #about, #getting-started { padding-left: 75px; padding-right: 30px; @@ -168,6 +167,9 @@ margin-bottom: 5px; } + .filename { + font-style: italic; + }