Commit Graph

34867 Commits

Author SHA1 Message Date
Jeremy Kemper
4d240ec20a Use bundler --pre for travis builds 2013-01-03 18:05:17 -07:00
Jeremy Kemper
e00b8ecf1a Bump bundler dep to 1.3.0.pre.4+ to introduce 'bundle binstubs <gem>' 2013-01-03 17:41:52 -07:00
Rafael Mendonça França
d64c7c7033 Reuse the Column integer converter 2013-01-03 21:40:01 -03:00
Rafael Mendonça França
ebabd78bef Change duplicated test name 2013-01-03 21:26:38 -03:00
Rafael Mendonça França
3a39de677a Merge pull request #8734 from jstirk/master-column_writer_to_i_errors
Fix undefined method `to_i' introduced in 3.2.9
2013-01-03 15:36:34 -08:00
Jason Stirk
8d98c83bbc Fix undefined method `to_i' introduced since 3.2.8
This commit fixes a bug introduced in 96a13fc7 which breaks behaviour of
integer fields.

In 3.2.8, setting the value of an integer field to a non-integer (eg.
Array, Hash, etc.) would default to 1 (true) :

    # 3.2.8
    p = Post.new
    p.category_id = [ 1, 2 ]
    p.category_id # => 1
    p.category_id = { 3 => 4 }
    p.category_id # => 1

In 3.2.9 and above, this will raise a NoMethodError :

    # 3.2.9
    p = Post.new
    p.category_id = [ 1, 2 ]

    NoMethodError: undefined method `to_i' for [1, 2]:Array

Whilst at first blush this appear to be sensible, it combines in bad
ways with scoping.

For example, it is common to use scopes to control access to data :

    @collection = Posts.where(:category_id => [ 1, 2 ])
    @new_post = @collection.new

In 3.2.8, this would work as expected, creating a new Post object
(albeit with @new_post.category_id = 1). However, in 3.2.9 this will
cause the NoMethodError to be raised as above.

It is difficult to avoid triggering this error without descoping before
calling .new, breaking any apps running on 3.2.8 that rely on this
behaviour.

This patch deviates from 3.2.8 in that it does not retain the somewhat
spurious behaviour of setting the attribute to 1. Instead, it explicitly
sets these invalid values to nil :

    p = Post.new
    p.category_id = [ 1, 2 ]
    p.category_id # => nil

This also fixes the situation where a scope using an array will
"pollute" any newly instantiated records.

    @new_post = @collection.new
    @new_post.category_id # => nil

Finally, 3.2.8 exhibited a behaviour where setting an object to an
integer field caused it to be coerced to "1". This has not been
retained, as it is spurious and surprising in the same way that setting
Arrays and Heshes was :

    c = Category.find(6)
    p = Post.new

    # 3.2.8
    p.category_id = c
    p.category_id # => 1

    # This patch
    p.category_id = c
    p.category_id # => nil

This commit includes explicit test cases that expose the original issue
with calling new on a scope that uses an Array. As this is a common
situation, an explicit test case is the best way to prevent regressions
in the future.

It also updates and separates existing tests to be explicit about the
situation that is being tested (eg. AR objects vs. other objects vs.
non-integers)
2013-01-04 10:34:08 +11:00
Rafael Mendonça França
a664686e47 Merge pull request #8732 from amatsuda/readme_call_yield
a tiny fix in the generated README
2013-01-03 14:17:21 -08:00
Akira Matsuda
86a48814a7 no, call <%= yield %> 2013-01-04 07:12:36 +09:00
Guillermo Iguaran
e5d4367e19 Merge pull request #8731 from amatsuda/readme_dir_tree
update directory tree in the generated README
2013-01-03 13:54:18 -08:00
Rafael Mendonça França
3be2edd5f7 Add documentation to ActionDispatch::Http::UploadedFile#headers
[ci skip]
2013-01-03 18:49:28 -03:00
Akira Matsuda
cd1cc47525 update directory tree in the generated README 2013-01-04 06:46:26 +09:00
Rafael Mendonça França
05fb650d31 Merge pull request #8730 from robin850/master
Fix missing spaces in method definitions
2013-01-03 13:14:10 -08:00
Robin Dupret
975493a172 Fix missing spaces before and after equal signs in method definitions 2013-01-03 22:14:09 +01:00
Rafael Mendonça França
fdd6271e1b Merge pull request #8729 from timraymond/help_message_for_install_script
Adding a usage message to install.rb script
2013-01-03 12:56:43 -08:00
Tim Raymond
66258c0e48 Adding a usage message to install.rb script
Previously, invoking the install.rb script with zero arguments
caused it to attempt to install all gems without a version
suffix, which would fail spectacularly. Failing gracefully with
a usage message is more helpful to a first-time user.
2013-01-03 15:14:24 -05:00
Rafael Mendonça França
a89660947b Merge pull request #8728 from amatsuda/model_all_returns_a_relation
A small fix for an AR test case
2013-01-03 11:24:44 -08:00
Akira Matsuda
4b7137efe5 need to to_a the Relation to execute SQL here 2013-01-04 04:02:23 +09:00
Rafael Mendonça França
bb1955d5fd Merge pull request #8727 from robin850/patch-2
Remove a useless TODO comment
2013-01-03 10:53:48 -08:00
Robin Dupret
4075be80a2 Remove a useless TODO comment 2013-01-03 19:50:43 +01:00
Guillermo Iguaran
cb2bd4aa61 Merge pull request #8705 from amparo-luna/change_update_attributes_to_update
Rename update_attributes method to update
2013-01-03 09:09:59 -08:00
Amparo Luna + Guillermo Iguaran
d826f14443 Add Changelog entry regarding update_attibutes being renamed to update 2013-01-03 12:04:25 -05:00
Amparo Luna + Guillermo Iguaran
0433d79724 Updating default application templates to use update instead of update_attributes 2013-01-03 12:04:25 -05:00
Amparo Luna + Guillermo Iguaran
03ac174f2d Change guides to use update instead of update_attributes 2013-01-03 12:04:25 -05:00
Amparo Luna + Guillermo Iguaran
1bb020063c Change docs to use update instead of update_attributes 2013-01-03 12:03:34 -05:00
Amparo Luna + Guillermo Iguaran
1f3a1fedf9 Rename update_attributes method to update, keep update_attributes as an alias 2013-01-03 11:51:21 -05:00
Guillermo Iguaran
b4a23edc10 Merge pull request #8725 from mattdbridges/patch-2
Typo and grammar fixes in the ActionPack CHANGELOG
2013-01-03 08:49:17 -08:00
Matt Bridges
f6364e454a Typo and grammar fixes in the ActionPack CHANGELOG 2013-01-03 10:30:11 -06:00
Guillermo Iguaran
f8633f9fdd Merge pull request #8713 from goshakkk/better-error-page
Fix env toggling, improve error page styling
2013-01-03 06:24:56 -08:00
Gosha Arinich
d7d45785e5 fix env toggling, improve error page styling 2013-01-03 17:21:35 +03:00
Carlos Antonio da Silva
b02d45299d Merge pull request #8719 from pcasaretto/fix-actionview-doc-typo
Fix typo on form_tag_helper.rb [ci skip]
2013-01-03 05:22:15 -08:00
Paulo Luis Franchini Casaretto
eab2b999ed Fix typo on form_tag_helper.rb
The inline documentantion had a typo that was somewhat confusing.
2013-01-03 11:07:20 -02:00
Carlos Antonio da Silva
de729af21e Merge pull request #8717 from amatsuda/scaffold_controller_test_patch
test PATCH method for update action in generated scaffold controller test rather than PUT
2013-01-03 04:09:24 -08:00
Carlos Antonio da Silva
e0be37ccdb Merge pull request #8715 from goshakkk/refactor-mapper
Refactor Routing::Mapper#matches?
2013-01-03 04:07:31 -08:00
Carlos Antonio da Silva
fe649b1f4c Merge pull request #8714 from utkarshkukreti/faster-gem-install
Pass in `--local` when doing `gem install` for local gems. [ci skip]
2013-01-03 03:48:48 -08:00
Akira Matsuda
1030b7b2d6 test PATCH method for update action in generated scaffold controller test rather than PUT 2013-01-03 20:21:18 +09:00
Gosha Arinich
77f2ba9559 refactor Routing::Mapper 2013-01-03 13:06:42 +03:00
Utkarsh Kukreti
86c21e4fb9 Pass in --local when doing gem install for local gems. 2013-01-03 15:23:47 +05:30
Rafael Mendonça França
c9d8481beb Merge pull request #8706 from steveklabnik/ip_precautions
Explain the possible IP precautions
2013-01-02 15:37:02 -08:00
Andre Arko
cc5a4bb4df Explain the possible precautions 2013-01-02 15:34:27 -08:00
Guillermo Iguaran
c79fb2ac8f Merge pull request #7980 from steveklabnik/issue_7979
Restore original remote_ip algorithm.
2013-01-02 15:27:20 -08:00
Andre Arko
75dcdbc84e Restore original remote_ip algorithm.
Proxy servers add X-Forwarded-For headers, resulting in a list of IPs. We
remove trusted IP values, and then take the last given value, assuming that
it is the most likely to be the correct, unfaked value. See [1] for a very
thorough discussion of why that is the best option we have at the moment.

[1]: http://blog.gingerlime.com/2012/rails-ip-spoofing-vulnerabilities-and-protection/

Fixes #7979
2013-01-02 15:26:27 -08:00
Carlos Antonio da Silva
9f200fb296 Changelog improvements [ci skip] 2013-01-02 21:11:11 -02:00
Akira Matsuda
b6aa59368b missing changelog entry for #8682 2013-01-02 19:19:33 -03:00
Rafael Mendonça França
ef61504c6e Merge pull request #8697 from goshakkk/undup
Remove another unnecessary dup
2013-01-02 13:58:32 -08:00
Aaron Patterson
44930b2def CVE-2012-5664 options hashes should only be extracted if there are extra parameters
Conflicts:
	activerecord/lib/active_record/dynamic_matchers.rb
2013-01-02 13:44:06 -08:00
Rafael Mendonça França
8af674714c Merge pull request #8701 from senny/8700_double_slash_with_trailing_slash
do not append a second slash when using `trailing_slash: true`
2013-01-02 13:39:56 -08:00
Guillermo Iguaran
c9f0680cdf Fixing closing </p> 2013-01-02 16:18:17 -05:00
Guillermo Iguaran
2db932da78 Merge pull request #8702 from rubys/master
Fix a number of validation/style errors
2013-01-02 13:12:38 -08:00
Sam Ruby
73f4f4aa8f Fix a number of validation/style errors:
* <pre> is not allowed to be nested inside of <p> elements in HTML
 * Indentation of </p> doesn't match corresponding <p>
 * <p> element not explicitly closed
 * One more </div> than <div>

In each case, the template was fixed to match how a HTML5 parser would "see"
the resulting page.
2013-01-02 16:06:54 -05:00
Yves Senn
0b2ce7d955 do not append a second slash when using 2013-01-02 21:11:16 +01:00