Ticket #5863: select_option_for_find_should_accept_array.patch
| File select_option_for_find_should_accept_array.patch, 1.4 kB (added by rubyonrails@beautifulpixel.com, 2 years ago) |
|---|
-
activerecord/lib/active_record/base.rb
old new 1061 1061 end 1062 1062 1063 1063 def construct_finder_sql(options) 1064 scope = scope(:find) 1064 scope = scope(:find) 1065 options[:select] = options[:select].join(', ') if options[:select].respond_to?(:join) 1065 1066 sql = "SELECT #{(scope && scope[:select]) || options[:select] || '*'} " 1066 1067 sql << "FROM #{(scope && scope[:from]) || options[:from] || table_name} " 1067 1068 -
activerecord/test/base_test.rb
old new 1395 1395 def test_to_param_should_return_string 1396 1396 assert_kind_of String, Client.find(:first).to_param 1397 1397 end 1398 1398 1399 def test_select_option_for_find_should_accept_array 1400 retrieved_columns = Post.find(1, :select => %w{ id title }).attributes.keys 1401 assert_equal 2, retrieved_columns.size 1402 assert retrieved_columns.include?('id') 1403 assert retrieved_columns.include?('title') 1404 end 1405 1399 1406 # FIXME: this test ought to run, but it needs to run sandboxed so that it 1400 1407 # doesn't b0rk the current test environment by undefing everything. 1401 1408 #