Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch '3-1-stable' of https://github.com/rails/rails.git into …

…3-1-stable
  • Loading branch information...
commit 01dde6c5fcebdb84fc2848adc5358bb0b2a50d71 2 parents 45010f1 + 56fb7fc
@jhtwong jhtwong authored
View
2  actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*Rails 3.1.0 (unreleased)*
+* The submit form helper does not generate an id "object_name_id" anymore. [fbrusatti]
+
* Make sure respond_with with :js tries to render a template in all cases [José Valim]
* json_escape will now return a SafeBuffer string if it receives SafeBuffer string [tenderlove]
View
5 activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
@@ -155,6 +155,11 @@ def quoted_date(value) #:nodoc:
end
end
+ def type_cast(value, column) # :nodoc:
+ return super unless BigDecimal === value
+
+ value.to_f
+ end
# DATABASE STATEMENTS ======================================
View
2  activerecord/lib/active_record/relation/finder_methods.rb
@@ -243,7 +243,7 @@ def apply_join_dependency(relation, join_dependency)
end
def construct_limited_ids_condition(relation)
- orders = relation.order_values.map(&:presence).compact
+ orders = relation.order_values.map { |val| val.presence }.compact
values = @klass.connection.distinct("#{@klass.connection.quote_table_name table_name}.#{primary_key}", orders)
relation = relation.dup
View
2  activerecord/test/cases/adapters/sqlite3/quoting_test.rb
@@ -67,7 +67,7 @@ def test_type_cast_string
def test_type_cast_bigdecimal
bd = BigDecimal.new '10.0'
- assert_equal bd.to_s('F'), @conn.type_cast(bd, nil)
+ assert_equal bd.to_f, @conn.type_cast(bd, nil)
end
def test_type_cast_unknown
View
11 activerecord/test/cases/base_test.rb
@@ -1110,6 +1110,17 @@ class NumericData < ActiveRecord::Base
self.table_name = 'numeric_data'
end
+ def test_big_decimal_conditions
+ m = NumericData.new(
+ :bank_balance => 1586.43,
+ :big_bank_balance => BigDecimal("1000234000567.95"),
+ :world_population => 6000000000,
+ :my_house_population => 3
+ )
+ assert m.save
+ assert_equal 0, NumericData.where("bank_balance > ?", 2000.0).count
+ end
+
def test_numeric_fields
m = NumericData.new(
:bank_balance => 1586.43,
View
4 activerecord/test/fixtures/pirates.yml
@@ -5,5 +5,5 @@ blackbeard:
redbeard:
catchphrase: "Avast!"
parrot: louis
- created_on: <%= 2.weeks.ago.to_s(:db) %>
- updated_on: <%= 2.weeks.ago.to_s(:db) %>
+ created_on: <%= 2.weeks.ago.utc.to_s(:db) %>
+ updated_on: <%= 2.weeks.ago.utc.to_s(:db) %>
View
5 railties/guides/rails_guides/generator.rb
@@ -227,13 +227,13 @@ def with_workaround_for_notextile(body)
end
code_blocks.push(<<HTML)
-<notextile>
+&lt;notextile&gt;
<div class="code_container">
<pre class="brush: #{brush}; gutter: false; toolbar: false">
#{ERB::Util.h($2).strip}
</pre>
</div>
-</notextile>
+&lt;/notextile&gt;
HTML
"\ndirty_workaround_for_notextile_#{code_blocks.size - 1}\n"
end
@@ -280,3 +280,4 @@ def check_fragment_identifiers(html, anchors)
end
end
end
+
View
5 railties/guides/rails_guides/textile_extensions.rb
@@ -25,7 +25,7 @@ def tip(body)
def plusplus(body)
body.gsub!(/\+(.*?)\+/) do |m|
- "<notextile><tt>#{$1}</tt></notextile>"
+ "&lt;notextile&gt;<tt>#{$1}</tt>&lt;/notextile&gt;"
end
# The real plus sign
@@ -36,8 +36,9 @@ def code(body)
body.gsub!(%r{<(yaml|shell|ruby|erb|html|sql|plain)>(.*?)</\1>}m) do |m|
es = ERB::Util.h($2)
css_class = $1.in?(['erb', 'shell']) ? 'html' : $1
- %{<notextile><div class="code_container"><code class="#{css_class}">#{es}</code></div></notextile>}
+ %{&lt;notextile&gt;<div class="code_container"><code class="#{css_class}">#{es}</code></div>&lt;/notextile&gt;}
end
end
end
end
+
Please sign in to comment.
Something went wrong with that request. Please try again.