Skip to content

Unquoted query generated by through-association scope #1361

Closed
wants to merge 1,218 commits into from
@sirlantis

Through-association owner's primary key wasn't quoted. This generates invalid SQL if the record wasn't saved yet (i.e. the primary key's value is nil) and you try to access the relation (should return an empty result).

Real-world example of generated sql:

SELECT `tags`.*
  FROM `tags`
  INNER JOIN `taggings` ON `tags`.id = `taggings`.tag_id
  WHERE
    ((`taggings`.taggable_id = ) AND (`taggings`.taggable_type = 'Ticket'))
    AND (taggings.context = 'tags' AND taggings.tagger_id IS NULL)
jamis and others added some commits Jan 19, 2011
@jamis jamis make TestCaseTest work for pre-1.9 rubies, too fd19ade
@jamis jamis scrub instance variables from test cases on teardown
this prevents test state from accumulating, resulting in leaked
objects and slow tests due to overactive GC.
1e98920
@jamis jamis rein in GC during tests by making them run (at most) once per second
this can provide a significant performance boost during testing, by
preventing the GC from running too frequently.
35984f5
Frank Fischer Added a testcase for bug [#5329]
Signed-off-by: José Valim <jose.valim@gmail.com>
b4bc49c
@josevalim josevalim Solve SystemStackError when changing locale inside ActionMailer [#5329
…state:resolved]
46b23f8
@jamis jamis Revert "rein in GC during tests by making them run (at most) once per…
… second"

This reverts commit 35984f5.
039b807
@jamis jamis Revert "scrub instance variables from test cases on teardown"
This reverts commit 1e98920.
e5664b5
@jamis jamis Revert "make TestCaseTest work for pre-1.9 rubies, too"
This reverts commit fd19ade.
683cb50
@tenderlove tenderlove Merge remote branch 'jonleighton/deprecate_habtm_attributes-3-0-stabl…
…e' into 3-0-stable

* jonleighton/deprecate_habtm_attributes-3-0-stable:
  Added deprecation warning for has_and_belongs_to_many associations where the join table has additional attributes other than the keys. Access to these attributes is removed in 3.1. Please use has_many :through instead.
f420c2e
@spastorino spastorino Bump mail version up 5f509c2
@mikel mikel Fix gitignore to ignore tmp/ correctly, credit telemachus 54e72a5
@NZKoz NZKoz Prepare for the 3.0.4 release 0cbf9b2
@josevalim josevalim Fix AM tests 0448247
@NZKoz NZKoz Be sure to javascript_escape the email address to prevent apostrophes…
… inadvertently causing javascript errors.

This fixes CVE-2011-0446
e3dd210
@josevalim josevalim Ensure render is case sensitive even on systems with case-insensitive…
… filesystems.

This fixes CVE-2011-0449
6f80224
@josevalim josevalim Use Mime::Type references. ad9d21d
@tenderlove tenderlove limit() should sanitize limit values
This fixes CVE-2011-0448
354da43
@NZKoz NZKoz Change the CSRF whitelisting to only apply to get requests
Unfortunately the previous method of browser detection and XHR whitelisting is unable to prevent requests issued from some Flash animations and Java applets.  To ease the work required to include the CSRF token in ajax requests rails now supports providing the token in a custom http header:

 X-CSRF-Token: ...

This fixes CVE-2011-0447
66ce384
@NZKoz NZKoz Make rails.js include the CSRF token in the X-CSRF-Token header with …
…every ajax request.
7b64ade
@amatsuda amatsuda Make before_type_cast available for datetime fields
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
c8b7606
@amatsuda amatsuda before_type_cast on Datetime tests for Mysql2Adapter
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
4e6a102
@saimonmoore saimonmoore Additionally trigger i18n configuration setup before any eager loading [
#6353 state:resolved]

This handles the case where config.cache_classes is true and classes
are loaded before the I18n load path has had a chance to be populated.

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
979f38a
@saimonmoore saimonmoore Ensure I18n setup is only executed once if triggered on eager loading [
…#6353 state:resolved]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
effb582
@rsim rsim fix for test_read_attributes_before_type_cast_on_datetime - Oracle ad…
…apter also returns Time value
8a73ebb
Anton Astashov Add a test for 'render :layout'
To make sure it will show block contents if it is placed after 'render
:partial'

[#5557 state:resolved]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
53b0235
@metaskills metaskills The type_cast_calculated_value method will trust DB types before cast…
…ing to a BigDecimal.

[#6365 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
068527b
@ef4 ef4 Fixing ordering of HABTM association deletion [#6191 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
e142159
@spastorino spastorino git am is better here d00ed5a
@spastorino spastorino Remove stupid mistake f2d0257
@nragaz

original_time.dup gets called even if original_time is nil, resulting in an exception (can't dup NilClass). An unless original_time.nil? would help.

Ruby on Rails member

Oh, thanks @nragaz, that was my mistake...

Ruby on Rails member
From 9138bb1ad26d8b0c8a12722f9ac07e5c433f3f9f Mon Sep 17 00:00:00 2001
From: Akira Matsuda <ronnie@dio.jp>
Date: Mon, 7 Feb 2011 08:29:06 +0900
Subject: [PATCH] avoid nil.dup

---
 .../attribute_methods/time_zone_conversion.rb      |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb b/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb
index a72eecb..76218d2 100644
--- a/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb
+++ b/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb
@@ -41,7 +41,7 @@ module ActiveRecord
             if create_time_zone_conversion_attribute?(attr_name, columns_hash[attr_name])
               method_body, line = <<-EOV, __LINE__ + 1
                 def #{attr_name}=(original_time)
-                  time = original_time.dup
+                  time = original_time.dup unless original_time.nil?
                   unless time.acts_like?(:time)
                     time = time.is_a?(String) ? Time.zone.parse(time) : time.to_time rescue time
                   end
-- 
1.7.3.5

Thank you! Was just about to do a patch myself.

Ruby on Rails member

Can you provide a patch with a test?, thanks.

stid replied Feb 9, 2011

Guys, this was released (not patched) in 3.0.4, I'm getting this error in authologic when he try to update the last_login column after a new session/user is created and in a bunch of tests.

Update: Sorry, my mistake, I was using the 30-stable branch. This was not released in 3.0.4 final.

This breaks when using the home_run gem since Date#dup (Date.allocate) is not implemented: "TypeError: allocator undefined for Date"

What exactly is being achieved by duping the Date? Is there another way this can be achieved?

Actually, looks like it's being reported as a bug on home_run: https://github.com/jeremyevans/home_run/issues#issue/21

adzap replied Mar 1, 2011

Although that is an issue for home_run to fix, as dup is valid on a Date instance. I have submitted a ticket which removes the dup because it is not necessary. No in-place change is made to the time value which could effect the original_time value.

https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/6489-fix-before_type_cast-for-timezone-aware-datetime-attributes#ticket-6489-3

@adzap

You do a to_s on the before_type_cast value which will convert the Time instance back to a string. So this does not test that a string value is stored for the before_type_cast when the original_time is a valid time string.

Ruby on Rails member

You're absolutely right.
Just pushed the fix. 65e08cf
Thanks for your advice!

adzap replied Feb 7, 2011

No problem. But I am surprised that this change actually passes. From the code, if the time string is successfully parsed, the time variable will be Time instance. Therefore when (time || original_time) is evaluated, it will pass the time instance to be stored by write_attribute. So when you call before_type_cast you should get the same Time instance, and not the original string value.

Am I missing something?

@metaskills

There should be a case here for an Arel::Sql::Literal to pass thru untouched?

@metaskills

I'll be committing a patch that adds :SQLServerAdapter too.

metaskills and others added some commits Feb 9, 2011
@metaskills metaskills Allow limit values to accept an ARel SQL literal. 7530c52
@fxn fxn getting started guide: the generated application README has no extension 01ca46b
@fxn fxn now that the API guidelines are a guide, it is enough to assert that …
…the names of Rails components have a space, no need to say it was checked with David in the past
3306314
@carlosantoniodasilva carlosantoniodasilva Add missing deprecation require
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
401ee98
@tenderlove tenderlove skip this test on mysql2 as well 4433b50
@tenderlove tenderlove no more text-format for Ruby 1.9 compatibility cab7cb4
@tenderlove tenderlove psych does not emit a space after the type 4dc5505
@joshk joshk Fixes an issue when decoding a json string which looks like a date bu…
…t is invalid. This DateTime parse error is now caught and the original string is instead passed back [#6286 state:resolved]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
e605165
@joshk joshk Updated the json date regex to recognize xmlschema formatted date tim…
…es during json decoding. [#3031 state:resolved]

Signed-off-by: Santiago Pastorino and Emilio Tagua <santiago+emilioe@wyeworks.com>
73b9e43
@amatsuda amatsuda avoid nil.dup
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
6e04f58
@amatsuda amatsuda do not to_s where you are testing that a string value is stored for t…
…he before_type_cast

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
cb045c0
@carlosantoniodasilva carlosantoniodasilva Add tests showing the LH issue #6381: fields_for with inline blocks a…
…nd nested attributes already persisted

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
640b1f0
@spastorino spastorino Backport fix from master: fields_for with inline blocks and nested at…
…tributes already persisted does not render properly

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
4145810
@morgoth morgoth added proper require for ruby-debug19 gem to generated Gemfile
[#6419 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
9c6f9c9
@spastorino spastorino Make gem "ruby-debug19" require ruby-debug 22d1fee
@ernie ernie Deprecate Relation#& alias for Relation#merge 66003f5
@jonleighton jonleighton Deprecated support for interpolated association conditions with the :…
…conditions => 'foo = #{bar}' syntax, and added the new interpolation syntax which is :conditions => proc { "foo = #{bar}" }.
756e70c
@pixeltrix pixeltrix Fix assert_recognizes with block constraints [#5805 state:resolved] e9ae88a
@pixeltrix pixeltrix Remove incorrect assert_recognizes example cb9745b
@pixeltrix pixeltrix Remove incorrect assert_recognizes example c6ab3d1
@pixeltrix pixeltrix Add notes on how to override the default :id constraint [#5994 state:…
…resolved]
b4205b4
@pixeltrix pixeltrix Fix named route helper for routes nested inside deeply nested resources
[#6416 state:resolved]
64ca278
@pixeltrix pixeltrix Add test to prevent regression on namespace root nested in a resource
[#6389 state:resolved]
abea073
@tenderlove tenderlove Merge remote branch 'jonleighton/deprecate_string_interpolation-3-0-s…
…table' into 3-0-stable

* jonleighton/deprecate_string_interpolation-3-0-stable:
  Deprecated support for interpolated association conditions with the :conditions => 'foo = #{bar}' syntax, and added the new interpolation syntax which is :conditions => proc { "foo = #{bar}" }.
2b8fad6
@cris cris fixed broken link to postgresql docs
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
e08873f
@yaroslav

wow, docrails is officially dead

Ruby on Rails member

It is not :P

Ruby on Rails member

yaroslav, why would you say that??

Bazinga!

jnimety and others added some commits Feb 15, 2011
@jnimety jnimety GcTime incorrectly checks GC.respond_to?(:total_time), it should chec…
…k GC::Profiler.respond_to?(:total_time)

[#6435 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
0cee303
Dan Pickett handle double pluralization for irregular plurals
[#6363]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
e925acb
@tukan tukan Fixed issue #6363, avoid to pluralized already pluralized names and s…
…ingularize a single in generators, for example stadia is a valid plural for stadium. But calling pluralize for stadia will return stadias which sematically is not corrent in this case

[#6363 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
149c3d6
@tenderlove tenderlove explicitly anding queries of the same column 41c35ab
@tenderlove tenderlove updating changelog ff5db18
@fcheung fcheung Change validates inclusion to use cover? for Ranges in ruby 1.9 [#6453
…state:committed]

Signed-off-by: Xavier Noria <fxn@hashref.com>
d7b539a
@tenderlove tenderlove Gem.cache is going to be deprecated, use source_index instead 3ab82d8
@tenderlove tenderlove adding a test case for custom locking ac73f50
@NZKoz NZKoz Prepend the CSRF filter to make it much more difficult to execute app…
…lication code before it fires.
90aede6
@tenderlove tenderlove silencing deprecation spam 30a0e3f
@kamal kamal Fix observer callbacks firing multiple times on descendant instances ee491b0
@tenderlove tenderlove updating to 3.0.5.rc1 ef31b87
@paneq
paneq commented on ee491b0 Feb 23, 2011

Why was this fireing twice on descendants ? I think the callbacks are copied right ? Maybe then they should not be copied ?

Ruby on Rails member

I'm not sure. I'm looking in to it as I don't really like observer code. However, this is a bug so I had to apply. :-(

I'm not saying that it was bad to apply, quite contrary, good job on catching and fixing it guys.
Now when we have it working and a proper test is written, we can think about keeping it beautiful :-)

Ruby on Rails member

Exactly. :-D

tenderlove and others added some commits Feb 23, 2011
@tenderlove tenderlove observers leak across tests, so rather than modify the object, we sho…
…uld just count the number of times the observer was called
77d4211
@sikachu sikachu Make sure that we set `env["action_dispatch.show_exceptions"]`
This has been used by `show_exception` middleware even the setting wasn't get passed to `env` hash.

(This is the backported version to 3-0-stable)
69c0bad
@sikachu sikachu Always use ActionDispatch::ShowExceptions middleware [#6462 state:res…
…olved]

This will make sure the application will raise `ActionController::RoutingError` in case "X-Cascade: pass" header was set, usually when there's no route match.

(This is a backported version to 3-0-stable)
2a67e69
@tenderlove tenderlove prepping for 3.0.5 release ecc6bb5
@tenderlove tenderlove Merge branch '3-0-5' into 3-0-stable
* 3-0-5:
  prepping for 3.0.5 release
ef5e817
@rbq
Ruby on Rails member

Yeah a stupid mistake a fixed quickly when pushed this.

spastorino and others added some commits Feb 27, 2011
@spastorino spastorino Bump i18n version f7e1703
@spastorino spastorino failing test for i18n key collision with namespaced models d043d20
@spastorino spastorino Revert "Properly interpolate i18n keys in modules [#5572 state:resolv…
…ed]"

This breaks #6448, you should use :"module/class" as key for namespacing
[#6448 state:committed]

This reverts commit 8d14fa8.
f80eea3
@svenfuchs svenfuchs Make TranslationHelper#translate use the :rescue_format option in I18…
…n 0.5.0 (backports 896e25e)

Don't catch exceptions here. Instead only declare that we want exceptions to be rescued as :html, but also let users configure reactions to exceptions in I18n.

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
1452571
@spastorino spastorino Add a test for passing :rescue_format => nil to #translate
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
ff95f85
@spastorino spastorino javascript_include_tag shouldn't raise if you register an expansion k…
…ey with nil or [] value
4c681f6
@joshk joshk updated Time, Date and DateTime current methods in AS to use Time.zon…
…e and not Time.zone_default.

[#6410 state:committed]
9ba0c7e
@joshk joshk Updated the AS guides with some information on the difference between…
… Date.today and Date.current.
7180a32
@tenderlove tenderlove use a subclass of AS::TZ for testing html output cdfee85
chuyeow and others added some commits Feb 27, 2011
@chuyeow chuyeow Fix Action caching bug where an action that has a non-cacheable respo…
…nse always renders a nil response body. It now correctly renders the response body.

Note that only GET and HTTP 200 responses can be cached.

[#6480 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
beec6c8
@spastorino spastorino Add missing versions to CHANGELOGs ea026f1
@spastorino spastorino Add some CHANGELOG entries for 3.0.6 45d5663
@josevalim josevalim log and readme should respect --quiet eff41a2
@pixeltrix pixeltrix Raise ArgumentError if route name is invalid [#6517 state:resolved] 2437c78
@pixeltrix pixeltrix Improve testing of cookies in functional tests:
- cookies can be set using string or symbol keys
- cookies are preserved across calls to get, post, etc.
- cookie names and values are escaped
- cookies can be cleared using @request.cookies.clear

[#6272 state:resolved]
e2523ff
@spastorino
Ruby on Rails member

:heart: :heart: :heart:

Ruby on Rails member

:heart::heart::heart:

jonleighton and others added some commits Apr 15, 2011
@jonleighton jonleighton Update CHANGELOG df6117e
@jonleighton jonleighton Remove unnecessary code from define_read_method and add assertion to …
…make sure the underscored version is actually generated
ef95df7
@jonleighton jonleighton Return nil from read_attribute if _foo is defined, but @attributes ha…
…s no 'foo' key. Fixes breakage in test_find_only_some_columns on Ruby 1.9 which was introduced in a3639be.
3609642
@jonleighton jonleighton Undo performances regressions I introduced in 36691ac and add test fo…
…r an edge case. Add comments to explain the intent of the code. Also fix the code (which previously worked differently on 1.8 and 1.9 due to Symbol#=~ being always false on 1.8)."
ef88c0c
@jonleighton jonleighton Backport test assertions from 65469a6 (the behaviour is already the s…
…ame, but we need to assertions to guard against regressions)
364a5d4
@jonleighton jonleighton Update CHANGELOG 20354b7
@pixeltrix pixeltrix Add missing CHANGELOG entries 612afa2
@smartinez87 smartinez87 Added missing CHANGELOG entries for 3.0.7
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
de42af7
@spastorino spastorino Prepare for the 3.0.7.rc2 release f96ad0d
@xuanxu
xuanxu commented on 61ee344 Apr 15, 2011

IMHO is a better option to have auto_link return a sanitized string.
This code returns insecure content:
auto_link("<script>alert('malicious')</script> www.rubyonrails.org", :sanitize => true)
which I think is the not expected result

I propose to avoid the vulnerability and at the same time give a better use to the existent (but not documented) :sanitize option.
I've issued a pull request here: #281

@stid
stid commented on f96ad0d Apr 16, 2011

gem 1.7.1 default_executable deprecation seems to be back in this release, this was fixed in 3.0.6 if I'm not wrong:

NOTE: Gem::Specification#default_executable= is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem::Specification#default_executable= called from /Users/xxxx/.bundler/ruby/1.9.1/rails-b549354c14a6/rails.gemspec:20

mikel and others added some commits Apr 16, 2011
@mikel mikel Updating mail to 2.2.16 2bd5e02
@arunagw arunagw File should be open in read/write mode. When doing lock on a file. c6c46e1
@tenderlove tenderlove adding a rake task to update CHANGELOG dates ff3cff8
@tenderlove tenderlove bumping version for release 2c32601
@tenderlove tenderlove Merge branch '3-0-7' into 3-0-stable
* 3-0-7:
  bumping version for release
  adding a rake task to update CHANGELOG dates
  Prepare for the 3.0.7.rc2 release
  Added missing CHANGELOG entries for 3.0.7
  Add missing CHANGELOG entries
  Update CHANGELOG
  Backport test assertions from 65469a6 (the behaviour is already the same, but we need to assertions to guard against regressions)
  Undo performances regressions I introduced in 36691ac and add test for an edge case. Add comments to explain the intent of the code. Also fix the code (which previously worked differently on 1.8 and 1.9 due to Symbol#=~ being always false on 1.8)."
  Return nil from read_attribute if _foo is defined, but @attributes has no 'foo' key. Fixes breakage in test_find_only_some_columns on Ruby 1.9 which was introduced in a3639be.
  Remove unnecessary code from define_read_method and add assertion to make sure the underscored version is actually generated

Conflicts:
	activerecord/CHANGELOG
9382cb4
@tenderlove tenderlove adding a rake task to help generate changelog notes for release annou…
…ncements
d9bca64
@josevalim josevalim Avoid define_method if possible. afcdf9b
Moiz Raja correct links to rack articles 1f92d13
@rohit rohit Guides: Add test directory to load path to run individual test files. c1720fb
@fxposter fxposter Added test case and fix for proper eager loading associations 3836dc6
@joshk joshk correction to the i18n locale filter examples 030a905
@mikel mikel Update actionmailer to use Mail 2.2.19 922fb1d
@josevalim josevalim Merged pull request #278 from miloops/fix_console.
Fix console to accept [environment] [options] as specified in docs.
8dcaf4d
@pkmiec pkmiec perofrmance trumps syntactical sugar 92e4cfb
@tenderlove tenderlove Merged pull request #347 from pkmiec/SyntacticalSugar30.
performance trumps syntactical sugar
1e19a05
@josevalim josevalim Make postgresql faster on development (thanks to @tapajos). 69079a1
@vijaydev vijaydev update verification.git plugin url 6bcb352
@tenderlove tenderlove Merged pull request #351 from vijaydev/3-0-stable.
Update the github url for the verification plugin
d657b9e
@tenderlove tenderlove Merged pull request #351 from vijaydev/3-0-stable.
Update the github url for the verification plugin
5663e63
@tenderlove tenderlove only use mysql2 0.2.x with rails 3.0.x c751d84
@daphonz daphonz This patch ensures that an inner join performed to a polymorphic reso…
…urce joins on both the polymorphic_id and polymorphic_type fields.

Previously, the inner joins were merely joining on the polymorphic_id field.
b538e85
@daphonz daphonz This patch allows a user to join through a polymorphic has_one associ…
…ation to another has_one polymorphic association. This also includes a fix in to the Author model test to properly define two associations to taggings as a has_one and a has_many.
0525306
@mathie mathie Add a couple of missing activesupport requires so AR::Migration can b…
…e used independently.
cd028aa
@josevalim josevalim Merge pull request #383 from mathie/patch-1.
Extra requires for AR::Migration
957115f
@josevalim josevalim Don't pluralize, camelize. 24fbc47
@josevalim josevalim Revert "Pass the proper method_name instead of hardcoding to action_n…
…ame."

This commit was actually correct. The first parameter in process_action
is not necessarily the same as the action_name. Use action_name to
retrieve the action instead.

This reverts commit 4e2bacd.
9575db6
@svenwin svenwin Fix Issue #342 7a79ab7
@josevalim josevalim Merge pull request #465 from sven-q/3-0-stable
Issue #342: AssetTagHelper ensures that files are in the wrong directory (again)
f1d09a2
@tenderlove tenderlove removing splat flatten as we no longer support 1.8.6. fixes #485. Tha…
…nks @sztywny
840f0a9
@jonleighton jonleighton Merge pull request #352 from daphonz/polymorphic-join-sql-patch
Fixes for incorrect INNER JOIN through two polymorphic resources (NoMethodError: undefined method `to_sym' for nil:NilClass)
f156258
@dougfales dougfales A patch so that http status codes are still included in logs even dur…
…ing an exception [#6333 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
56b6d7d
@tenderlove tenderlove RedCloth will not install on 1.9.3 ea9ef39
@tenderlove tenderlove use valid yaml in tests 00da7bc
@tenderlove tenderlove use encoding name since SJIS is Windows-31J on 1.9.3 81535fa
@tenderlove tenderlove test/unit in ruby trunk adds a new instance variable. YAY! 7775670
@tenderlove tenderlove backport skip to the AR base class e4f48b9
@tenderlove tenderlove supporting infinity and -infinity for timestamps in PG. fixes #544 dc2b999
Bradley Harris Fix bug with empty CDATA not being handled in Hash.from_xml
Signed-off-by: José Valim <jose.valim@gmail.com>
849007f
@tenderlove tenderlove simplifying buffered logger for easier and slightly more performant c…
…odes. pumpkin
a2b1be2
@tenderlove tenderlove make sure log file is written in binary mode. fixes #497 f2c6f04
@fxn
Ruby on Rails member
fxn commented on f2c6f04 May 16, 2011

binmode disables newline conversion, which is going to be really bad for Windows users.

Ruby on Rails member

@fxn can you provide a test that exercises that problem? If we don't use binmode, we will have encoding conversion errors (which these these will show).

Ruby on Rails member
fxn replied May 16, 2011

@tenderlove yes saw the ticket, but this fix seems too expensive, it breaks portable newlines for writing to the log. You know, the C stdlib I/O layer in MRI won't do LF -> CRLF conversion, and thus log files produced on Windows computers will appear as one long single line there. Same happens in other interpreters because they imitate MRI even if the underlying platform do not follow the C way to handle portable newlines (eg JRuby).

Ruby on Rails member

@luislavena care to comment on this?

Hello,

@fxn, the only edtior that is going to be affected by this is Notepad, and see that I remarked editor

Console tools, even type will properly process single \n without the return carrier (\r)

So @tenderlove, I'm Luis Lavena, and I approve this commit.

Ruby on Rails member
fxn replied May 18, 2011

@luislavena but in my view Rails is not a good citizen on Windows writing newlines in text files that do not follow the platform convention. Even if some editors may display correctly a file with CRLF on Unix, if Rails writed CRLFs one would say WTF is this?

A portable program writes portable newlines, that's my point.

So, if there was a solution that outputs portable newlines and only works with the encodings, that would be better in my view.

Ruby on Rails member
fxn replied May 18, 2011

Let me add that most programs and scripts will get the lines correctly because albeit the transformation CRLF -> LF that most I/O libraries perform when reading is not happening, your line-oriented program will see the LFs anyway (when working with text the CR never comes up to your program string buffers on Windows working in text mode).

But as I said before I am not concerned about particular uses of the log, my concern is about using a convention that is not the one of the runtime platform. That's not good. Good programs are portable. Writing non-native newlines is a broken window that will show up somewhere.

Ruby on Rails member
fxn replied May 18, 2011

This is what I mean 9d8e2fb.

Set a binary encoding, but work in text mode to keep Rails portable.

@fxn, if you wanted the log be friendly with the platform, then you would strip ANSI coloring in the first place, since Windows can't handle ANSI coloring by default.

Even if you have CRLF, the log files still have these non ASCII characters that do not display properly in the platform.

Is that been taken care? I believe not, I still see ANSI escape codes in my log files, which are not printable characters, notepad makes a mess and user still gets annoyed by them.

So, you're compromising the performance of something against the half portability of something that is not doing the right thing.

Doing what you're doing in 9d8e2fb might not have the desired results under certain encoding configurations of the user.

But, heck, seems you have better idea of encodings :-)

Ruby on Rails member
fxn replied May 18, 2011

@luislavena I am not addressing all portability issues in Rails in this thread. Not sure what ANSI escape sequences have to do here.

All I am saying is that if we can fix that ticket without compromising portable newlines, that solution is better. Do you really find this point of view strange?

If the new patch breaks something, it is not certainly the test case for that ticket. If the new patch breaks some particular combination of things I'd really want to know, and still find a solution that uses text mode if possible.

Ruby on Rails member
fxn replied May 18, 2011

Regarding whether ANSI has been taken care of, there's a flag config.colorize_logging. And if that didn't exist, it should be fixed anyway. In my view portability is a goal for programs that are going to run in several platforms. If possible.

I really find amazing that the reaction to the comments above is not "oh of course that was an undesired side-effect, let's see whether we can fix and still write in text mode somehow". I really need to defend that being portable is desirable if possible?

@codesnik

why? it couldn't hurt anyone, and looked rather nice

Ruby on Rails member
bilts and others added some commits May 20, 2011
@bilts bilts Make Rake::DSL methods available within Railtie rake_tasks block
Fixes incompatibility introduced by Rake 0.9.0
83f257f
@arunagw arunagw Fixed failing test against with 3-0-stable branch. 89252c4
@josevalim josevalim Merge pull request #1266 from arunagw/deprecation_warning_3_0_fix
Deprecation warning 3 0 fix
f505565
@arunagw arunagw Fixed failing tests. 17c9efb
@josevalim josevalim Merge pull request #1269 from arunagw/fix_load_path_test_3_0
Fix load path test 3 0
f236dbf
@JoeyButler JoeyButler Add failing test case for issue 796 d387a59
@tenderlove tenderlove do not bother with assert_nothing_raised, the test will fail and we g…
…et a better trace without it
99cfdba
@tenderlove tenderlove adding a test for create! with invalid associations f0c09f7
@tenderlove tenderlove add tests surrounding behavior of save and save! for associations tha…
…t have validation errors
1c079c5
@tenderlove tenderlove rescue record invalid exceptions and return false from the save metho…
…d. fixes #796
79abb70
@tenderlove tenderlove make open_log private 2649db7
@spastorino spastorino Gem::Specification#has_rdoc= is deprecated since rubygems 1.7.0 352daff
@spastorino spastorino default_executable is deprecated since rubygems 1.7.0 79ed700
@tenderlove tenderlove fixing psych support in big decimal, fixing tests to support YAML 1.1 929e5c4
@tenderlove tenderlove prefering psych as the yaml parser if possible, fixing assertions for…
… YAML 1.1 compatibility
f55a171
@tenderlove tenderlove load psych by default if possible 8e6b757
@tenderlove tenderlove require Psych if possible, use Psych output when enabled 03f0f3c
@tenderlove tenderlove load and prefer psych as the YAML parser when it is available e4594f7
@tenderlove tenderlove use ! " " YAML string literal syntax rather than removing both quotes 5856fc5
@tenderlove tenderlove add Psych::SyntaxError to the list of rescued YAML exceptions cae1d46
@tenderlove tenderlove updating changelogs eecbc10
@parndt
parndt commented on eecbc10 May 25, 2011

Changelogs ftw

tenderlove and others added some commits May 25, 2011
@tenderlove tenderlove bumping to 3.0.8.rc1 8b0806e
@parndt parndt This fixes rake for me in RefineryCMS. Otherwise, I get: undefined me…
…thod 'prerequisites' for nil:NilClass (from rspec)
9e88b87
@tenderlove tenderlove Merge pull request #1317 from parndt/3-0-stable
This fixes rake for me in RefineryCMS.
072e1ca
@sferik
sferik commented on 83f257f May 26, 2011

:+1: Nice one! Congratulations on your first commit in Rails.

@pacoguzman

IMHO is possible to use 0.2.7, ins't it?

Ruby on Rails member

Yes. The ~> constraint lets you use "0.2.x" that is greater than or equal to "0.2.6".

@josevalim
Ruby on Rails member

It seems something is wrong with your pull request. :P

@josevalim josevalim closed this May 27, 2011
@sirlantis

Whoops. Github exploded. Fixed the Pull-Request (now 1362). Sorry for the mess.

@mtodd

Was this line left in here accidentally?

Heh, nevermind, misread line 544 and realized once I posted this comment. :heart:

@jake3030 jake3030 pushed a commit to jake3030/rails that referenced this pull request Jun 28, 2011
@philr philr TimeZone: Caracas GMT offset changed to -4:30 [#1361 state:resolved] 02df503
@lawrencepit

The problem with this implementation (compared to rails2) is that read_attribute is now in the top 5 responsible for creating the most objects (in a typical rails app), and thereby being a burden on the GC; i.e. it slows things down.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.