Compare commits

..

1711 Commits

Author SHA1 Message Date
Aman Gupta
a03ab928c0 bump mail 2014-03-20 19:01:55 -07:00
Aman Gupta
cb105585af newer thor 2014-03-20 18:59:37 -07:00
Aman Gupta
50febe331d more builder 2014-03-20 18:57:50 -07:00
Aman Gupta
cf254c1fda newer builder 2014-03-20 18:54:42 -07:00
Aman Gupta
d7f3535548 newer sprockets 2014-03-20 18:46:43 -07:00
Aman Gupta
d9cef4719c bump gem dependencies 2012-10-03 17:07:59 -07:00
Pratik Naik
2d6d8a72a3 Ensure association preloading properly merges default scope and association conditions 2012-08-28 12:50:06 -07:00
Xavier Noria
e6e9e565da CHANGELOGs are now per branch
Check 810a50d for the rationale.
2012-08-28 21:46:04 +02:00
Jon Leighton
e08268ba5a Increase benchmark time to 20 seconds.
I think that 5 seconds was a bit low for our purposes.

Also enable it to be configured via env vars.

We also need to scale the number of records up/down depending on how
long we're running the benchmark for.

Conflicts:
	activerecord/examples/performance.rb
2012-08-17 15:20:26 +01:00
Jon Leighton
20d6f70926 Use benchmark/ips to measure AR performance
This means we can more easily compare numbers, and we don't have to
specify a single N for all reports, which previously meant that some
tests were running many more/fewer iterations than necessary.

Conflicts:
	Gemfile
	activerecord/examples/performance.rb
2012-08-17 11:57:21 +01:00
Rafael Mendonça França
4f12e3a3a5 Remove warning when using html_escape with Ruby 1.9.
Closes #7323
2012-08-15 19:06:14 -03:00
Carlos Antonio da Silva
8181b7230b Add html_escape note to CHANGELOG
This was added to all other branches, but 3-1 missed the entry.

3-0-stable: 954e262636
3-2-stable: ae2383d90a
master: 5c07be5f7fb7e6417c09751c7fb9bb98a63d9917
2012-08-15 12:53:05 -03:00
Santiago Pastorino
38bf9cf368 Bump to 3.1.8 2012-08-09 16:22:39 -03:00
Santiago Pastorino
e8d78e7836 Add CHANGELOG entries 2012-08-09 16:20:17 -03:00
Santiago Pastorino
63e67ea1a6 Do not mark strip_tags result as html_safe
Thanks to Marek Labos & Nethemba

CVE-2012-3465
2012-08-09 15:58:33 -03:00
Santiago Pastorino
b6a0a1166f escape select_tag :prompt values
CVE-2012-3463
2012-08-09 15:49:08 -03:00
Santiago Pastorino
d0c9759d3a html_escape should escape single quotes
https://www.owasp.org/index.php/XSS_%28Cross_Site_Scripting%29_Prevention_Cheat_Sheet#RULE_.231_-_HTML_Escape_Before_Inserting_Untrusted_Data_into_HTML_Element_Content
Closes #7215
2012-08-06 21:39:35 -03:00
Aaron Patterson
d314a48a40 bumping to 3.1.7 2012-07-26 14:58:51 -07:00
Aaron Patterson
6cf68d797d updating rails release date 2012-07-26 14:55:18 -07:00
Aaron Patterson
140a70a72b updating changelog with CVE 2012-07-26 13:32:08 -07:00
Aaron Patterson
eb69ad2155 * Do not convert digest auth strings to symbols. CVE-2012-3424 2012-07-26 13:31:12 -07:00
Aaron Patterson
a4b8a7e8ca updating changelog 2012-07-23 14:32:54 -07:00
Aaron Patterson
28e744d682 adding a test for #6459 2012-06-14 10:55:30 -07:00
Xavier Noria
666a48a303 removes item in the Active Record CHANGELOG
That change to update_attribute was considered
to be too subtle and was reverted in 30ea923
just before Rails 3 shipped. Later we introduced
update_column (Rails 3.1).
2012-06-14 11:47:27 +02:00
Aaron Patterson
63dce16202 updating changelogs 2012-06-12 14:03:38 -07:00
Aaron Patterson
4e7d571918 bumping version numbers 2012-06-11 15:48:26 -07:00
Aaron Patterson
bee42f3a0a updating changelogs with security fixes 2012-06-11 15:48:04 -07:00
Aaron Patterson
75d039f1d4 adding version number to changelogs 2012-06-11 15:46:26 -07:00
Aaron Patterson
64e30e8b34 Merge branch '3-1-stable-sec' into 3-1-stable-rel
* 3-1-stable-sec:
  Array parameters should not contain nil values.
  Additional fix for CVE-2012-2661
2012-06-11 15:42:40 -07:00
Rafael Mendonça França
3e2c00a1dc Mysql and Mysql2 adapters accepts only two arguments in the tables
method.

Fix build http://travis-ci.org/#!/rails/rails/builds/1594492
2012-06-11 18:09:09 -03:00
kennyj
8e6ed58e43 Change the string to use in test case.
Conflicts:

	activerecord/test/cases/adapters/mysql/mysql_adapter_test.rb
	activerecord/test/cases/adapters/mysql2/schema_test.rb
2012-06-11 11:27:54 -07:00
kennyj
023eaf8ab9 Fix GH #3163. Should quote database on mysql/mysql2.
Conflicts:

	activerecord/test/cases/adapters/mysql/mysql_adapter_test.rb

Conflicts:

	activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
	activerecord/test/cases/adapters/mysql/mysql_adapter_test.rb
2012-06-11 11:27:45 -07:00
Aaron Patterson
f4174ad429 Array parameters should not contain nil values. 2012-06-10 22:47:42 -05:00
Ernie Miller
8355abf153 Additional fix for CVE-2012-2661
While the patched PredicateBuilder in 3.1.5 prevents a user
from specifying a table name using the `table.column` format,
it doesn't protect against the nesting of hashes changing the
table context in the next call to build_from_hash. This fix
covers this case as well.
2012-06-08 17:26:52 -05:00
Aaron Patterson
a1a71ab855 Merge branch '3-1-rel' into 3-1-stable
* 3-1-rel:
  bumping to 3.1.5
  updating the CHANGELOG
  bumping to 3.1.5.rc1
2012-05-31 11:26:57 -07:00
Aaron Patterson
aa6e56b86f Merge branch '3-1-stable-sec' into 3-1-stable
* 3-1-stable-sec:
  Strip [nil] from parameters hash. Thanks to Ben Murphy for reporting this!
  predicate builder should not recurse for determining where columns. Thanks to Ben Murphy for reporting this
2012-05-31 11:26:07 -07:00
Aaron Patterson
aa18c0cac0 bumping to 3.1.5 2012-05-31 10:42:35 -07:00
Aaron Patterson
a7ed19814b updating the CHANGELOG 2012-05-31 10:41:47 -07:00
Aaron Patterson
a9c1898b3e Merge branch '3-1-stable-sec' into 3-1-rel
* 3-1-stable-sec:
  Strip [nil] from parameters hash. Thanks to Ben Murphy for reporting this!
  predicate builder should not recurse for determining where columns. Thanks to Ben Murphy for reporting this
2012-05-31 10:29:46 -07:00
Aaron Patterson
5b83bbfab7 Strip [nil] from parameters hash.
Thanks to Ben Murphy for reporting this!

CVE-2012-2660
2012-05-30 15:13:55 -07:00
Aaron Patterson
b71d4ab9d7 predicate builder should not recurse for determining where columns.
Thanks to Ben Murphy for reporting this

CVE-2012-2661
2012-05-30 15:05:19 -07:00
Rafael Mendonça França
2f428152fa Merge pull request #6532 from freerange/3-1-stable-minitest-passthrough-exceptions
Exceptions like Interrupt should not be rescued in tests.
2012-05-29 04:03:18 -07:00
James Mead
4cd32854f6 Exceptions like Interrupt should not be rescued in tests.
This is a back-port of rails/rails#6525. See the commit notes there for
details.
2012-05-29 11:26:45 +01:00
Aaron Patterson
bd8ee8c912 bumping to 3.1.5.rc1 2012-05-28 11:54:56 -07:00
Rafael Mendonça França
a74b6a023b Merge pull request #3237 from sakuro/data-url-scheme
Support data: url scheme
2012-05-13 19:15:00 -03:00
Santiago Pastorino
e7f8f5f9bd Merge pull request #6300 from guilleiguaran/upgrade-sprockets-3-1-stable
Upgrade sprockets to 2.0.4
2012-05-13 09:35:23 -07:00
Guillermo Iguaran
03e2895834 Upgrade sprockets to 2.0.4 2012-05-13 03:08:37 -05:00
Santiago Pastorino
d2ae95583f Merge pull request #6263 from arunagw/3-1-stable
3 1 stable
2012-05-11 08:10:46 -07:00
Arun Agrawal
200d3daa30 Ruby-Prof works with 1.9.3. Let's run. 2012-05-11 17:55:52 +05:30
Piotr Sarnacki
7b7bf33c05 Merge pull request #6261 from carlosantoniodasilva/fix-build-3-1
Fix build 3-1-stable
2012-05-10 17:16:09 -07:00
Carlos Antonio da Silva
b7080e767f Update performance profiler to work with latest ruby-prof, fix 3-1-stable build 2012-05-10 21:10:59 -03:00
Andrew White
e98893b189 Don't ignore nil positional arguments for url helpers - fixes #6196. 2012-05-10 22:07:14 +01:00
Andrew White
7336b33008 Refactor the handling of default_url_options in integration tests
This commit improves the handling of default_url_options in integration
tests by making behave closer to how a real application operates.

Specifically the following issues have been addressed:

* Options specified in routes.rb are used (fixes #546)
* Options specified in controllers are used
* Request parameters are recalled correctly
* Tests can override default_url_options directly
2012-05-10 21:33:31 +01:00
Jeremy Kemper
a33d9f435c Merge pull request #6152 from route/assets_precompile_task_3_1
Just cherry-picked fixes for asset precompile for 3-1-stable
2012-05-04 06:22:07 -07:00
Dmitry Vorotilin
29aa03a468 Added test for assets:precompile for index files 2012-05-04 16:30:47 +04:00
Dmitry Vorotilin
cf429711b0 Fix #3993 assets:precompile task does not detect index files 2012-05-04 16:30:36 +04:00
Andrew White
0cfa6b71f2 Reset the request parameters after a constraints check
A callable object passed as a constraint for a route may access the request
parameters as part of its check. This causes the combined parameters hash
to be cached in the environment hash. If the constraint fails then any subsequent
access of the request parameters will be against that stale hash.

To fix this we delete the cache after every call to `matches?`. This may have a
negative performance impact if the contraint wraps a large number of routes as the
parameters hash is built by merging GET, POST and path parameters.

Fixes #2510.
(cherry picked from commit 56030506563352944fed12a6bb4793bb2462094b)
2012-05-03 00:02:08 +01:00
Vijay Dev
ffd3289e73 fix grammar in deprecation message [ci skip] 2012-05-01 19:42:19 +05:30
Dave Gerton
7b0c45de92 Correcting some confusion. Pago Pago is part of American Samoa, not Samoa.
Further, Samoa and Tokelau jumped across the IDL from Dec 29 to Dec 31, 2011
switching from UTC-11 to UTC+13. American Samoa did not make the change and
remains at UTC-11. Pacific/Fakaofo and Pacific/Apia are in TZInfo and
documentation about the dateline change is in austalasia at IANA.

(cherry picked from commit 5fe88b11f1)
2012-04-30 14:00:20 +01:00
Piotr Sarnacki
e23e684d35 Failing test for #6034 2012-04-30 00:20:28 -07:00
Will Bryant
d625a7ac17 fix the Flash middleware loading the session on every request (very dangerous especially with Rack::Cache), it should only be loaded when the flash method is called 2012-04-30 00:20:17 -07:00
Andrew White
78c181b701 Escape interpolated params when redirecting - fixes #5688 2012-04-29 21:37:03 +01:00
Jeremy Kemper
f00ab1de02 Merge pull request #6046 from arunagw/lock_mocha_to_fix_build
Lock mocha to fix build
2012-04-29 11:01:35 -07:00
Arun Agrawal
94a5431f18 mocha can be locked here as new version is failing
nil.stubs is not allowed in new version of mocha
2012-04-29 17:05:20 +05:30
Andrew White
8af2fd8891 Don't convert params if the request isn't HTML - fixes #5341
(cherry picked from commit d6bbd337ef)
2012-04-29 10:52:59 +01:00
Jeremy Kemper
4274a81ff7 Merge pull request #5862 from arunagw/multi_json_fix_3-1-stable
Restrict multi_json to >= 1.0, < 1.3 to avoid API changes in 1.3
2012-04-16 07:47:58 -07:00
Arun Agrawal
eeba535a8a multi_json is restricted to < 1.3.
Some API changes are there above 1.3.
2012-04-16 20:13:28 +05:30
José Valim
8c3ca29d45 Merge pull request #5686 from arunagw/issue_4083
Issue 4083
2012-04-03 02:42:58 -07:00
Arun Agrawal
c409d06689 CHANGELOG entry added 2012-04-01 00:21:48 +05:30
Arun Agrawal
54d3645e93 :subdomain can now be specified with a value of false in url_for,
allowing for subdomain(s) removal from the host during link generation. 

Closes #4083

cherry-picked from 

de942e5534
96aa3bd0ea
2012-04-01 00:16:38 +05:30
Santiago Pastorino
5cbb20d053 Merge pull request #5658 from yahonda/address_ora_00918_with_oracle_for_3_1
Address an error for test_has_many_through_polymorphic_has_one with Oracle
2012-03-29 13:11:53 -07:00
Aaron Patterson
eae9a07507 Merge pull request #5647 from arturopie/fixing_IM_when_using_find_select
Fixing Identity Map when using find select
2012-03-29 12:34:40 -07:00
Yasuo Honda
53db676a5e Address an error for test_has_many_through_polymorphic_has_one
with Oracle for the 3-1-stable branch
2012-03-29 13:09:51 -04:00
Arturo Pie
14af116641 refactor instantiate method in base, so we remove nesting if's which make the code harder to read. Minor changes to contain_all_columns in IdentityMap. 2012-03-28 21:05:12 -04:00
Arturo Pie
15a2e0dee2 refactor the checking of the attributes of the record in IdentityMap#add, so it's more readable 2012-03-27 21:59:46 -04:00
Arturo Pie
a00a42dc01 Do not add record to identity map if the record doesn't have values for all the columns, so we don't get 'MissingAttributeError' later when trying to access other fields of the same record. 2012-03-27 21:59:46 -04:00
Arturo Pie
488ea89a4b Adds a test that breaks IM when using #select 2012-03-27 21:59:46 -04:00
José Valim
bef0b354e4 Avoid inspecting the whole route set, closes #1525 2012-03-27 19:57:47 +02:00
Aaron Patterson
e95f8e8a2f Merge pull request #2621 from icco/master
Issue with schema dump
2012-03-26 17:26:27 -07:00
Aaron Patterson
4590e9915e Merge pull request #5599 from carlosantoniodasilva/fix-build-3-1
Fix build for branch 3-1-stable - return the same session hash object
2012-03-26 15:37:16 -07:00
Carlos Antonio da Silva
a16aa8c3d2 Return the same session data object when setting session id
Make sure to return the same hash object instead of returning a new one.
Returning a new one causes failures on cookie store tests, where it
tests for the 'Set-Cookie' header with the session signature.

This is due to the hash ordering changes on Ruby 1.8.7-p358.
2012-03-26 16:18:20 -03:00
José Valim
dafded2134 Merge pull request #5564 from carlosantoniodasilva/fix-build-3-1
Fix build for branch 3-1-stable
2012-03-23 11:28:42 -07:00
Carlos Antonio da Silva
c8d5680655 Fix identity map tests 2012-03-23 14:39:42 -03:00
Carlos Antonio da Silva
51bb1c1d7a Add order to tests that rely on db ordering, to fix failing tests on pg
Also skip persistente tests related to UPDATE + ORDER BY for postgresql

PostgreSQL does not support updates with order by, and these tests are
failing randomly depending on the fixture loading order now.
2012-03-23 14:39:37 -03:00
José Valim
fea82eba34 Merge pull request #5506 from arunagw/build_fix_1.8.7-3-1-stable
Build fix 1.8.7 3 1 stable
2012-03-19 00:17:56 -07:00
Arun Agrawal
c1c62e8b1a Build fix for form_options_helper_test.rb ruby-1.8.7 2012-03-19 12:30:39 +05:30
José Valim
594d6b23d8 Merge pull request #5504 from arunagw/build_fix_1-8-7
Build fix 1 8 7
2012-03-18 23:50:41 -07:00
Arun Agrawal
eeee6f2dbe fix test failing in 1.8.7 2012-03-19 11:32:56 +05:30
Mikel Lindsaar
f12d76b322 Increase minimum version of mail.
Second security vulnerability found in mail file delivery method
  patched in version 2.3.3.
2012-03-19 14:41:45 +11:00
Aaron Patterson
66b8ef164d Merge pull request #5457 from brianmario/typo-fix
Fix typo in redirect test
2012-03-15 15:22:56 -07:00
Aaron Patterson
47147a0555 Merge pull request #5456 from brianmario/redirect-sanitization
Strip null bytes from Location header
2012-03-15 14:58:49 -07:00
José Valim
cfab216322 Merge pull request #5401 from arunagw/issue_4409_3-1-stable
Issue 4409 3 1 stable
2012-03-13 01:47:57 -07:00
Denis Jean
b1fe2c6606 fix activerecord query_method regression with offset into Fixnum
add test to show offset query_methods on mysql & mysql2

change test to cover public API
2012-03-13 08:53:37 +05:30
Aaron Patterson
bccffc9603 Merge pull request #5312 from kennyj/fix_3927-31
[3-1-stable] Use 1.9 native XML escaping to speed up html_escape and shush regexp warnings
2012-03-12 11:00:48 -07:00
Santiago Pastorino
745562700d Merge pull request #5322 from arunagw/test_fix_1.8.7-3-1-stable
Test fix 1.8.7 3 1 stable
2012-03-07 11:43:27 -08:00
Arun Agrawal
d024ce1d6c Test fix failing in 1.8.7-p358 2012-03-07 18:27:58 +05:30
Jeremy Kemper
7cdfd910b7 Use 1.9 native XML escaping to speed up html_escape and shush regexp warnings
length      user     system      total        real
before  6      0.010000   0.000000   0.010000 (  0.012378)
after   6      0.010000   0.000000   0.010000 (  0.012866)
before  60     0.040000   0.000000   0.040000 (  0.046273)
after   60     0.040000   0.000000   0.040000 (  0.036421)
before  600    0.390000   0.000000   0.390000 (  0.390670)
after   600    0.210000   0.000000   0.210000 (  0.209094)
before  6000   3.750000   0.000000   3.750000 (  3.751008)
after   6000   1.860000   0.000000   1.860000 (  1.857901)
2012-03-07 13:01:00 +09:00
José Valim
54621f765f Use latest rack-cache. 2012-03-06 10:14:07 +01:00
Mikel Lindsaar
5aa4f52755 Increasing minimum version of mail due to security vulnerability found in Mail 2.3.0 for sendmail or exim 2012-03-06 20:03:27 +11:00
Carlos Antonio da Silva
24e074fde8 Only run binary type cast test with encode! on Ruby 1.9 2012-03-04 16:36:45 +01:00
Aaron Patterson
b1358c8fa1 only log an error if there is a logger. fixes #5226
Conflicts:

	activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb

Conflicts:

	activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
2012-03-02 10:31:12 -08:00
Carlos Antonio da Silva
66c6c7f87d Stop SafeBuffer#clone_empty from issuing warnings
Logic in clone_empty method was dealing with old @dirty variable, which
has changed by @html_safe in this commit:
139963c99a

This was issuing a "not initialized variable" warning - related to:
https://github.com/rails/rails/pull/5237

The logic applied by this method is already handled by the [] override,
so there is no need to reset the variable here.
2012-03-02 16:06:58 +01:00
Aaron Patterson
11881ad478 Merge branch '3-1-4' into 3-1-stable
* 3-1-4:
  bumping to 3.1.4
  Ensure [] respects the status of the buffer.
  updating RAILS_VERSION
  use AS::SafeBuffer#clone_empty for flushing the output_buffer
  add AS::SafeBuffer#clone_empty
  fix output safety issue with select options
2012-03-01 09:51:21 -08:00
Aaron Patterson
1aabea698b bumping to 3.1.4 2012-03-01 09:20:24 -08:00
Aaron Patterson
d1fc35fe19 Merge branch '3-1-stable-security' into 3-1-4
* 3-1-stable-security:
  Ensure [] respects the status of the buffer.
  use AS::SafeBuffer#clone_empty for flushing the output_buffer
  add AS::SafeBuffer#clone_empty
  fix output safety issue with select options
2012-03-01 09:17:48 -08:00
José Valim
4c8679ec56 Merge pull request #5227 from arunagw/build_fix_3-1-stable
Build fix 3 1 stable
2012-03-01 07:10:11 -08:00
Arun Agrawal
63069ecf52 call binmode on the tempfile for Ruby 1.8 compatibility 2012-03-01 14:52:29 +05:30
José Valim
3d86727e8f Ensure [] respects the status of the buffer. 2012-02-29 16:22:54 -08:00
Aaron Patterson
0d7a50786b Merge pull request #5207 from kennyj/fix_5173-31
[3-1-stable] Fix type_to_sql with text and limit on mysql/mysql2. Fix GH #3931
2012-02-29 11:53:41 -08:00
kennyj
42592b4338 Fix type_to_sql with text and limit on mysql/mysql2. Fix GH #3931. 2012-02-29 01:51:29 +09:00
Aaron Patterson
47c3cf1f4f Merge pull request #5179 from RalphShnelvar/Binary_mode_Window_bug
Binary mode window bug
2012-02-27 10:11:08 -08:00
Andrew White
5c18b995c1 Detect optional glob params when adding non-greedy regexp - closes #4817. 2012-02-26 00:29:43 +00:00
Noah Hendrix
b5418e7245 Fixed typo in composed_of example with Money#<=>, was comparing amount itself instead of other_money.amount 2012-02-25 21:55:22 +05:30
Justin Woodbridge
e6fca559a1 Fix typo in match :to docs 2012-02-25 21:55:11 +05:30
Santiago Pastorino
d693bd225d Merge pull request #5171 from arunagw/3-1-stable
assert => assert_equal 3-1-stable
2012-02-25 07:51:31 -08:00
Arun Agrawal
6e49b3d006 assert => assert_equal 2012-02-25 21:13:53 +05:30
Xavier Noria
30a528a3aa Merge pull request #5165 from arunagw/build_fix_ruby187-p358-3-1-stable
Build fix ruby187 p358 3 1 stable
2012-02-25 04:26:53 -08:00
Arun Agrawal
406ece4729 fixed build for ruby187-p358 2012-02-25 17:50:47 +05:30
Aaron Patterson
8c677e921a updating RAILS_VERSION 2012-02-22 12:06:09 -08:00
Aaron Patterson
967b300f70 fixing bad merge: adding bind substitution visitor 2012-02-22 11:43:12 -08:00
Aaron Patterson
f290d6f516 prepared statements can be disabled 2012-02-22 10:53:01 -08:00
Aaron Patterson
995d792b56 bumping up arel 2012-02-21 16:13:30 -08:00
Aaron Patterson
79f0a9b642 tag bind params with a bind param object 2012-02-21 15:46:26 -08:00
Aaron Patterson
36c8521ef6 more ruby 2.0 respond_to? changes 2012-02-21 11:38:36 -08:00
Aaron Patterson
00327721e4 ruby 2.0 makes protected methods return false for respond_to, so pass true as the second param 2012-02-21 10:32:23 -08:00
Aaron Patterson
f468d6e94f Merge pull request #5096 from lawso017/master
Restoring ability to derive id/sequence from tables with nonstandard sequences for primary keys
Conflicts:

	activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
	activerecord/test/cases/adapters/postgresql/schema_test.rb
2012-02-21 09:51:47 -08:00
Akira Matsuda
2d4cdb05a5 use AS::SafeBuffer#clone_empty for flushing the output_buffer 2012-02-20 16:16:38 -08:00
Akira Matsuda
baf69031dd add AS::SafeBuffer#clone_empty 2012-02-20 16:16:27 -08:00
Sergey Nartimov
1be2bbec31 fix output safety issue with select options 2012-02-20 15:42:19 -08:00
Aaron Patterson
da7d0a26a1 search private / protected methods in trunk ruby 2012-02-20 11:04:27 -08:00
Andrew White
a7862366ff Remove fixture files with Windows incompatible filenames
Windows doesn't allow `\ / : * ? " < > |` in filenames so create
the fixture files at runtime and ignore the incompatible ones when
running on Windows.
2012-02-20 04:59:59 +00:00
José Valim
03db636652 Merge pull request #5079 from arunagw/fix_assets_test
Fix assets test
2012-02-18 01:42:58 -08:00
Arun Agrawal
7782a70b72 fixed assets test 2012-02-18 15:10:11 +05:30
Andrew White
bea34a7729 Simplify regexp 2012-02-17 14:45:09 +00:00
Andrew White
5fcbb94edc Fix ActionDispatch::Static to serve files with unencoded PCHAR
RFC 3986[1] allows sub-delim characters in path segments unencoded,
however Rack::File requires them to be encoded so we use URI's
unescape method to leave them alone and then escape them again.

Also since the path gets passed to Dir[] we need to escape any glob
characters in the path.

[1]: http://www.ietf.org/rfc/rfc3986.txt
2012-02-17 14:16:45 +00:00
Santiago Pastorino
fd2b275244 Merge pull request #5072 from arunagw/fix_failing_test_ruby187_p358_31stable
Fix failing test ruby187 p358 31stable
2012-02-17 03:54:47 -08:00
Arun Agrawal
0bf4dc82a7 fixed failing test in ruby-1.8.7-p358 2012-02-17 14:47:25 +05:30
Jon Leighton
27357a6965 Merge pull request #4787 from kennyj/fix_4754-2
[Backport][3-1-stable] Fix GH #4754. Remove double-quote characters around PK when using sql_mode=ANSI_QUOTES
2012-01-31 09:56:12 -08:00
kennyj
daa8686ca4 Fix GH #4754. Remove double-quote characters around PK when using sql_mode=ANSI_QUOTES 2012-01-31 20:53:38 +09:00
Aaron Patterson
423241c066 Merge pull request #4514 from brainopia/update_timezone_offets
Update time zone offset information
2012-01-24 11:17:49 -08:00
Paweł Kondzior
5da6b6ed67 Fix ActiveModel::Errors#dup
Since ActiveModel::Errors instance keeps all error messages as hash
we should duplicate this object as well.

Previously ActiveModel::Errors was a subclass of ActiveSupport::OrderedHash,
which results in different behavior on dup, this may result in regression for
people relying on it.

Because Rails 3.2 stills supports Ruby 1.8.7 in order to properly fix this
regression we need to backport #initialize_dup.
2012-01-23 23:01:11 +01:00
Piotr Sarnacki
f34e5a7d4c Add ActiveModel::Errors#delete, which was not available after move to use delegation 2012-01-23 23:01:11 +01:00
Vijay Dev
db9b1a753c Merge pull request #4579 from guilleiguaran/add-js-runtime-to-gemfile
Add therubyracer gem commented in default Gemfile (3.1.x)
2012-01-21 10:45:44 -08:00
Guillermo Iguaran
bd5392c4ae Add therubyracer gem commented in default Gemfile (3.1.x) 2012-01-21 12:58:30 -05:00
Guillermo Iguaran
f407ec5f79 Mention how use config.assets.prefix to avoid conflicting with an existing "/assets" route 2012-01-16 22:15:16 +05:30
José Valim
98ac00c2e9 No AS::TestCase here. 2012-01-13 20:58:00 +01:00
José Valim
d209325050 config.force_ssl should mark the session as secure. 2012-01-13 19:58:10 +01:00
Vijay Dev
a677701729 Merge pull request #4442 from guilleiguaran/3-1-changelogs
Update actionpack changelog in 3-1-stable
2012-01-12 22:39:10 -08:00
Guillermo Iguaran
28b00503c0 Update actionpack Changelog in 3-1-stable 2012-01-12 22:18:31 -05:00
Vijay Dev
18d67f5e58 First attempt at providing a 'what to update' section for Rails 3.1 2012-01-13 00:22:06 +05:30
Santiago Pastorino
16f9511f4c Merge pull request #4418 from tomstuart/read-and-write-attribute-aliases-3-1-stable
#[] and #[]= are no longer interchangeable with #read_attribute and #write_attribute (3-1-stable)
2012-01-12 04:57:03 -08:00
Tom Stuart
f707cda53c Revert "Base#[] and Base#[]= are aliases so implement them as aliases :)"
This reverts commit 21eadc1b3f.
2012-01-12 09:17:24 +00:00
Tom Stuart
cda5094abd Test that #[] and #[]= keep working when #read_attribute and #write_attribute are overridden 2012-01-12 09:14:31 +00:00
Tom Stuart
f22c36bc82 Test ActiveRecord::Base#[]= as well as #write_attribute 2012-01-12 09:14:31 +00:00
Santiago Pastorino
efa215a490 Merge pull request #4412 from kennyj/fix_3743
Fix GH #3743. We must specify an encoding in rdoc_option explicitly.
2012-01-11 15:13:37 -02:00
Piotr Sarnacki
238d80c24c Fix http digest authentication with trailing '/' or '?' (fixes #4038 and #3228) 2012-01-10 04:55:00 +01:00
Piotr Sarnacki
c2af40b679 Add original_fullpath and original_url methods to Request 2012-01-10 04:53:55 +01:00
Piotr Sarnacki
4d872d11b4 Add ORIGINAL_FULLPATH to env
This behaves similarly to REQUEST_URI, but
we need to implement it on our own because
REQUEST_URI is not reliable.

Note that since PATH_INFO does not contain
information about trailing question mark,
this is not 100% accurate, for example
`/foo?` will result in `/foo` in ORIGINAL_FULLPATH
2012-01-10 04:49:31 +01:00
Santiago Pastorino
b7c7f08c87 Pass extensions to javascript_path and stylesheet_path helpers. Closes #3417 2012-01-03 17:52:00 -02:00
José Valim
6d5a27aa6f Override respond_to? since we are also overriding method_missing. 2012-01-03 20:33:14 +01:00
José Valim
8efb9e79d4 Merge pull request #4244 from hsbt/upgrade-rack-dependency
Upgrade rack dependency
2011-12-31 04:02:43 -08:00
SHIBATA Hiroshi
16d4bc7799 upgrade rack-1.3.6 2011-12-31 18:52:54 +09:00
Arun Agrawal
939183ab17 [docs] Added missing "}" fixes #4126 2011-12-24 00:52:46 +05:30
Aaron Patterson
d5389523f4 rack bodies should be a list 2011-12-22 13:10:36 -07:00
Aaron Patterson
3e00e1f6e3 refactoring routing tests
Conflicts:

	actionpack/test/controller/routing_test.rb
2011-12-22 13:05:40 -07:00
Aaron Patterson
040b7946d2 adding tests for #4029 2011-12-20 19:52:33 -07:00
Santiago Pastorino
2ddedac5e6 Merge pull request #4074 from arunagw/doc_fix
doc:rails fixed
2011-12-20 10:57:25 -08:00
Arun Agrawal
41803b2e06 It should be README.rdoc fixes #4067 2011-12-20 23:54:07 +05:30
José Valim
5ca308b08f Merge pull request #4065 from guilleiguaran/fix-railties-tests
Fix railties tests: I broke development.rb template during last merge
2011-12-20 09:52:59 -08:00
Guillermo Iguaran
d54564232a Fix railties tests: I broke development.rb template during last merge 2011-12-20 12:48:43 -05:00
José Valim
c4b13a77d0 Merge pull request #4058 from guilleiguaran/asset-pipeline-fixes
Backport multiple fixes for asset pipeline from master to 3-1-stable
2011-12-20 07:23:06 -08:00
Guillermo Iguaran
c32be813a4 Skip assets groups if --skip-sprockets option is given
Conflicts:

	railties/test/generators/app_generator_test.rb
2011-12-20 10:17:49 -05:00
Piotr Sarnacki
169137fcc6 Clarify the default assets.precompile matcher behavior 2011-12-20 10:15:18 -05:00
Guillermo Iguaran
d7fbd63984 Use ProcessedAsset#pathname in Sprockets helpers when debugging is on. Closes #3333 #3348 #3361.
Is wrong use ProcessedAsset#to_s since it returns the content of the file.
2011-12-20 10:15:11 -05:00
Piotr Sarnacki
80c0517eca Ensure that files that compile to js/css are not compiled by default with rake assets:precompile
This case was not tested and documentation was a bit confusing
on that topic, so it was not obvious if current code
works properly or not.
2011-12-20 10:15:02 -05:00
Guillermo Iguaran
47bef336ec Skip assets options in environments files when --skip-sprockets is used
Conflicts:

	railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt
	railties/test/generators/app_generator_test.rb
2011-12-20 10:14:16 -05:00
Santiago Pastorino
0479789108 Merge pull request #4025 from arunagw/travis_sync
Travis sync
2011-12-19 09:52:24 -08:00
Jon Leighton
b9aabc7f48 Don't notify campfire when the build keeps passing 2011-12-19 08:33:29 +05:30
Sergey Nartimov
9f7fe5d38b backport call scope within unscoped to prevent duplication of where values 2011-12-18 20:42:17 +03:00
Santiago Pastorino
2f7e70187f Add campfire notifications for travis 2011-12-17 13:06:54 -02:00
Jon Leighton
df932c4ae2 Fix #3987.
Conflicts:

	activerecord/lib/active_record/attribute_methods/primary_key.rb
	activerecord/test/cases/primary_keys_test.rb
2011-12-15 13:38:25 +00:00
Xavier Noria
60a91f1411 let sdoc say which version of rdoc we depend on
Conflicts:

	Gemfile
2011-12-14 23:39:55 +01:00
Jon Leighton
b6ae05e67a Fix #3672 again (dependent: delete_all perf)
Conflicts:

	activerecord/lib/active_record/associations/builder/has_many.rb
	activerecord/lib/active_record/associations/has_many_association.rb
2011-12-14 19:24:17 +00:00
Mikhail Dieterle
dced6d6d68 Typo in list 2011-12-14 02:17:48 +05:30
Ryan Sandridge
ed8923577a Replacing vague mention of an unspecified section above with a link to the actual section containing Asset Organization. 2011-12-14 02:17:48 +05:30
Ryan Sandridge
50ac4a3a58 Fixing typo in Routing Guide. 2011-12-14 02:17:48 +05:30
Aaron Patterson
4371be2125 use Array#join so that file encoding doesn't impact returned string.
Fixes #3957
2011-12-12 19:47:25 -08:00
José Valim
25ac7e4607 Merge pull request #3928 from arunagw/fix_template_test
Fix template test
2011-12-10 06:20:36 -08:00
Arun Agrawal
49bbdf29c2 Fix broken encoding test 2011-12-10 19:42:09 +05:30
José Valim
d06c3b3cd2 Merge pull request #3705 from guilleiguaran/3-1-stable-therubyrhino
Added therubyrhino to default Gemfile under JRuby
2011-12-10 02:18:42 -08:00
Guillermo Iguaran
80b1d4d0c5 Add test to verify that therubyrhino isn't included when JRuby isn't used 2011-12-09 21:41:35 -05:00
Aaron Patterson
e568c67b67 load the encoding converter to work around [ruby-core:41556] when switching encodings 2011-12-08 15:12:07 -08:00
Jon Leighton
63293d1bc8 Fix #3890. (Calling proxy_association in scope chain.)
Conflicts:

	activerecord/test/models/post.rb
2011-12-08 20:13:26 +00:00
Vijay Dev
92d24b76e6 fix a bad url 2011-12-09 01:21:00 +05:30
José Valim
4f0ff15968 Remove NilClass whiners feature.
Removing this feature causes boost in performance when using Ruby 1.9.

Ruby 1.9 started to do implicit conversions using `to_ary` and `to_str`
in some STDLIB methods (like Array#join). To do such implicit conversions,
Ruby 1.9 always dispatches the method and rescues the NoMethodError exception
in case one is raised.

Therefore, since the whiners feature defined NilClass#method_missing, such
implicit conversions for nil became much, much slower. In fact, just defining
NilClass#method_missing (even without the whiners feature) already causes a
massive slow down. Here is a snippet that shows such slow down:

    require "benchmark"
    Benchmark.realtime { 1_000.times { [nil,nil,nil].join } }

    class NilClass
      def method_missing(*args)
        raise NoMethodError
      end
    end

    Benchmark.realtime { 1_000.times { [nil,nil,nil].join } }
2011-12-08 20:38:39 +01:00
José Valim
39528548b0 Improve cache on route_key lookup.
Conflicts:

	activemodel/lib/active_model/naming.rb
2011-12-08 20:38:09 +01:00
Xavier Noria
1e001dac84 use our own fork of sdoc while Vijay's fix is not applied to voloko/sdoc 2011-12-08 14:08:36 +01:00
Santiago Pastorino
acfa6c7216 Add CHANGELOG entry 2011-12-06 11:23:58 -02:00
Santiago Pastorino
a2f4ef1d80 Merge pull request #3428 from adrianpike/asset_path_conflicts
Issue #3427 - asset_path_conflicts
2011-12-06 11:19:06 -02:00
kennyj
8d55a6d4e8 Use show create table.
Conflicts:

	activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
2011-12-05 19:10:45 +00:00
Aaron Patterson
47bc206999 Merge pull request #3860 from sumbach/test-return-value-from-require-on-3-1-stable
Test return value from require on 3-1-stable
2011-12-05 09:05:28 -08:00
Sam Umbach
a070dd123c Simplify load and require tests
- These tests don't use autoloading so there's no need to add anything to autoload_paths
2011-12-05 08:55:47 -05:00
Sam Umbach
0f815540e0 Test that require and load raise LoadError if file not found 2011-12-05 08:55:40 -05:00
Sam Umbach
31cead708c Test return value of ActiveSupport::Dependencies::Loadable#load 2011-12-05 08:55:34 -05:00
Sam Umbach
9a780f62a2 Test return value of ActiveSupport::Dependencies::Loadable#require
- Add tests to protect from regressions in require's return value behavior
- See a10606c490 (require needs to return true or false) for the original bug fix
2011-12-05 08:55:27 -05:00
Jon Leighton
d2ab2b0589 Enable postgres on the CI ❤️ 🍺 2011-12-03 20:13:02 +00:00
Jon Leighton
c1e2c1a7dc Avoid postgres 9.X syntax 2011-12-03 20:12:57 +00:00
Jon Jensen
1583dabf66 Restore performance of ERB::Util.html_escape
Revert html_escape to do a single gsub again, but add the "n" flag (no
language, i.e. not multi-byte) to protect against XSS via invalid utf8

Signed-off-by: José Valim <jose.valim@gmail.com>
2011-12-03 10:38:37 +01:00
Leandro Santos
2512192a3e typo in the performance testing rails guide 2011-12-02 23:50:11 +05:30
Richard Hulse
9473f7db22 [docs] removed last-modifed line from examples
This is no longer best-practice.

ref:
http://stackoverflow.com/questions/8344186/rails-3-1-on-apache-pagespeed-says-specify-cache-validator-when-using-asset-p/8348385#8348385
2011-12-02 23:50:11 +05:30
José Valim
7fc91aaa44 Update CHANGELOG. 2011-12-01 13:21:21 +01:00
Jonathan del Strother
0ce562c1f3 Leave default_asset_host_protocol unset
When default_asset_host_protocol is left as nil, it will use absolute protocols when a request is present, and relative protocols otherwise (eg in asset generation)

Signed-off-by: José Valim <jose.valim@gmail.com>
2011-12-01 13:19:38 +01:00
Jon Leighton
6fd9c1d22e don't alter global state in test 2011-11-30 23:56:08 +00:00
Julius de Bruijn
5f27545ef5 If the table behind has no primary key, do not ask again and just return nil.
Conflicts:

	activerecord/test/cases/attribute_methods_test.rb
2011-11-30 23:55:57 +00:00
Arun Agrawal
c6e513bab0 Bump Mysql2! 2011-11-28 12:25:35 +01:00
Uģis Ozols
7f6b1a58ac what's -> that's 2011-11-26 20:19:20 +05:30
Robert Ross
c7da6936af Fix missing single quote that was messing up syntax highlighting. 2011-11-26 20:18:31 +05:30
Alexey Vakhov
7aae61f4aa Small docs fix in Active Model callbacks module 2011-11-26 20:17:29 +05:30
Matt Burke
1506ef0b26 Add config.active_record.identity_map to the configuration guide. 2011-11-26 20:17:13 +05:30
Vijay Dev
cd392fd4da caching 'false' properly 2011-11-22 19:15:25 +05:30
José Valim
3df6c73f9e Merge pull request #3710 from dmathieu/cherry-pick-ssl-config
Cherry pick ssl config
2011-11-21 04:12:42 -08:00
Justin Leitgeb
dcafc768ce Make the Rack::SSL middleware configurable 2011-11-21 12:23:42 +01:00
Guillermo Iguaran
8b8ff9834b Update CHANGELOG with the addition of therubyrhino 2011-11-21 00:35:05 -05:00
Guillermo Iguaran
b710ceacc2 Added therubyrhino to default Gemfile under JRuby 2011-11-21 00:32:34 -05:00
Jon Leighton
e9474c89d9 Preparing for 3.1.3 release 2011-11-20 22:48:20 +00:00
Jon Leighton
36cefec639 Fix sass-rails dependency. Closes #3704. 2011-11-20 22:26:13 +00:00
Jon Leighton
574ed06ba4 Downgrade sprockets to 2.0.3. Closes #3686. 2011-11-20 22:23:40 +00:00
Jon Leighton
cb0c3e45fb Perf fix
If we're deleting all records in an association, don't add a IN(..)
clause to the query.

Fixes #3672.
2011-11-19 14:11:38 +00:00
Jon Leighton
da327fc5d6 Add missing CHANGELOG entry for #3678. Closes #3678. 2011-11-19 13:34:59 +00:00
Jon Leighton
1edef70e49 Don't html-escape the :count option to translate if it's a Numeric. Fixes #3685.
Conflicts:

	actionpack/CHANGELOG.md
2011-11-19 13:29:12 +00:00
Jon Leighton
3b6087e24b Bump sprockets to 2.1.1
Conflicts:

	actionpack/actionpack.gemspec
2011-11-19 13:07:24 +00:00
kennyj
1b2d5461f1 Use show index from. We could fix pk_and_sequence_for method's performance problem (GH #3678) 2011-11-19 13:01:09 +00:00
Jon Leighton
c5197d47d4 Verify that #3690 has been closed by previous changes to the mysql
adapters.

These tests fail on the v3.1.2 tag.

Closes #3690.

Conflicts:

	activerecord/CHANGELOG.md
2011-11-19 12:36:59 +00:00
Jon Leighton
8f4f8db945 Merge branch '3-1-2' into 3-1-stable 2011-11-19 11:09:35 +00:00
Aaron Patterson
9848b47281 fixing my bad merge. doh! 2011-11-18 11:14:24 -08:00
Aaron Patterson
8fedb5fd96 allow people to set a local .Gemfile so that things like ruby-debug are not required for regular development 2011-11-18 11:00:37 -08:00
Vijay Dev
a099116c12 Merge pull request #3682 from sikachu/3-1-stable-fix_test_variable
Update variable's name in the test case to reflect the class we're testing
2011-11-18 09:49:27 -08:00
capps
ae4974a5ec "denoted" instead of "donated"
"parentheses" instead of "use brackets"
2011-11-18 23:15:53 +05:30
Philip Arndt
b7fe7c3584 Fixed typo: expect -> expected 2011-11-18 23:15:53 +05:30
Aaron Patterson
a31a805ce8 Merge pull request #3683 from christos/schema_introspection_speedup
Only used detailed schema introspection when doing a schema dump.
Conflicts:

	activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
2011-11-18 09:44:45 -08:00
Prem Sichanugrist
fc44737457 Update variable's name in the test case to reflect the class we're testing 2011-11-18 11:52:38 -05:00
Jon Leighton
0e6b118313 Preparing for 3.1.2 release 2011-11-18 01:27:59 +00:00
lest
2d5b105d4b _html translation should escape interpolated arguments 2011-11-17 23:08:33 +00:00
lest
1b527d7985 _html translation should escape interpolated arguments 2011-11-17 23:08:10 +00:00
José Valim
78f649ee8a Merge pull request #3665 from wildchild/label_i18n_3-1-stable
Fix impractical I18n lookup in nested fields_for (3-1-stable)
2011-11-17 15:09:02 -08:00
Xavier Noria
3bcb2472e4 Revert "warn the user values are directly interpolated into _html translation strings"
Reason: After another round of discussion, it has been
decided to let interpolation deal with unsafe strings
as it should do.

This reverts commit d57d8098fc.
2011-11-18 00:01:29 +01:00
Xavier Noria
eb46afa593 warn the user values are directly interpolated into _html translation strings 2011-11-17 23:07:43 +01:00
Alexander Uvarov
1d8c5769e3 Fix impractical I18n lookup in nested fields_for 2011-11-17 21:55:04 +06:00
Jon Leighton
6f08621941 Switch from marshal format to plain text for the encoding conversions dump. This is for windows compatibility. Fixes #3644. 2011-11-16 21:37:29 +00:00
Jon Leighton
f754f3daf7 Switch from marshal format to plain text for the encoding conversions dump. This is for windows compatibility. Fixes #3644. 2011-11-16 21:37:22 +00:00
Jon Leighton
17c84c52c1 Merge pull request #3633 from Juanmcuello/3-1-stable
Backport #3232 to 3-1-stable
2011-11-15 14:39:13 -08:00
Jon Leighton
ffd1519600 Merge pull request #3633 from Juanmcuello/3-1-stable
Backport #3232 to 3-1-stable
2011-11-15 22:39:12 +00:00
Juan M. Cuello
b02daec718 Backport #3232 to 3-1-stable.
Use the schema_search_path in prepared statements in postgres.

Only the tests are backported, the fix was already included by
commit 818d285305.
2011-11-15 10:20:32 -03:00
Jon Leighton
5ea132b7fa rake release should push the tag 2011-11-14 16:51:39 +00:00
Jon Leighton
798a3c1a8c rake release should push the tag 2011-11-14 16:51:17 +00:00
Jon Leighton
e29f27ad76 Preparing for 3.1.2.rc2 release 2011-11-14 15:44:50 +00:00
Jon Leighton
4847cbe58e Put sass-rails 3.1.5.rc.2 in the default Gemfile.
Otherwise there will be dependency conflicts with sprockets.
2011-11-14 15:26:38 +00:00
Jon Leighton
307a9e20a7 Put sass-rails 3.1.5.rc.2 in the default Gemfile.
Otherwise there will be dependency conflicts with sprockets.
2011-11-14 15:25:34 +00:00
Jon Leighton
68ed8eae30 Preparing for 3.1.2.rc1 release 2011-11-14 14:12:59 +00:00
Jon Leighton
0d78459253 Merge pull request #3625 from guilleiguaran/sprockets-2.1.0
Upgrade Sprockets to 2.1.0
Conflicts:

	actionpack/actionpack.gemspec
2011-11-14 12:22:59 +00:00
Jon Leighton
e6d8ed57bb Add missing CHANGELOG entries 2011-11-14 11:20:49 +00:00
Jon Leighton
e52dc331d1 Revert "Properly cache value when it is "false""
This reverts commit 551f313405.

Reason: see
https://github.com/rails/rails/pull/2010#issuecomment-2725865
2011-11-14 01:44:32 +00:00
Alexey Vakhov
b015d92bb7 Cosmetic fix in number_to_currency docs 2011-11-13 22:32:00 +05:30
Jean Boussier
c27c783a60 Fix a tiny typo in custom validators documentation 2011-11-13 22:32:00 +05:30
Sebi Burkhard
551f313405 Properly cache value when it is "false" 2011-11-12 23:36:22 +05:30
Vijay Dev
e7ec79d03f Merge pull request #3576 from arunagw/changelog_changelog_md
Changelog changelog md
2011-11-08 22:10:45 -08:00
Arun Agrawal
a0676b6882 CHANGELOG to CHANGELOG.md 2011-11-09 10:04:46 +05:30
Joost Baaij
1c61365f8e Replace example with SQL placeholder syntax.
This works just fine, is less code, and reduces the risk of someone implementing a SQL injection vulnerability.
2011-11-08 21:50:30 +05:30
Alexey Vakhov
cd14cbd780 Fix small typo in link_to_function doc 2011-11-08 21:50:27 +05:30
Akira Matsuda
23ca708732 document fix: remove_column takes multiple column_names 2011-11-08 21:50:24 +05:30
Akira Matsuda
510e49b280 self.up, self.down => up, down 2011-11-08 21:50:20 +05:30
Dalibor Nasevic
df43c98153 Fixed stale doc in AbstractController::Layouts 2011-11-08 21:50:15 +05:30
José Valim
dbecc52170 Merge pull request #3561 from bfolkens/3-1-stable-url_subdomain_with_numeric_host
3 1 stable url subdomain with numeric host
2011-11-08 06:00:29 -08:00
Bradford Folkens
0fdcd5449e Fixed ' and ' should be ' && ' 2011-11-08 07:27:42 -06:00
Bradford Folkens
92955d0053 Fix trouble using :subdomain in development environment when using numeric addresses.
Otherwise the following occurs:

TypeError: can't convert nil into String
    /Users/bfolkens/dev/bfolkens-rails-core/actionpack/lib/action_dispatch/http/url.rb:75:in host_or_subdomain_and_domain'
    /Users/bfolkens/dev/bfolkens-rails-core/actionpack/lib/action_dispatch/http/url.rb:37:in url_for'
    /Users/bfolkens/dev/bfolkens-rails-core/actionpack/lib/action_dispatch/routing/url_for.rb:147:in test_subdomain_may_be_accepted_with_numeric_host'
    /Users/bfolkens/dev/bfolkens-rails-core/activesupport/lib/active_support/testing/setup_and_teardown.rb:67:in run'
    /Users/bfolkens/dev/bfolkens-rails-core/activesupport/lib/active_support/callbacks.rb:426:in send'
    /Users/bfolkens/dev/bfolkens-rails-core/activesupport/lib/active_support/callbacks.rb:81:in run'
2011-11-07 23:23:36 -06:00
Alexey Vakhov
12df79c201 Docs cosmetic fixes in Action View form_helper.rb 2011-11-06 22:09:17 +05:30
Aaron Patterson
a0184038e0 Merge pull request #3521 from nulogy/fix_postgres_adapter_to_handle_spaces_between_schemas
Fix postgres adapter to handle spaces between schemas
2011-11-06 08:15:34 -08:00
Jon Leighton
eef46795ad RUBY_ENGINE is not defined on 1.8 2011-11-06 10:55:07 +00:00
Jon Leighton
83e9446077 Implement a workaround for a bug in ruby-1.9.3p0.
The bug is that an error would be raised while attempting to convert a
template from one encoding to another.

Please see http://redmine.ruby-lang.org/issues/5564 for more details.

The workaround is to load all conversions into memory ahead of time,
and will only happen if the ruby version is *exactly* 1.9.3p0. The
hope is obviously that the underlying problem will be resolved in
the next patchlevel release of 1.9.3.

Conflicts:

	actionpack/CHANGELOG.md
2011-11-06 10:41:59 +00:00
Jon Leighton
311a21b44f Merge pull request #3533 from kennyj/fix_3440-2
Barckport to 3-1-stable: fixed an issue id false option is ignored on mysql/mysql2 (fix #3440)
2011-11-06 01:23:56 -08:00
kennyj
fb73423370 Barckport to 3-1-stable: fixed an issue id false option is ignored on mysql/mysql2 (fix #3440) 2011-11-06 03:28:14 +09:00
Vijay Dev
3cd33ea612 Fixed after_initialize/after_find guide
Defining after_initialize and after_find as ordinary methods like
documented in the guide doesn't work with Rails 3.1.1; now macro-style
is used here, too.

Conflicted while cherry picking from master (Original Author: Florian Walch)
2011-11-05 20:59:46 +05:30
Alexey Vakhov
64122c7ce9 Fix javascript_include_tag examples in documentation 2011-11-05 20:51:37 +05:30
Henrik Hodne
d753596df9 Added bundle exec to rake test.
This is in response to rails/rails#3504.
2011-11-05 20:51:37 +05:30
Ryan Bigg
8261230f70 [config guide] mention that config methods are to be called on Railtie subclasses 2011-11-05 20:51:32 +05:30
Alexey Vakhov
740655c497 Fix typo in constraints method documentation 2011-11-05 20:51:32 +05:30
Alexey Vakhov
1389ebfe2f Update routing guides, root route should be at the top of the file 2011-11-05 20:51:27 +05:30
Xavier Noria
194d7a4db9 Merge pull request #3528 from arunagw/doc_fix
Doc fix
2011-11-05 02:34:40 -07:00
Arun Agrawal
eb5391cce7 Doc Fix It should be :git not :path in Gmefile Fix #3527 2011-11-05 12:46:12 +05:30
Sean Kirby
58f2fbc2ad fixes bug with PostgreSQLAdapter#indexes
When the search path has multiple schemas, spaces were not being stripped
from the schema names after the first.
2011-11-04 12:33:25 -04:00
Jon Leighton
e3ba0723d8 Merge pull request #3518 from cesario/gemspec-3-1-stable
Resynchronizing the gemspecs
2011-11-04 07:06:19 -07:00
Franck Verrot
fbc2fdee22 Synchronize the gemspecs since CHANGELOG has been renamed to CHANGELOG.md
(cherry picked from commit 1679aa56f3)
2011-11-04 15:01:35 +01:00
Franck Verrot
09811a08ff Add the MIT-LICENSE to the Active Support gemspec
(cherry picked from commit 4633772a12)
2011-11-04 15:01:29 +01:00
Franck Verrot
04c15b7f79 Add the MIT-LICENSE to the Active Resource gemspec
(cherry picked from commit 85283f0592)
2011-11-04 15:01:15 +01:00
Franck Verrot
e3609d6edd Add the MIT-LICENSE to the Active Record gemspec
(cherry picked from commit 64d977359d)
2011-11-04 15:01:03 +01:00
Jon Leighton
43486e0ca1 Convert CHANGELOGs to Markdown format.
Reasons:

 * Markdown reads well as plain text, but can also be formatted.
 * It will make it easier for people to read on the web as Github
   formats the Markdown nicely.
 * It will encourage a level of consistency when people are writing
   CHANGELOG entries.

The script used to perform the conversion is at
https://gist.github.com/1339263
2011-11-04 13:00:59 +00:00
Jeremy Kemper
bd56b5a6f0 Merge pull request #3507 from jmazzi/issue-3503
Preserve SELECT columns on the COUNT for finder_sql when possible
2011-11-03 21:14:51 -07:00
Justin Mazzi
bad2d6fdaf Preserve SELECT columns on the COUNT for finder_sql when possible.
Pull request #3503
2011-11-03 21:15:23 -04:00
Jon Leighton
75ae4b3492 Stub find_template so that when handle_render_error is called in ActionView::Template, we get to see the actual underlying error rather than a NoMethodError.
This shows an encoding bug on Ruby 1.9.3.
2011-11-03 19:08:52 +00:00
Jon Leighton
d5e63b1a01 Fix #3271.
Building the conditions of a nested through association could
potentially modify the conditions of the through and/or source
association.

This is a Bad Thing.

Conflicts:

	activerecord/test/cases/reflection_test.rb
2011-11-03 15:12:47 +00:00
Jon Leighton
e8ce2a5291 Remove all revelant through records.
If a record is removed from a has_many :through, all of the join records
relating to that record should also be removed from the through
association's target.

(Previously the records were removed in the database, but only one was
removed from the in-memory target array.)
2011-11-03 13:13:53 +00:00
Jon Leighton
175c02d630 Fix adding multiple instances of the same record to a has_many :through.
Fixes #3425.
2011-11-03 12:39:16 +00:00
Jon Leighton
01eae34d58 Fix #3247.
Fixes creating records in a through association with a polymorphic source
type.

Conflicts:

	activerecord/CHANGELOG
2011-11-03 10:27:08 +00:00
Jeremy Kemper
7c36934f4f Revert "Disable 1.9.3 builds until upgraded from -preview1 to -rc1"
This reverts commit a1fb214ff0.
2011-11-01 17:42:45 -07:00
Santiago Pastorino
816f0b691d Merge pull request #1796 from jdeseno/master
link_to doesn't allow rel attribute when also specifying method
2011-11-01 01:09:55 -02:00
Aaron Patterson
8e6f86e298 this should never return nil, so no use for "try" 2011-10-31 15:17:50 -04:00
Christopher Meiklejohn
b23cd21c2d Ensure that the format isn't applied twice to the cache key, else it becomes impossible to target with expire_action. 2011-10-31 15:17:46 -04:00
mjy
58b0d507d3 Adds missing closing regex slashes. 2011-10-30 14:52:24 +05:30
Henare Degan
0275946067 Fix a little typo 2011-10-30 14:52:24 +05:30
Bruce Adams
1acb0eba6e note that after_initialize is run for rake tasks 2011-10-30 14:52:24 +05:30
Santiago Pastorino
aa34ab7c47 Merge pull request #3463 from kennyj/fix_document_for_cache
fix a document for race_condition_ttl. ActiveSupport::Cache::MemoryCache isn't exist.
2011-10-29 22:53:28 -02:00
Jeremy Kemper
5275b5d910 Removing db/seeds.rb is fine. Don't blow up. 2011-10-29 14:14:27 -07:00
Aaron Patterson
74fbbca2f8 clear statement cache when tables are altered 2011-10-27 10:57:08 -07:00
Joe Van Dyk
931775234a Added failing test case for changing schema in migration not clearing the prepared statement cache 2011-10-27 10:57:03 -07:00
Vijay Dev
c90a1d2d36 minor fixes in the composed_of doc 2011-10-26 20:20:12 +05:30
bradrobertson
26b9e71b64 correct documentation on initialize method to accept a single parameter 2011-10-26 20:18:46 +05:30
Vijay Dev
203230404d Merge pull request #3409 from guilleiguaran/lock-turn-version
Lock turn version to 0.8.2 if Ruby version is 1.9.2
2011-10-22 13:55:18 -07:00
Guillermo Iguaran
6f7d4ae453 Lock turn version to 0.8.2 if Ruby version is 1.9.2 2011-10-22 15:45:28 -05:00
Prem Sichanugrist
8ce3ff3ccc Add some note on adding index to HABTM table 2011-10-23 01:40:20 +05:30
Prem Sichanugrist
d04406935a Use new migration style in HABTM join table
Yes, we're on Rails 3.1 now.
2011-10-23 01:40:14 +05:30
Pepe Hipolito
8203338864 Fixed typo.
Ruby will know to look for this file at => Ruby will know how to look for this file at
2011-10-23 01:40:09 +05:30
Pepe Hipolito
3063afaaec Fixed typo.
a long the way => along the way
2011-10-23 01:40:05 +05:30
Arun Agrawal
ebe64f8e32 No need to check ruby version here
As rake 0.9.2.2 is out with the same
fix as 0.9.3.beta having
2011-10-22 11:22:30 -07:00
Vijay Dev
e6b9db537e Merge pull request #3403 from arunagw/rack_doc_update
middleware doc updated
2011-10-22 04:47:29 -07:00
Arun Agrawal
7cd54484c7 rake about information updated for 3.1 branch 2011-10-22 16:01:20 +05:30
Alexey Vakhov
d103161018 HTMl -> HTML: html scanner comment fix 2011-10-20 23:28:45 +05:30
Pascal Lindelauf
9bc6a4e1bb Clarified that the config.assets.initialize_on_precompile directive needs to be set in application.rb 2011-10-20 23:28:45 +05:30
Andy Lindeman
2ab011af80 Fixes the defaults for config.cache_classes 2011-10-20 23:28:45 +05:30
Martin Svalin
195fcd2896 Fixed misleading docs for String#to_formatted_s(:db) 2011-10-20 23:28:44 +05:30
Aaron Patterson
88ac481b46 Merge pull request #3258 from ileitch/3-1-stable
Postgres: Do not attempt to deallocate a statement if the connection is no longer active.
2011-10-20 08:44:55 -07:00
Jeremy Kemper
960882f946 Use toplevel Rack::ContentLength 2011-10-19 12:31:14 -05:00
Santiago Pastorino
97b3d10808 Use again Rack's ContentLength middleware 2011-10-18 16:26:37 -02:00
José Valim
a5d3b903a6 Update actionpack/CHANGELOG 2011-10-18 21:25:35 +03:00
Aaron Patterson
818d285305 reset prepared statement when schema changes imapact statement results. fixes #3335 2011-10-18 11:19:42 -07:00
Diego Carrion
dd27e2eec8 improved ActiveResource's .element_path and .new_element_path methods documentation by specifing how .site should be declared in order to use prefix_options 2011-10-14 22:29:45 +05:30
Steve Bourne
840246c157 change activerecord query conditions example to avoid 'type' as column name
'Type' is a reserved column for STI.  Changed conditions example to
avoid using that column name as an example.  The example isn't
STI-related (and mentioning STI here is needless clutter), so changing
to avoid accidentally encouraging users to use 'type' as a column name
for other purposes.
2011-10-14 22:29:44 +05:30
Akira Matsuda
a27f6ec150 status is a number in Rails 3 2011-10-14 22:29:44 +05:30
Stephen Pike
2a73d00f4b Runtime conditions for associations should use procs
The association guide previously recommended using a trick with single
quote delaying of string interpolation in order to handle setting association
conditions that would be evaluated at runtime. Using a proc is the new way as
this no longer works.
2011-10-14 22:29:44 +05:30
Evgeniy Dolzhenko
78bab03804 Use .add instead of << to add errors 2011-10-14 22:29:44 +05:30
RAHUL CHAUDHARI
077dffa571 Fixed typos in active_support_core_extensions.textile 2011-10-14 22:29:44 +05:30
Alexey Vakhov
b33625478e Add ActionController#head example 2011-10-14 22:29:44 +05:30
José Valim
4cdc31c53a Add some implementation docs. closes #3298. closes #2509. 2011-10-12 09:24:13 +02:00
Bruno Zanchet
4d986c4a10 swallow error when can't unmarshall object from session
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-10-12 09:21:42 +02:00
José Valim
86a5271e74 Provide failing test case for #3298 #2509 2011-10-12 09:21:33 +02:00
José Valim
f23f5ec6cd Fix wrong identation and remove extra spaces. 2011-10-12 09:01:00 +02:00
Ryan Bigg
1b6886adbb Fix rails/generators/base.rb documentation for generator lookup 2011-10-10 19:45:25 +05:30
Dan McDonald
5bf183cdd9 ActiveRecordStore is now called SessionStore. 2011-10-10 19:44:11 +05:30
Santiago Pastorino
df03e1d34a Add 3.1.1 release date 2011-10-09 17:32:29 -02:00
Roy Tomeij
b2858e6026 Fix a typo that was mysteriously entered in previous commit 2011-10-09 20:13:10 +05:30
Roy Tomeij
0834102442 Add note about how Sass & Sprockets don't match 2011-10-09 20:13:10 +05:30
Alexey Vakhov
4805a657c1 Fix params hash example in AC::Base comment 2011-10-09 20:13:10 +05:30
Guillermo Iguaran
09bb9de6a5 Isolate rake action tests that should be run under default env 2011-10-08 14:56:24 -07:00
Guillermo Iguaran
e63c05fc03 Test utf8 assets filenames with request instead of manifest lookup 2011-10-08 13:29:48 -07:00
Jeremy Kemper
e0513757ea The generator invokes rake with either the :env option, ENV['RAILS_ENV'], or development. So if Travis has exported RAILS_ENV=test, it'll be used instead of development, breaking these brittle expectations. 2011-10-08 13:26:47 -07:00
Jeremy Kemper
5d183461c0 Skip broken asset precompilation test on Macs. Issues with NFD vs NFC normalization on the asset filename. Major red flag with asset lookups! 2011-10-08 13:26:44 -07:00
Jeremy Kemper
51550edd19 Don't notify IRC on every single build, just failures and first success after a string of failures 2011-10-08 11:14:32 -07:00
Jeremy Kemper
a1fb214ff0 Disable 1.9.3 builds until upgraded from -preview1 to -rc1 2011-10-08 11:14:31 -07:00
Ian Leitch
fc55fa7a14 Postgres: Do not attempt to deallocate a statement if the connection is no longer active. 2011-10-08 18:06:18 +01:00
Jeremy Kemper
7319f146c3 Add comments to our generated .gitignore, including a note about when to use a global gitignore. Remove .sass-cache since we use /tmp/sass-cache, which is already ignored. 2011-10-08 08:04:33 -07:00
Santiago Pastorino
f03556b366 Revert "Merge pull request #3255 from arunagw/app_gitignore_sqlnet_log_3-1-stable"
This reverts commit d12af7a703, reversing
changes made to 8199b99049.
2011-10-08 12:56:55 -02:00
Santiago Pastorino
d12af7a703 Merge pull request #3255 from arunagw/app_gitignore_sqlnet_log_3-1-stable
App gitignore sqlnet log 3 1 stable
2011-10-08 05:47:37 -07:00
Arun Agrawal
d11769c56e Sqlnet.log should also be ignored into the app gitignore 2011-10-08 14:44:29 +05:30
José Valim
8199b99049 Merge pull request #3253 from arunagw/gitignore_sqlnet_file
Gitignore sqlnet file
2011-10-08 02:06:59 -07:00
Arun Agrawal
574a25d373 Sqlnet.log should be ignored 2011-10-08 14:27:38 +05:30
José Valim
5d624e379f Merge pull request #3248 from arunagw/query_cache_test_fix_3-1-stable
Query cache test fix 3 1 stable
2011-10-08 01:18:15 -07:00
Arun Agrawal
b5439b45f4 Fixed BodyProxy.new for tests! 2011-10-08 09:58:28 +05:30
Vijay Dev
e74067340f fix bad formatting in the assets guide 2011-10-08 02:24:00 +05:30
José Valim
e424906eb7 testing.rake should set the default task, closes #2564 2011-10-07 22:25:57 +02:00
clay shentrup
39c7b6309d Clarifying ambiguous description of require_self in the asset pipeline 2011-10-07 22:24:11 +05:30
Nick Quaranto
9e5b4f359f use Rails.root.join for assets guide 2011-10-07 22:23:33 +05:30
Santiago Pastorino
b992f529e8 Merge pull request #3243 from mjtko/connection-pool-thread-fix
QueryCache/ConnectionPool thread fix (was #1670)
2011-10-07 14:03:54 -02:00
Santiago Pastorino
ba708126d8 Bumping to 3.1.1 2011-10-07 13:13:42 -02:00
Xavier Noria
be6527f63a asset pipeline guide: removes Apache config for serving pre-compressed assets, and expands the information about nginx support for this
A robust Apache configuration for this feature seems to be tricky,
one that takes into account Accept-Encoding, sets Vary, ensures
Content-Type is right, etc.
2011-10-07 15:05:46 +02:00
Vijay Dev
7bf12a1bb5 fix a space in the assets guide 2011-10-06 20:06:56 +05:30
OZAWA Sakuro
c57aec50ef Support data: url scheme in asset paths. 2011-10-06 23:35:04 +09:00
Xavier Noria
05386cec4f Merge branch '3-1-stable' of github.com:rails/rails into 3-1-stable 2011-10-06 16:22:49 +02:00
Xavier Noria
471e1f1147 revises the precompilation section of the asset pipeline guide (web server configuration for gzipped assets pending) 2011-10-06 16:22:40 +02:00
Jared Mehle
7f60202f03 Quoted path to <Rails.env>_structure.sql file in db:test:clone_structure task.
Leaving the path unquoted causes errors in paths containing spaces or dashes.
2011-10-06 19:35:46 +05:30
Yasuo Honda
f40bbc94e1 Fixed test_nonexisting_method_with_arguments to revert commit 29a5aea
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-10-06 13:56:25 +02:00
Santiago Pastorino
57a01f337e Bumping to 3.1.1.rc3 2011-10-05 22:00:08 -02:00
Santiago Pastorino
162e13d941 Add missing CHANGELOG entried 2011-10-05 21:42:59 -02:00
José Valim
3c6cbad8c8 Revert "don't raise NoMethodError the tried method doesn't exists"
This reverts commit 29a5aeaae9.
2011-10-06 00:33:56 +02:00
Jon Leighton
f8beca00dc Raise an exception on unknown primary key inside AssociationReflection.
An association between two models cannot be made if a relevant key is
unknown, so fail fast rather than generating invalid SQL. Fixes #3207.
2011-10-05 20:24:45 +01:00
Santiago Pastorino
4f2c238f3a stylesheet_link_tag('/stylesheets/application') and similar helpers doesn't throw Sprockets::FileOutsidePaths exception anymore 2011-10-05 15:42:25 -02:00
Alexey Vakhov
cf4d166271 missed underscore in AV::TestCase helper_method documentation 2011-10-05 18:49:33 +05:30
Uģis Ozols
14e2fe200a Class name specified in example is Person, not AttributePerson. 2011-10-05 18:49:29 +05:30
José Valim
fc9b52173c Merge pull request #3230 from amatsuda/string_prepend_31
ruby193: String#prepend for 3-1-stable
2011-10-05 01:16:21 -07:00
Akira Matsuda
aa11f7332c ruby193: String#prepend is also unsafe 2011-10-05 16:48:41 +09:00
Akira Matsuda
9257a21f7a override unsafe methods only if defined on String 2011-10-05 16:46:56 +09:00
José Valim
c6d13b6320 Fix regression when calling helpers inside sprockets. 2011-10-05 09:35:31 +02:00
José Valim
d9d1bb2fb9 Fix the lame config.action_controller.present? check scattered throughout assets_path. 2011-10-05 02:28:40 +02:00
José Valim
db8db4a466 Ensure default_asset_host_protocol is respected, closes #2980. 2011-10-05 02:07:25 +02:00
José Valim
188d21c1ee Encapsulate common rake invocation logic in a method. 2011-10-05 01:17:04 +02:00
José Valim
0ad504000e Merge pull request #3225 from mjtko/assets-compilation-refactoring-the-sequel
assets rake task refactoring work - the sequel
2011-10-04 16:04:08 -07:00
Mark J. Titorenko
871cbae6e4 added comment about why nondigest assets requires a reinvocation 2011-10-04 23:27:53 +01:00
Mark J. Titorenko
45cdb3ea9d only reinvoke if necessary 2011-10-04 23:27:29 +01:00
Mark J. Titorenko
20173e2682 only execute the nondigest task if needed 2011-10-04 23:22:51 +01:00
Mark J. Titorenko
bbdb7f3258 don't munge the environment, let rake do that for us 2011-10-04 23:10:11 +01:00
Mark J. Titorenko
63bab287ec assets compilation task refactoring 2011-10-04 23:05:01 +01:00
José Valim
4bc6e2f8a7 Fix failing test added in previous commit. 2011-10-04 22:03:59 +02:00
José Valim
306123b56a Merge pull request #3221 from mjtko/asset-tests
Failing test for assets:clean task issue
2011-10-04 12:57:46 -07:00
Mark J. Titorenko
a5eca91793 correct path used in "digested assets are not mistakenly removed" test 2011-10-04 19:02:28 +01:00
Mark J. Titorenko
8093e38423 add failing test: "digested assets are removed from configured path" 2011-10-04 19:02:06 +01:00
Santiago Pastorino
8bf761f0d1 Bump sprockets to 2.0.2 2011-10-04 14:16:39 -02:00
José Valim
360b8c4c52 Fix failing tests and refactor assets.rake 2011-10-04 11:24:22 +02:00
José Valim
9d349914dd Merge pull request #3208 from Empact/patch-1
Change rake db:schema:dump to load schema dumper extensions such as those used by foreigner and spatial_adapter
2011-10-04 01:44:09 -07:00
Ben Woosley
e41bd38ce6 Changing rake db:schema:dump to run :environment as well as :load_config, as running :load_config alone will lead to the dumper being run without including extensions such as those included in foreigner and spatial_adapter.
This reverses a change made here: 5df72a238e (L0L324)

I'm assuming here that :load_config needs to be invoked separately from :environment, as it is elsewhere in the file for db operations, if not the alternative is to go back to "task :dump => :environment do".
2011-10-03 22:24:45 -07:00
Brendan Ribera
3530afaa00 Require rack-cache 1.1.
Versions prior to 1.1 delete the If-Modified-Since and If-Not-Modified headers when
config.action_controller.perform_caching is true. This has two problems:
 * unexpected inconsistent behaviour between development & production environments
 * breaks applications that use of these headers

Signed-off-by: José Valim <jose.valim@gmail.com>
2011-10-03 21:35:32 +02:00
Brendan Ribera
9533ff05fd Test demonstrating #3053: If-Modified-Since gets swallowed up by rack-cache.
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-10-03 21:35:22 +02:00
Jeremy Kemper
5a9e79b724 Merge pull request #2801 from jeremyevans/patch-1
Fix obviously breakage of Time.=== for Time subclasses
2011-10-03 10:54:31 -07:00
José Valim
2db49c55e9 Fix #3198. 2011-10-03 17:31:11 +02:00
Mark J. Titorenko
6b1e4a265f add failing test for #3198
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-10-03 17:30:39 +02:00
José Valim
7e03ace6ab Merge pull request #3192 from spohlenz/precompile-enhancement-fix
Fix regression in assets:precompile task when task is enhanced
2011-10-03 02:07:58 -07:00
Sam Pohlenz
a6614c5de6 Ensure that enhancements to assets:precompile task are only run once 2011-10-03 16:06:04 +10:30
Sam Pohlenz
29c2fc3643 Replace calls to capture(:stdout) with quietly in assets tests 2011-10-03 16:05:05 +10:30
José Valim
41cbd1556f Update sass and coffee dependencies to latest. 2011-10-02 22:13:43 +02:00
José Valim
ee8a37c734 :group => :assets should only run in the assets environment. 2011-10-02 22:09:13 +02:00
Xavier Noria
d94aa10918 rewords the docs of config.assets.initialize_on_precompile in the asset pipeline guide 2011-10-02 12:33:29 -07:00
Xavier Noria
27ec2d38d8 documents config.assets.initialize_on_precompile in the asset pipeline guide 2011-10-02 11:35:41 -07:00
Santiago Pastorino
d2219c5165 Precompile properly refers files referenced with asset_path test 2011-10-02 13:58:03 -02:00
Santiago Pastorino
e6156cbf70 capture was commented out 2011-10-02 13:58:02 -02:00
José Valim
258fe7d051 Provide initialize_on_precompile which, when set to false, does not initialize the app for precompilation. Defaults to true. 2011-10-02 12:14:31 +02:00
José Valim
f63b1dee65 TestCase should respect the view_assigns API instead of pulling variables on its own. 2011-10-02 11:33:12 +02:00
Philippe Huibonhoa
ef9cf3d46a Improved testing so that it tests the real functionality and not the private method.
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-10-02 11:32:37 +02:00
Philippe Huibonhoa
5986d9b362 Added fix so that file store does not raise an exception when cache dir does not exist yet. This can happen if a delete_matched is called before anything is saved in the cache.
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-10-02 11:32:20 +02:00
José Valim
581173dcb8 Merge pull request #3186 from arunagw/void_context_warnings_removed_3-1-stable
Void context warnings removed 3 1 stable
2011-10-01 04:59:00 -07:00
Arun Agrawal
32df5b6813 Warning Use of :: in void context Warning removed 2011-10-01 14:31:59 +05:30
Santiago Pastorino
aead5720d7 Bumping to 3.1.1.rc2 2011-09-29 17:11:55 -03:00
Santiago Pastorino
8aee03b625 Add CHANGELOG entries 2011-09-29 16:07:59 -03:00
Jon Leighton
45c56bdd2d Don't call self.class unless necessary. Closes #3171. 2011-09-29 18:00:48 +01:00
Santiago Pastorino
85f8458e1b Fix tests in 1.8.7 2011-09-28 23:16:57 -03:00
Santiago Pastorino
7e2de385fe javascript_path and stylesheet_path should honor the asset pipelining 2011-09-28 20:13:56 -03:00
Santiago Pastorino
00f0fb84aa Merge pull request #3156 from ihower/enhance_button_to_helper_v2
Make button_to helper support "form" option
2011-09-28 19:39:33 -03:00
Xavier Noria
05f0c41002 partial pass over the assets guide 2011-09-28 13:48:23 -07:00
45north
8df638de0d Fixed markup error. 2011-09-28 23:57:09 +05:30
Vijay Dev
d76b79b59f fixing typo in assets guide 2011-09-28 13:36:07 +05:30
Santiago Pastorino
d6c333cec7 Merge pull request #3150 from avakhov/patch-html-sanitizer-cqi-require
add missing require to html sanitizer
2011-09-27 23:32:38 -03:00
Xavier Noria
76cd9c0b3c the infamous detail only spotted in GitHub diffs no matter how careful you were before pushing 2011-09-27 13:55:58 -07:00
Xavier Noria
7ebae1260a partial pass over the asset pipeline 2011-09-27 13:50:49 -07:00
Diego Plentz
0cebbf4e50 fixing docs for delete_sql where quotes should be used in this example. 2011-09-28 00:09:49 +05:30
Nicolás Hock Isaza
0b151a49e0 Alert about the new Bundler require for asset gems
If you are coming from a Rails 3.0 application, you won't have
the correct Bundler require statement.

This will cause the gems under the `assets` group not to be available
in the development and production environment.

I think this is related to the issue #39 in rails-sass
https://github.com/rails/sass-rails/issues/39
2011-09-28 00:09:43 +05:30
Alexey Vakhov
e9de9e2667 update ActionMailer example using last truncate helper method signature 2011-09-28 00:09:37 +05:30
Alexey Vakhov
ef0f6ced1a fix ActionMailer readme example 2011-09-28 00:09:31 +05:30
Xavier Noria
9f080e4822 partial pass over the asset pipeline guide 2011-09-26 18:18:52 -07:00
Jon Leighton
75e97a4888 Don't require a DB connection when setting primary key.
Closes #2807.
2011-09-26 18:16:19 +01:00
Santiago Pastorino
493077cdc0 Merge pull request #3138 from christos/correct_image_path_with_pipeline
Correctly override image_path in sprockets rails_helper
2011-09-26 14:02:34 -03:00
Santiago Pastorino
b703cdbb64 Merge pull request #3136 from guilleiguaran/clear-digests-on-precompile
Avoid use of existing precompiled assets during rake assets:precompile run
2011-09-26 09:56:38 -07:00
Santiago Pastorino
6ba472c8b8 Copy assets to nondigested filenames too 2011-09-26 13:55:40 -03:00
Guillermo Iguaran
b605bd5f1b Avoid use of existing precompiled assets during rake assets:precompile run. Closes #3119 2011-09-26 10:55:47 -05:00
Jon Leighton
ecf55847e5 Add CHANGELOG 2011-09-26 16:51:49 +01:00
Jon Leighton
5767609e8e Merge pull request #3030 from htanata/fix_habtm_select_query_method
Fix: habtm doesn't respect select query method
2011-09-26 08:45:53 -07:00
Santiago Pastorino
ceb56f3e5a Just assert_equal here 2011-09-26 12:21:24 -03:00
Santiago Pastorino
7e43dee857 Merge pull request #3135 from christos/respect_assets_digest_value
Give precedence to `config.digest = false` over the existence of manifest.yml asset digests
2011-09-26 12:17:02 -03:00
Jon Leighton
d25bee451d Forgot CHANGELOG entry. 2011-09-26 15:44:32 +01:00
Jon Leighton
4aeb7f2eb7 Fix belongs_to polymorphic with custom primary key on target.
Closes #3104.
2011-09-26 15:43:04 +01:00
José Valim
ef7de0cf24 Encapsulate assets initialization in its own rake task. 2011-09-26 16:30:36 +02:00
Santiago Pastorino
0cb84f18d6 image_tag should use /assets if asset pipelining is turned on. Closes #3126 2011-09-26 11:21:30 -03:00
Jon Leighton
6c5295f473 Add deprecation for the preload_associations method. Fixes #3022. 2011-09-26 14:15:09 +01:00
Vijay Dev
7d603ff7f2 remove stray line 2011-09-26 16:24:01 +05:30
Jon Leighton
2d7dd9b1e4 CollectionProxy#replace should change the DB records rather than just mutating the array. Fixes #3020.
Conflicts:

	activerecord/test/cases/associations/has_many_associations_test.rb
2011-09-26 10:44:42 +01:00
Alexey Vakhov
a61d85c49e escape options for the stylesheet_link_tag method
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-09-25 13:05:11 +02:00
Santiago Pastorino
42c2b24ae7 Merge pull request #3123 from avakhov/patch-5-remove-superfluous-to-s
remove superfluous to_s in ERB::Util.html_escape
2011-09-24 18:23:11 -03:00
Santiago Pastorino
6cb0d35463 Merge pull request #3121 from cablegram/3-1-stable
Re-launch assets:precompile task using (Rake.)ruby instead of Kernel.exec so it works on Windows
2011-09-24 14:18:01 -07:00
Santiago Pastorino
3200cd072e Revert "Make process reuse the env var passed as argument"
This reverts commit 0e4748cd41.
2011-09-24 17:22:29 -03:00
cablegram
21f1e45ed1 Re-launch assets:precompile task using (Rake.)ruby instead of Kernel.exec so it works on Windows
The Kernel.exec method launches the current program ($0) after setting some environment variables.  This current ruby script has a shebang line and no .rb in its name. Launching a script this way does not work on Windows. By using the +ruby+ method that is included in Rake, we can launch the current script with the current ruby version and bypass the identified Windows issue.
2011-09-24 13:17:50 -05:00
José Valim
7f8f1f3fad Fix spacing on Gemfile. 2011-09-24 03:09:35 +02:00
José Valim
253c0bcb54 Avoid using pathnames and automatically create the manifest directory if one does not exist yet. 2011-09-24 03:05:36 +02:00
José Valim
0a4b8fb7f4 Add test for belongs_to? and group initializers. 2011-09-24 02:40:02 +02:00
José Valim
2a688677b0 Remove the ENV flag, yagni. 2011-09-24 02:15:18 +02:00
José Valim
b4798894d3 rake assets:precompile loads the application but does not initialize it.
To the app developer, this means configuration add in
config/initializers/* will not be executed.

Plugins developers need to special case their initializers that are
meant to be run in the assets group by adding :group => :assets.
2011-09-24 02:00:41 +02:00
Santiago Pastorino
f64a352265 Merge pull request #3115 from guilleiguaran/refactor-rails-helpers
Remove Sprockets compute_public_path, AV compute_plubic_path can be used
2011-09-23 16:08:59 -03:00
Santiago Pastorino
d4f999fba7 Merge pull request #3092 from asee/master
Sprockets to use config.assets.prefix, with tests
2011-09-23 14:16:01 -03:00
José Valim
9eb628ad65 Merge pull request #3103 from hone/precompile_flag
set env to let rails and co. (read gems) know we're precompiling
2011-09-22 11:46:39 -07:00
Terence Lee
d123489a31 set env to let rails know we're precompiling 2011-09-22 13:24:41 -05:00
José Valim
710a284de7 Merge pull request #3102 from hone/3-1-stable
Bump sqlite3 in Gemfile to 1.3.4
2011-09-22 10:49:44 -07:00
Terence Lee
16b8fdee52 AR wants sqlite3 1.3.4 2011-09-22 12:33:48 -05:00
Santiago Pastorino
1b780ccc47 No need to create a range object 2011-09-22 14:16:57 -03:00
Santiago Pastorino
52edadfa2b Merge pull request #3096 from phuibonhoa/master
FileStore key_file_path does not properly limit filenames to 255 characters
2011-09-22 14:05:17 -03:00
Pawel Pierzchala
d87921318c Fix named routes modifying arguments
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-09-22 17:14:10 +02:00
Santiago Pastorino
49584b20aa Merge pull request #3027 from alex3/assets-precompile-regex-fix
Default precompile regex was erroneously matching files
2011-09-21 22:28:37 -03:00
Santiago Pastorino
40a574ff16 Merge pull request #3081 from guilleiguaran/move-precompile-to-class
Move precompiling from task to Sprockets::StaticCompiler
2011-09-21 21:22:27 -03:00
Santiago Pastorino
ed96ee5246 Add jquery-rails to Gemfile of plugins, test/dummy app uses it.
Closes #3091
2011-09-21 20:53:46 -03:00
Vijay Dev
03d30635df copy edits 302e5707 2011-09-21 19:42:19 +05:30
Vijay Dev
caf42a8342 copy edits 908f2616 2011-09-21 19:42:19 +05:30
Vijay Dev
f2894042f2 remove unnecessary markup 2011-09-21 19:42:19 +05:30
Jan Vlnas
5deb664010 Locale code for Czech is ":cs" 2011-09-21 19:42:19 +05:30
Ryan Bigg
c7ed6f303e Document ActiveRecord::QueryMethods#select 2011-09-21 19:42:19 +05:30
Uģis Ozols
a8501c1f98 sass-rails helpers - hyphenated in Sass, underscored in Ruby. 2011-09-21 19:42:14 +05:30
Vijay Dev
cde34fb46a Fixing incorrect notextile tags 2011-09-21 19:42:13 +05:30
Vijay Dev
e3b1d9a4e1 minor edit 2011-09-21 19:42:13 +05:30
Kir Shatrov
68671509ed "Passing variables into the translation" section added 2011-09-21 19:42:13 +05:30
Guillermo Iguaran
ce758e2e26 Add reference about --skip-sprockets to Asset Pipeline Guide 2011-09-21 19:42:13 +05:30
Alexey Vakhov
bcbc484b13 update guides, use html safe translations in i18n 2011-09-21 19:42:06 +05:30
Santiago Pastorino
4e379954f4 Merge pull request #3065 from brainopia/fix_to_param_test
Fix test to reflect use of to_param for keys
2011-09-21 01:00:35 -03:00
Santiago Pastorino
af4645481a Merge pull request #3060 from arunagw/query_cache_test_3-1-stable
Query cache test 3 1 stable
2011-09-19 12:45:54 -07:00
Arun Agrawal
2d4ac4fd56 fixed test for JRuby.
for Sqlite3 in AR-JDBC.It's Jdbc::SQLite3::VERSION
2011-09-18 23:23:14 +05:30
Santiago Pastorino
081d41ab26 Merge pull request #3049 from brainopia/fix_to_query_edge_case
Fix Hash#to_query edge case with html_safe string on 1.8 ruby
2011-09-17 17:16:12 -07:00
Santiago Pastorino
df97bf5c95 Merge pull request #3056 from arunagw/arjdbc_bump
Arjdbc bump
2011-09-17 17:11:56 -07:00
Arun Agrawal
4d2089c742 Bump AR-JDBC version.
THis version is compatible with 3.1 and above
2011-09-17 18:37:00 +05:30
Andrew White
12d4514982 Revert "Fixed Apache configuration for gzipped assets: FilesMatch and LocationMatch cannot be nested."
This reverts commit 99f59f9be4.
2011-09-17 07:26:35 +01:00
Marcus Ilgner
99f59f9be4 Fixed Apache configuration for gzipped assets: FilesMatch and LocationMatch cannot be nested.
(cherry picked from commit 5e2bf4de62)

Signed-off-by: Andrew White <andyw@pixeltrix.co.uk>
2011-09-17 07:20:31 +01:00
Santiago Pastorino
12a7dc4d63 Proper lines numbers for stack trace info 2011-09-16 17:30:41 -07:00
José Valim
6dae0ab2fe Merge pull request #3040 from guilleiguaran/asset-host-should-not-be-nil-precompile
config.action_controller.asset_host shouldn't set to nil during precompile
2011-09-16 07:29:21 -07:00
Jon Leighton
06b5182b35 Merge pull request #3036 from dmathieu/cherry-pick-1318
Cherry pick 1318
2011-09-15 13:15:09 -07:00
Damien Mathieu
5b20d4c918 cherry-pick #1318 into 3-1-stable 2011-09-15 22:01:23 +02:00
Hendy Tanata
8dd39685bb Fix: habtm doesn't respect select query method.
Patch for issue #2923.
2011-09-15 19:27:19 +08:00
Santiago Pastorino
3f9665be11 Bumping up to 3.1.1.rc1 2011-09-14 16:25:12 -07:00
Santiago Pastorino
ae6c5552d7 Add some CHANGELOG missing stuff 2011-09-14 16:25:01 -07:00
Santiago Pastorino
64de4dd84a Allow asset tag helper methods to accept :digest => false option in order to completely avoid the digest generation. 2011-09-14 15:02:41 -07:00
Ben Walding
9a2fa218de Add equivalent nginx configuration 2011-09-15 01:48:44 +05:30
Jaime Iniesta
e20d7616a1 Fix typos and broken link on asset pipeline guide 2011-09-15 01:48:35 +05:30
José Valim
499ea5162a Merge pull request #3015 from guilleiguaran/clear-tmp-cache-on-precompile
Clear cache before of each precompile to avoid inconsistencies. Fixes #3014
2011-09-14 09:24:01 -07:00
Santiago Pastorino
511070f624 Merge pull request #3012 from guilleiguaran/3-1-1-changelogs
Add missing changelog entries for actionpack
2011-09-14 01:00:21 -07:00
Santiago Pastorino
f85cd49f9c Revert "Provide a way to access to assets without using the digest, useful for static files and emails"
This reverts commit 82afaa0686.
2011-09-14 00:29:42 -07:00
Santiago Pastorino
058593dd35 Merge pull request #3011 from guilleiguaran/disable-sprockets-server
Don't mount Sprockets if config.assets.compile is disabled
2011-09-13 16:42:23 -07:00
Santiago Pastorino
65cf784674 Provide a way to access to assets without using the digest, useful for static files and emails 2011-09-13 15:19:22 -07:00
Aaron Patterson
7ee8be507b Merge pull request #2922 from wayneeseguin/master
Include ActiveRecord SQLServer Adapter by @metaskills in new application generator.
2011-09-13 09:46:39 -07:00
dharmatech
f74a4d80b0 getting_started.textile: Fix typo and split up a sentence in section "Building a Multi-Model Form" 2011-09-13 18:56:31 +05:30
dharmatech
fbde94a5a4 getting_started.textile: Fix typos in section "Rendering a Partial Form" 2011-09-13 18:55:08 +05:30
Semyon Perepelitsa
e66dd14b93 Fix a typo in date 2011-09-13 18:54:54 +05:30
Alan Zeino
c3751a415f Slight change to reflect current 'destroy' code generated by scaffold in 3.1 release. 2011-09-13 18:54:35 +05:30
Mike Gunderloy
4e4783fe29 Fix typo 2011-09-13 18:53:11 +05:30
Vijay Dev
59ba0ddc42 Delete contribute.textile now that its contents are merged to the contributing_to_ruby_on_rails guide 2011-09-13 18:52:09 +05:30
Vijay Dev
01378f3031 change GH issue tracker url 2011-09-13 18:52:09 +05:30
Vijay Dev
330d426d98 merged the contribution guides and changed the
link in the layout accordingly
2011-09-13 18:52:09 +05:30
Santiago Pastorino
a244ad4ceb Fix asset_path relative_url_root method 2011-09-13 02:45:35 -07:00
Santiago Pastorino
874e012b97 Merge pull request #3001 from guilleiguaran/fix-assets-precompile-host-test
Fix precompile asset_host test
2011-09-13 02:43:14 -07:00
Santiago Pastorino
bb9368724d Merge pull request #3000 from guilleiguaran/fix-relative-url-root
Fix for relative url root in assets
2011-09-13 02:30:01 -07:00
Santiago Pastorino
ecf38fe1c8 Merge pull request #2997 from guilleiguaran/move-assets-test-3-1-stable
Backport e767cda (move assets tests to assets_test file) to 3-1-stable
2011-09-13 01:48:15 -07:00
Guillermo Iguaran
3d042fa78d Backport e767cda6ea (move assets tests to assets_test file) 2011-09-13 03:35:33 -05:00
Santiago Pastorino
f79fac5029 always rewrite_relative_url_root 2011-09-13 00:29:28 -07:00
Santiago Pastorino
c289dea8a2 Merge pull request #2977 from guilleiguaran/fix-relative-root-in-assets 2011-09-13 00:14:21 -07:00
Santiago Pastorino
8c3f6f6b75 Merge pull request #2987 from kennyj/master 2011-09-12 23:06:21 -07:00
Santiago Pastorino
79509a2837 Merge pull request #2988 from guilleiguaran/remove-extra-line
Remove odd asignation
2011-09-12 11:50:45 -07:00
Santiago Pastorino
7e26ab188f Merge pull request #2985 from kennyj/master
fix https://github.com/rails/rails/issues/2582 (with testcase)
2011-09-12 10:22:16 -07:00
John Mileham
184d8a2bb5 ActiveResource shouldn't rely on the presence of Content-Length 2011-09-12 18:15:43 +01:00
José Valim
a29910587e Remove rails executable from the gemspec. 2011-09-12 09:01:40 -07:00
José Valim
91f549bf5d Revert "Copy the bin to railties so it also works if you don't have the rails gem."
This reverts commit 20db68701a.
2011-09-12 08:56:35 -07:00
José Valim
112c73046e Merge pull request #2983 from sikachu/3-1-stable-hash-backported
Issue #636 - Parsing an xml file with multiple records and extra attribut
2011-09-12 08:05:55 -07:00
Sidu Ponnappa
981f0762a3 Issue #636 - Parsing an xml file with multiple records and extra attributes (besides type) fails 2011-09-12 17:37:09 +07:00
Santiago Pastorino
90cd0242ff Merge pull request #2936 from joelmoss/migration_status
db:migrate:status not looking at all migration paths
2011-09-11 17:05:16 -07:00
Santiago Pastorino
96d63e1ad7 Merge pull request #2969 from arunagw/warnings_removed_3_1_stable
Warnings removed 3 1 stable
2011-09-11 11:35:17 -07:00
Emin Hasanov
df761ba80c Fix typo in "must-revalidate" header name 2011-09-11 17:52:56 +05:30
Andy Lindeman
b9c66fa0aa Fix for :instance_reader => false code example 2011-09-11 17:52:56 +05:30
Michael P Laing
04767d178b Update to conform to rails 3.1 generated caode 2011-09-11 17:52:56 +05:30
Vijay Dev
06ed2485bf some copy-edits 2011-09-11 17:52:56 +05:30
dharmatech
fbcff812a6 getting_started.textile section 6: Correct file names in table 2011-09-11 17:52:56 +05:30
Xavier Noria
a7998dcfe9 clarify that documentation bugs have to be reported as Rails issues. [Closes #2858] 2011-09-10 19:30:23 +02:00
Santiago Pastorino
c0775c6df7 Merge pull request #2970 from deepakprasanna/master
Added a case to check the status of the migration after a rollback and redo.
2011-09-10 13:21:40 -03:00
Santiago Pastorino
f8c4519760 Merge pull request #2967 from arunagw/add_missing_assert
Add missing assert
2011-09-10 09:17:13 -07:00
Arun Agrawal
1ca38c6681 Warnings removed unused variables. Please don't add them 2011-09-10 13:03:46 +05:30
Arun Agrawal
38c7a670d2 Adding assert for "test_form_for_with_isolated_namespaced_model" 2011-09-10 12:25:13 +05:30
Santiago Pastorino
7317f6c3d4 Merge pull request #2957 from waseem/migration_status_tests
Tests for rake db:migrate:status.
2011-09-10 01:59:18 -03:00
Santiago Pastorino
082f53a3bc Merge pull request #2876 from alex3/patch-1
Fixed assets precompile regex
2011-09-10 01:57:13 -03:00
Jon Leighton
562277bcf0 Remove failing test which was wrongly introduced.
This test was introduced in pull request #2577. The author of the pull
request included the test, which was originally in #2230, at the same
time as fixing a separate (but related) bug. However, the author did not
include a fix for this test, so when #2577 was merged, a failing test
was introduced.

So I am removing the failing test for now. If anyone wants to fix the
bug, please do so and submit a complete pull request with a test and
a fix.
2011-09-08 22:29:00 +01:00
Joel Moss
dffd058c69 db:migrate:status correctly uses ActiveRecord::Migrator.migrations_paths instead of only the apps db/migrate directory, which will include engine migrations. 2011-09-08 16:15:03 +01:00
Vijay Dev
5ed3e6a61f copy edit assets guide 2011-09-08 18:16:29 +05:30
Ryan Walker
fa6bfce178 Added note about adding a javascript runtime to Gemfile for production environment. 2011-09-08 18:16:20 +05:30
Marcus Ilgner
ac60460ea5 Fixed Apache configuration for gzipped assets: FilesMatch and LocationMatch cannot be nested. 2011-09-08 18:16:06 +05:30
Uģis Ozols
7e587c27f7 Change hyphen to underscore. 2011-09-08 18:15:56 +05:30
Guillermo Iguaran
8461804829 Add reference about "bundle install --without assets" in Precompiling Assets section. 2011-09-08 18:15:46 +05:30
Guillermo Iguaran
abb0af197c Add CoffeeScript example to JavaScript and ERB section 2011-09-08 18:15:06 +05:30
Guillermo Iguaran
2451a686af Add JavaScript and ERB section to Asset Guide 2011-09-08 18:14:46 +05:30
Aaron Patterson
b92a025022 LRU cache in mysql and sqlite are now per-process caches. 2011-09-07 15:28:41 -07:00
Aaron Patterson
24b3783da1 fixing file name 2011-09-07 15:28:10 -07:00
Aaron Patterson
77e0bdda17 LRU should cache per process in postgresql. fixes #1339 2011-09-07 15:28:05 -07:00
Jon Leighton
866303d086 Merge pull request #2926 from akaspick/assert_select_email_fix_3_1
assert_select_email fix for 3-1-stable
2011-09-07 15:24:54 -07:00
Andrew Kaspick
954543efc5 assert_select_email fix entry 2011-09-07 17:16:55 -05:00
Andrew Kaspick
05d4d8b9a2 fix assert_select_email to work on non-multipart emails as well as converting the Mail::Body to a string to prevent errors. 2011-09-07 17:15:58 -05:00
Santiago Pastorino
6a18262b4b Merge pull request #2921 from akaspick/exists_fix_3_1
fix exists? to return false if passed nil (backport to 3-1-stable)
2011-09-07 13:32:05 -07:00
Andrew Kaspick
8f2f39ba90 entry for fixing exists? 2011-09-07 15:48:26 -05:00
Andrew Kaspick
44a5849cfb fix exists? to return false if passed nil (which may come from a missing URL param) 2011-09-07 15:47:08 -05:00
Aaron Patterson
76993f685e use the supplied bind values 2011-09-07 10:30:30 -07:00
Aaron Patterson
a6178c32e3 Merge commit 'refs/pull/2909/head' of https://github.com/rails/rails into rawr
* https://github.com/rails/rails:
  Postgresql adapter: added current_schema check for table_exists?
  Postgresql adapter: added current_schema check for table_exists?
2011-09-07 10:24:25 -07:00
Aaron Patterson
4a2e619a1a Merge pull request #2913 from toolmantim/3-1-stable
Make sure require_tzinfo only calls Kernel#require if TZInfo isn't already present
2011-09-07 09:10:47 -07:00
Tim Lucas
d6d474032a Make sure require_tzinfo only calls Kernel#require if TZInfo isn't already present.
This wasn't a problem when require_tzinfo was only called from TimeZone#initialize, but now it's being called for every lookup to TimeZone.[] (via lazy_zones_map)

TimeZone lookup can occur when unmarshalling TimeWithZone objects, which is where I first saw the big slowdown (500ms for each Rails action that loaded from Rails.cache)
2011-09-07 15:02:59 +02:00
Santiago Pastorino
759f3e506e Merge pull request #2904 from guilleiguaran/refactor-assets-tests
Refactor assets tests to use add_to_config
2011-09-07 10:02:36 -03:00
Jon Leighton
df21e3d7f7 Don't include any of includes, preload, joins, eager_load in the through association scope. 2011-09-07 09:28:48 +01:00
Kym
6a14b01802 Postgresql adapter: added current_schema check for table_exists? 2011-09-07 17:02:34 +10:00
Kym
81a19c48c6 Postgresql adapter: added current_schema check for table_exists? 2011-09-07 16:51:43 +10:00
Aaron Patterson
9198c7a486 Merge pull request #2897 from rsutphin/ar31-remove_connection
Patch for issue #2820
2011-09-06 17:43:14 -07:00
Aaron Patterson
4263a7983c updating changelog 2011-09-06 17:26:06 -07:00
Aaron Patterson
9959233e24 Eliminate newlines in basic auth. fixes #2882 2011-09-06 17:25:30 -07:00
Aaron Patterson
de03d4f604 updating changelog with pool limit 2011-09-06 17:02:29 -07:00
Aaron Patterson
7c04e16785 Database adapters use a statement pool.
Database adapters use a statement pool for limiting the number of open
prepared statments on the database.  The limit defaults to 1000, but can
be adjusted in your database config by changing 'statement_limit'.
2011-09-06 17:01:20 -07:00
Aaron Patterson
b37112ff2e adding a statement pool for mysql and sqlite3 2011-09-06 16:59:37 -07:00
Rhett Sutphin
c5af3a6759 Completely remove the pool when removing a connection. Fixes #2820. 2011-09-06 14:57:35 -05:00
Santiago Pastorino
699b83a2e0 Merge pull request #2577 from rails-noob/master
Fix double slash at start of paths when mounting an engine at the root.
2011-09-06 13:11:14 -03:00
Santiago Pastorino
a22701ea80 Merge pull request #2889 from guilleiguaran/perform-caching-assets
config.action_controller.perform_caching isn't used anymore in asset pipeline
2011-09-06 13:04:20 -03:00
Jon Leighton
d4b9829a05 Nested through associations: preloads from the default scope of a through model should not be included in the association scope. (We're already excluding includes.) Fixes #2834. 2011-09-06 16:40:06 +01:00
Jon Leighton
a48e332f7b Ensure we are not comparing a string with a symbol in HasManyAssociation#inverse_updates_counter_cache?. Fixes #2755, where a counter cache could be decremented twice as far as it was supposed to be. 2011-09-06 16:06:43 +01:00
Jon Leighton
b8d46924e7 Use broken YAML that will fail with Syck as well as Psych. Fixes test_broken_yaml_exception in fixtures_test.rb on Ruby 1.8.7. 2011-09-06 13:46:01 +01:00
Jon Leighton
bf2779298b Disable active record marshalling tests on Ruby 1.8.7 on Travis CI, as they have been failing intermittently for a long while due to what appears to be a Ruby bug. If anyone has the skills/expertise/time to debug this, please speak to the Travis guys. 2011-09-06 11:45:20 +01:00
Damien Mathieu
679a4ebf1b #first doesn't take an order in this test 2011-09-06 10:58:06 +01:00
Jon Leighton
431d76636c Add CHANGELOG entry for 78c896ce83 2011-09-06 10:55:41 +01:00
Santiago Pastorino
b949fdeecd Bump uglifier up 2011-09-05 20:34:11 -03:00
Santiago Pastorino
10f2c01758 Merge pull request #2870 from arunagw/uglifier_bump
Uglifier bump
2011-09-05 20:11:37 -03:00
Santiago Pastorino
d194397d1e Merge pull request #2877 from dmathieu/fix_tests_pg_18
Last orders the records by id
2011-09-05 19:42:44 -03:00
Aaron Patterson
c33b7c42c8 Merge pull request #2716 from jbbarth/fix_invert_rename_index
Fix bad options order in AR::Migration::CommandRecorder#invert_rename_index
2011-09-05 14:18:37 -07:00
Georg Friedrich
78c896ce83 Don't find belongs_to target when the foreign_key is NULL. Fixes #2828 2011-09-05 14:00:31 -07:00
Santiago Pastorino
a7f55324b9 Merge pull request #2874 from sikachu/3-1-stable-extractable_ordered_hash
Make `ActiveSupport::OrderedHash` extractable when using `Array#extract_options!`
2011-09-05 07:23:38 -07:00
Prem Sichanugrist
d1a27013fc Make ActiveSupport::OrderedHash extractable when using Array#extract_options!
`ActiveSupport::OrderedHash` is actually a subclass of the hash, so it does make sense that it should be extractable from the array list.
2011-09-05 21:13:39 +07:00
Jon Leighton
76d3b47642 Merge pull request #2871 from dmathieu/limit-3-1-stable
Backport #2789 to 3-1-stable
2011-09-05 07:12:21 -07:00
Santiago Pastorino
4b39d4d0f9 Merge pull request #2873 from guilleiguaran/remove-unused-config
Remove unused config variable from test.rb template
2011-09-05 11:09:39 -03:00
Damien Mathieu
327fa94cb5 Backport #2789 and add changelog entry 2011-09-05 15:59:26 +02:00
Santiago Pastorino
a2baf03d8a Merge pull request #2799 from tomstuart/3-1-stable
Never return stored content from content_for when a block is given
2011-09-05 06:10:12 -07:00
Jon Leighton
0b7a1f822d Merge pull request #2867 from arunagw/batches_test_pg_3-1-stable
Need to make sure about order here.
2011-09-05 00:23:17 -07:00
Arun Agrawal
1b1bd6c0c8 Sort here to make sure the order is ok. 2011-09-05 12:46:38 +05:30
Santiago Pastorino
1458ada551 Merge pull request #2861 from guilleiguaran/assets-fix-changelog
Add entry about Asset behaviour fix to ActionPack ChangeLog
2011-09-04 23:02:37 -03:00
Santiago Pastorino
3250c7f50c Merge pull request #2860 from guilleiguaran/fix-assets-behavior
Fix AssetNotPrecompiledError behavior
2011-09-04 19:42:00 -03:00
Santiago Pastorino
ba130042bd * is not allowed in windows file names. Closes #2574 #2847 2011-09-04 17:45:34 -03:00
Jon Leighton
6abb8c95f9 Merge pull request #2854 from arunagw/find_in_batches_changelog
Find in batches changelog
2011-09-04 13:38:39 -07:00
Arun Agrawal
c0f73be805 Changelog updated for find_in_batches fix. 2011-09-05 00:07:51 +05:30
Jon Leighton
6be4debc30 Merge pull request #2850 from arunagw/find_in_batch_fix
Find in batch fix
2011-09-04 11:28:46 -07:00
Arun Agrawal
e8761b34b0 We need to recorder here. Need to drop the order from default scope.
Fixes #2832
2011-09-04 23:45:50 +05:30
Vijay Dev
9ef943c34d minor fixes in assets guide 2011-09-04 19:05:04 +05:30
Vijay Dev
c0b73b5a0f add some missing dots in the docs 2011-09-04 19:04:24 +05:30
Jon Leighton
df3360f05b Merge pull request #2849 from arunagw/jruby_activesupport_fix_3-1-stable
Jruby activesupport fix 3 1 stable for JRuby
2011-09-04 03:11:13 -07:00
Arun Agrawal
5df885e59d We can't simply check the first line of the
backtrace, because JRuby reports the call 
to __send__ in the backtrace.

In JRuby first is "org/jruby/RubyKernel.java"
2011-09-04 15:29:01 +05:30
Jon Leighton
000fee7658 Merge pull request #2846 from arunagw/bcrypt_3-1-stable
Bcrypt 3 1 stable
2011-09-04 01:47:54 -07:00
Arun Agrawal
8be13b5b55 require bcrypt to pass the test 2011-09-04 09:32:15 +05:30
Santiago Pastorino
04c25a7f00 Remove useless parens 2011-09-04 00:25:04 -03:00
Santiago Pastorino
4fa403cee9 Merge pull request #2843 from arunagw/warnings_removed_for_test_3-1-stable
Warnings removed for test 3 1 stable
2011-09-03 20:17:04 -07:00
Arun Agrawal
f397ced82a stop circular require warnings 2011-09-04 08:41:50 +05:30
Arun Agrawal
98599284a5 Modified content in guides and comments
for "assert /" warnings.
Removed because if somebody will use this code 
they will get warnings!
2011-09-04 08:10:48 +05:30
Arun Agrawal
009a0f87a7 Warnings removed for "assert_match /" Please do
not add more.!
2011-09-04 08:09:13 +05:30
Arun Agrawal
2a959d8fbe Warnings removed for unused variables.
Warnings removed for using shadow variable.
2011-09-04 08:08:22 +05:30
Xavier Noria
45f0dc4187 restores the API docs of AR::Fixtures, made a quick pass over them, revises link in fixture template [closes #2840]
Conflicts:

	activerecord/lib/active_record/fixtures.rb
2011-09-03 15:23:05 -07:00
Santiago Pastorino
caec291566 Merge pull request #2835 from guilleiguaran/actionpack-changelog
Include ticket numbers in AP CHANGELOG
2011-09-03 15:12:48 -07:00
Guillermo Iguaran
ba753851a9 Review config.assets options. 2011-09-04 03:31:23 +05:30
Richard Hulse
ce5b559398 Added new asset config options to guides 2011-09-04 03:30:43 +05:30
Guillermo Iguaran
d3b7c34484 Include ticket numbers in CHANGELOG 2011-09-03 16:04:00 -05:00
Aaron Patterson
459e62ae20 Merge pull request #2826 from guilleiguaran/changelog-remove-bcrypt
Changelog entry about remove of bcrypt as hard dependency on ActiveModel
2011-09-03 10:52:06 -07:00
Guillermo Iguaran
0a6de72222 Add entry about bcrypt-ruby remove to ActiveModel changelog 2011-09-03 12:35:09 -05:00
Aaron Patterson
b7a62f2edf Merge pull request #2825 from guilleiguaran/bcrypt-ruby-comments
Add comments about bcrypt-ruby gem to SecurePassword and add it to default Gemfile
2011-09-03 10:14:33 -07:00
Aaron Patterson
66754c4666 Merge pull request #2829 from arunagw/pg_min_fix
pg does not allow aliases in the having clause, but functions are fine
2011-09-03 10:04:17 -07:00
Aaron Patterson
e835aa05d7 Merge pull request #2831 from arunagw/pg_abstract_class_fix
Fixed test for 3-1-stable. Abstract class is having nil class name.
2011-09-03 10:03:35 -07:00
Arun Agrawal
891d0d7981 We need to check here for the table name.
Abstract classes are having nil class name.
So nil.gsub will give a error here.
2011-09-03 17:26:20 +05:30
Vijay Dev
e491444d60 Merge pull request #2830 from arunagw/warning_removed_3-1-stable
Warning removed 3 1 stable
2011-09-03 04:00:05 -07:00
Arun Agrawal
df01e2e48a Warning removed. 2011-09-03 16:13:43 +05:30
Arun Agrawal
e7eba93d82 pg does not allow aliases in the having clause, but functions are fine 2011-09-03 16:01:53 +05:30
Xavier Noria
e7ee2a916f syncs asset pipeline guide with master 2011-09-03 01:39:28 +02:00
Guillermo Iguaran
2b15762384 Remove hard dependency on bcrypt. 2011-09-02 10:02:11 -07:00
Jon Leighton
c0ae44c5b9 Add missing CHANGELOG entry. Closes #2791. 2011-09-02 08:55:47 +01:00
Aaron Patterson
e6fd4ed314 preserve the backtrace of the exception 2011-09-01 15:24:16 -07:00
Aaron Patterson
e46c4f1c12 * Psych errors with poor yaml formatting are proxied. Fixes #2645, #2731 2011-09-01 15:00:31 -07:00
Aaron Patterson
3afa90d47b make sure encoding_aware? is available 2011-09-01 14:06:20 -07:00
Aaron Patterson
af7c9b9cef CookieJar is enumerable. fixes #2795 2011-09-01 13:37:33 -07:00
Tom Stuart
f49faeb705 Never return stored content from content_for when a block is given
The capture helper may return nil when evaluation of the block has
produced a buffer which contains only whitespace, but that doesn't
mean content_for should return stored content.
2011-09-01 15:06:15 +01:00
Tom Stuart
b14902150b Improve content_for test coverage 2011-09-01 15:05:20 +01:00
José Valim
8b049a152f Merge pull request #2782 from spohlenz/precompile-without-digests
assets:precompile should not append asset digests when config.assets.digest is false
2011-09-01 01:29:24 -07:00
Sam Pohlenz
a5619c0a8d assets:precompile should not append asset digests when config.assets.digest is false 2011-09-01 17:31:52 +09:30
José Valim
9bfaef04f6 Merge pull request #2785 from spohlenz/extract-asset-paths-config
Remove explicit references to Rails.application.config from AssetPaths in Sprockets helper
2011-09-01 00:47:06 -07:00
José Valim
6ba9aa78b0 Merge pull request #2784 from guilleiguaran/changelog-3-1-1
Add missing changelog entries for 3.1.1
2011-09-01 00:40:36 -07:00
Sam Pohlenz
6bc6978e2a Move references to Rails.application.config out of Sprockets AssetPaths 2011-09-01 14:59:16 +09:30
Guillermo Iguaran
08f46b6eac Add missing changelog entries for 3.1.1 2011-09-01 00:14:01 -05:00
Santiago Pastorino
c2a323d9ac Merge pull request #2780 from guilleiguaran/assets-pipeline-minor-changes
Assets pipeline: fix in manifest location and remove unused code
2011-08-31 18:50:38 -07:00
Guillermo Iguaran
e7a86b9027 Remove deprecated code used only in Sprockets < 2.0.0.beta.15 2011-08-31 18:46:29 -05:00
Guillermo Iguaran
a4b7363858 Manifest should be nil by default. Closes #2776 2011-08-31 18:46:08 -05:00
Xavier Noria
c45ce6e71c Merge pull request #2779 from kirs/3-1-stable
Nginx and Apache configs to serve precompiled gzip assets were added to Asset Pipeline Guide
2011-08-31 15:56:19 -07:00
Kir
3fb0579d38 Instructions for nginx and apache added 2011-09-01 02:37:54 +04:00
Vijay Dev
d3d2ceaf0f doc fixes 2011-09-01 03:47:13 +05:30
Richard Hulse
8bb9bb245c Add section to pipeline docs to help people upgrading
These are the options from a brand new app, and
should help people get it right when upgrading.
2011-08-31 14:30:56 -07:00
David Heinemeier Hansson
15b75b4a9e Merge pull request #2607 from guilleiguaran/add-rbenv-gitignore
Add .rbenv-version to .gitignore
2011-08-31 13:15:54 -03:00
Aaron Patterson
8812807eb6 Merge branch '3-1-stable' of github.com:rails/rails into 3-1-stable
* '3-1-stable' of github.com:rails/rails:
  Always enable digest and compile in the Rake task
  don't need edgeapi now that we are on 3.1
  release notes: adds a couple of blank lines to get the markup right
  adds the release notes of 3.1 to the index
  Update Assets guide to reflect all the new changes
  Revert "Ruby 1.8.7+ provides to_date/to_datetime, AS just makes them public." to support date implementations without private to_date/to_datetime on Time (home_run).
2011-08-31 08:30:15 -07:00
José Valim
d6a00780dc Merge pull request #2768 from guilleiguaran/fix-assets-rake-task
Always enable digest and compile in the Rake task
2011-08-31 08:10:18 -07:00
Guillermo Iguaran
3f29342481 Always enable digest and compile in the Rake task 2011-08-31 09:42:43 -05:00
Ray Baxter
57dd60fde8 don't need edgeapi now that we are on 3.1 2011-08-31 02:02:00 -07:00
Xavier Noria
271cf988de Merge pull request #2762 from guilleiguaran/assets-documentation
Assets Guide updates
2011-08-31 01:59:19 -07:00
Xavier Noria
417c31c86e release notes: adds a couple of blank lines to get the markup right 2011-08-31 01:53:10 -07:00
Xavier Noria
dc5957ab26 adds the release notes of 3.1 to the index 2011-08-31 01:45:30 -07:00
Guillermo Iguaran
1cda269433 Update Assets guide to reflect all the new changes 2011-08-31 02:06:10 -05:00
Aaron Patterson
5c5021f6fc adding changelog dates 2011-08-30 20:42:43 -07:00
Aaron Patterson
403dc118b8 Merge pull request #2760 from cgriego/home_run
Fix ActiveSupport compatibility with home_run
2011-08-30 19:38:27 -07:00
Chris Griego
e63c6387a3 Revert "Ruby 1.8.7+ provides to_date/to_datetime, AS just makes them public." to support date implementations without private to_date/to_datetime on Time (home_run).
This reverts commit 080345baca.
2011-08-30 21:22:14 -05:00
Aaron Patterson
7cdc9fd7b4 Merge branch '3-1-0' into 3-1-stable
* 3-1-0:
  bumping to 3.1.0
  Bump sprockets up
  Depend on sass-rails and coffee-rails 3.1.0
  Revert "Merge pull request #2647 from dmathieu/no_rescue"
  Merge pull request #2756 from guilleiguaran/manifest-location
  Merge pull request #2748 from guilleiguaran/assets-version-config
  adds the asset pipeline guide to the index
  incorporate feedback from vijaydev and dasch to rephrase this to sound more natural, and some grammar fixes.
2011-08-30 19:19:43 -07:00
Aaron Patterson
505e84599a bumping to 3.1.0 2011-08-30 18:58:35 -07:00
Santiago Pastorino
c97081895a Bump sprockets up 2011-08-30 22:52:16 -03:00
Santiago Pastorino
36352cace7 Bump sprockets up 2011-08-30 22:49:43 -03:00
Santiago Pastorino
48cdecd1ab Depend on sass-rails and coffee-rails 3.1.0 2011-08-30 21:06:39 -03:00
Santiago Pastorino
49c75a82c2 Depend on sass-rails and coffee-rails 3.1.0 2011-08-30 21:06:09 -03:00
Santiago Pastorino
8bc6fc578f Revert "Merge pull request #2647 from dmathieu/no_rescue"
This reverts commit 125b1b0b91.
2011-08-30 20:50:28 -03:00
Santiago Pastorino
69c7213eb4 Revert "Merge pull request #2647 from dmathieu/no_rescue"
This reverts commit 125b1b0b91.
2011-08-30 20:47:27 -03:00
Aaron Patterson
aa94342eac Merge pull request #2756 from guilleiguaran/manifest-location
Change manifest.yml location with config.assets.manifest
2011-08-30 16:07:10 -07:00
Aaron Patterson
a244d11a23 Merge pull request #2756 from guilleiguaran/manifest-location
Change manifest.yml location with config.assets.manifest
2011-08-30 16:05:57 -07:00
Guillermo Iguaran
ee3cc8fd11 Set default location of manifest with config.assets.manifest 2011-08-30 17:54:24 -05:00
Aaron Patterson
6376e66453 Merge branch '3-1-0' of github.com:rails/rails into 3-1-0
* '3-1-0' of github.com:rails/rails:
  adds the asset pipeline guide to the index
  incorporate feedback from vijaydev and dasch to rephrase this to sound more natural, and some grammar fixes.
2011-08-30 14:38:36 -07:00
Aaron Patterson
1db0f20c50 Merge pull request #2748 from guilleiguaran/assets-version-config
Add config.assets.version to config/application.rb
2011-08-30 14:36:25 -07:00
Jon Leighton
3a8319ee1c Merge pull request #2752 from rsim/fix_test_update_all_with_joins_and_offset_and_order
Ensure correct ordering of results in test_update_all_with_joins_and_offset_and_order
2011-08-30 14:25:53 -07:00
Xavier Noria
714128f456 Merge branch '3-1-stable' of github.com:rails/rails into 3-1-stable 2011-08-30 13:49:26 -07:00
Xavier Noria
5e293bc7ba adds the asset pipeline guide to the index 2011-08-30 13:48:43 -07:00
Xavier Noria
5b2e79c058 adds the asset pipeline guide to the index 2011-08-30 13:48:33 -07:00
Waynn Lue
54c9a43cbe incorporate feedback from vijaydev and dasch to rephrase this to sound more natural, and some grammar fixes. 2011-08-30 13:35:37 -07:00
Waynn Lue
4869df198e incorporate feedback from vijaydev and dasch to rephrase this to sound more natural, and some grammar fixes. 2011-08-30 13:35:08 -07:00
Aaron Patterson
eaea03b668 Merge pull request #2748 from guilleiguaran/assets-version-config
Add config.assets.version to config/application.rb
2011-08-30 13:29:01 -07:00
Aaron Patterson
602a3c27dc Merge branch '3-1-0' into 3-1-stable
* 3-1-0:
  Configuration changes for asset pipeline: remove config.assets.allow_debugging, add config.assets.compile and config.assets.digest
  Read digests of assets from manifest.yml if config.assets.manifest is on
  let SDoc add a link to the source code in GitHub for each method
  Documentation fixes
  bumping to 3.1.0.rc8
  bumping to 3.1.0.rc7
  Update Rails 3.1 CHANGELOGs
  Bump rack-cache, rack-test, rack-mount and sprockets up
  clear and disable query cache when an exception is raised from called middleware
  assert_no_match
  deletes spurious arrow
  use sdoc to generate the API
  Don't modify params in place - fixes #2624
  the command line guide is good to go
  `load` should also return the value from `super`
  require needs to return true or false. thank you Ryan "zenspider" Davis
  bumping bcrypt-ruby requirement
  Make ActionController::TestCase#recycle! set @protocol to nil
  Add failing test case for #2654

Conflicts:
	activerecord/test/cases/query_cache_test.rb
2011-08-30 12:07:02 -07:00
Aaron Patterson
94e3059e7a Merge pull request #2747 from guilleiguaran/manifest-on-by-default
Manifest is generated by default when assets are precompiled
2011-08-30 12:02:25 -07:00
Guillermo Iguaran
f443f9cb0c Configuration changes for asset pipeline: remove config.assets.allow_debugging, add config.assets.compile and config.assets.digest 2011-08-30 13:13:39 -05:00
Raimonds Simanovskis
bef6ea18aa Ensure correct ordering of results in test_update_all_with_joins_and_offset_and_order
Last two asserts in this test assume that all_comments are ordered by posts.id and then by comments.id therefore additional ordering is added. Without it test was failing on Oracle which returned results in different order.
2011-08-30 20:37:16 +03:00
Jon Leighton
c96788aa20 Merge pull request #2750 from rsim/fix_test_column_names_are_escaped_for_oracle
Fix test column names are escaped for oracle
2011-08-30 09:56:42 -07:00
Raimonds Simanovskis
db41b634f0 Oracle adapter removes double quotes when quoting table and column names 2011-08-30 19:23:41 +03:00
Guillermo Iguaran
b0f3063166 Add a default asset version to production config, this give to the users an idea about how to use it 2011-08-30 10:11:02 -05:00
Aaron Patterson
4a60a9e0e1 Merge pull request #2741 from guilleiguaran/assets-manifest-yml
Read digests of assets from manifest.yml if config.assets.manifest is on
2011-08-29 21:47:32 -07:00
Guillermo Iguaran
af0f14e6de Read digests of assets from manifest.yml if config.assets.manifest is on 2011-08-29 21:22:43 -05:00
Xavier Noria
fa1e3b2f46 let SDoc add a link to the source code in GitHub for each method 2011-08-29 15:48:20 -07:00
Xavier Noria
cb25537348 let SDoc add a link to the source code in GitHub for each method 2011-08-29 15:48:15 -07:00
Igor Zubkov
609467263e Documentation fixes 2011-08-29 14:39:06 -07:00
Igor Zubkov
37df184806 Documentation fixes 2011-08-29 14:38:51 -07:00
Bogdan Gusiev
132586ef86 Fixed CollectionAssociation#find to be compatible with Array#find
In order to make CollectionAssociation behave closer to Array
Add the ability to pass block to #find method just like Array#find does.
2011-08-29 15:27:26 +01:00
Dmitriy Kiriyenko
d7618c7e38 Fixed failing query when performing calculation with having based on select. 2011-08-29 15:26:28 +01:00
Jon Leighton
7abf441336 The join_nodes must be passed to the JoinDependency initializer and therefore counted by the alias tracker. This is because the association_joins are aliased on initialization and then the tables are cached, so it is no use to alias the join_nodes later. Fixes #2556. 2011-08-29 15:08:13 +01:00
Santiago Pastorino
c4ce550f3e bumping to 3.1.0.rc8 2011-08-29 00:10:06 -03:00
Santiago Pastorino
ca26feb54a Merge pull request #2724 from guilleiguaran/avoid-recursive-call-sprockets-helper
Avoid extra recursive call in Sprockets helpers
2011-08-28 21:06:15 -03:00
Santiago Pastorino
e4fc8e22c1 bumping to 3.1.0.rc7 2011-08-28 20:48:07 -03:00
Santiago Pastorino
97e0a7787d Merge pull request #2723 from guilleiguaran/3-1-0-changelogs
Update changelogs for Rails 3.1.0
2011-08-28 20:41:43 -03:00
Santiago Pastorino
3b13fb7c3f Merge pull request #2723 from guilleiguaran/3-1-0-changelogs
Update changelogs for Rails 3.1.0
2011-08-28 16:41:15 -07:00
Guillermo Iguaran
c677461dc7 Update Rails 3.1 CHANGELOGs 2011-08-28 18:32:23 -05:00
Aaron Patterson
89f540c579 fixing typo 2011-08-28 16:31:20 -07:00
Santiago Pastorino
65d607f552 Bump rack-cache, rack-test, rack-mount and sprockets up 2011-08-28 19:05:54 -03:00
Santiago Pastorino
c13216b943 Bump rack-cache, rack-test, rack-mount and sprockets up 2011-08-28 19:05:21 -03:00
Aaron Patterson
a04503390f clear and disable query cache when an exception is raised from called middleware 2011-08-28 14:16:16 -07:00
Aaron Patterson
1130b72071 clear and disable query cache when an exception is raised from called middleware 2011-08-28 14:16:05 -07:00
Santiago Pastorino
cd00e3b89d assert_no_match 2011-08-27 22:33:38 -03:00
Xavier Noria
774832708d deletes spurious arrow 2011-08-27 15:35:44 -07:00
Xavier Noria
8653ac3948 deletes spurious arrow 2011-08-27 15:35:15 -07:00
Xavier Noria
772173a656 use sdoc to generate the API 2011-08-27 03:56:32 -07:00
Xavier Noria
c563796dc2 use sdoc to generate the API 2011-08-27 03:56:15 -07:00
Aaron Patterson
5145e98e53 stop messing with the load path, load path should be adjusted in the test task 2011-08-26 10:15:08 -07:00
Santiago Pastorino
0353435445 Merge pull request #2701 from guilleiguaran/fix-asset-test-1.8
Fix failing asset test under 1.8
2011-08-26 05:31:25 -07:00
Guillermo Iguaran
aa99f8feb3 Fix failing asset test under 1.8 2011-08-26 00:51:43 -05:00
Aaron Patterson
20c07170c7 Force binary data inserted for a string data type to utf-8 and log an
error.  Strings tagged as binary will be stored in sqlite3 as blobs.  It
is an error to insert binary data to a string column, so an error is
emitted in the log file.  People are highly encouraged to track down the
source of the binary strings and make sure that the encoding is set
correctly before inserting to the database.
2011-08-25 16:08:11 -07:00
Santiago Pastorino
abab6122fc Merge pull request #2696 from guilleiguaran/string-keys-sprockets-helpers
Removing redundant stringify_keys in Sprockets helpers
2011-08-25 18:18:55 -03:00
Aaron Patterson
9c335762e8 Merge pull request #2683 from arunagw/engine_test_fix
Engine test fix
2011-08-25 11:12:56 -07:00
Arun Agrawal
dcb5f2be2c Yes we need this to pass the test. we are using config.log_level.
Fix broken test test_copying_migrations(RailtiesTest::EngineTest):
NoMethodError: undefined method `log_level' for #<Rails::Engine::Configuration:0xb87a98c>
2011-08-25 23:38:17 +05:30
Andrew White
283f5971c6 Don't modify params in place - fixes #2624 2011-08-25 11:22:40 -03:00
Akira Matsuda
933120cdfe do not compute table names for abstract classes 2011-08-24 21:50:17 -07:00
Aaron Patterson
50db00dc7e fix ambiguous * and remove unused variable 2011-08-24 16:52:34 -07:00
Aaron Patterson
7e80394c74 fix ambiguous use of * 2011-08-24 16:48:38 -07:00
Aaron Patterson
23c5403b42 only backport the to_d method if it does not exist 2011-08-24 16:34:03 -07:00
Aaron Patterson
95d35fc1da only define the encoding reader since we define the writer later on 2011-08-24 16:33:59 -07:00
Aaron Patterson
3cbc1bd395 we are *sure* we want to set the encoding, so silence warnings around it 2011-08-24 16:23:51 -07:00
Xavier Noria
5978faefd1 the command line guide is good to go 2011-08-24 14:46:13 -07:00
Xavier Noria
8184373b86 the command line guide is good to go 2011-08-24 14:46:03 -07:00
Santiago Pastorino
dc61b8f6eb Merge pull request #2677 from guilleiguaran/refactor-sprockets-helpers
Refactoring javascript_include_tag and stylesheet_link_tag Sprockets helpers
2011-08-24 18:12:43 -03:00
Aaron Patterson
93a9cadb7b load should also return the value from super 2011-08-24 13:30:16 -07:00
Aaron Patterson
b359628f18 require needs to return true or false. thank you Ryan "zenspider" Davis 2011-08-24 13:30:14 -07:00
Aaron Patterson
36d06d1077 load should also return the value from super 2011-08-24 13:30:07 -07:00
Aaron Patterson
7c5cd40710 require needs to return true or false. thank you Ryan "zenspider" Davis 2011-08-24 13:30:02 -07:00
Aaron Patterson
d7dc94a24b bumping bcrypt-ruby requirement 2011-08-24 13:29:06 -07:00
Aaron Patterson
7286ecba0b bumping bcrypt-ruby requirement 2011-08-24 13:27:18 -07:00
Aaron Patterson
c29426d81c dealing with some -w warnings on startup 2011-08-24 13:25:24 -07:00
David Majda
621fe98166 Make ActionController::TestCase#recycle! set @protocol to nil
This ensures that the protocol does not get carried over when there are
two or more requests in functional tests. This was a problem when e.g.
the first request was HTTP and the second request was HTTPS.

Closes #2654.

Signed-off-by: Andrew White <andyw@pixeltrix.co.uk>
2011-08-24 14:06:22 -03:00
Andrew White
257061d730 Add failing test case for #2654 2011-08-24 14:06:13 -03:00
Joshua Peek
64c1d8a5f1 Merge branch '3-1-0' into 3-1-stable 2011-08-24 10:56:01 -05:00
Joshua Peek
4327e2198e Bring in sprockets precompile task 2011-08-24 10:54:01 -05:00
Santiago Pastorino
19c14035a0 Merge pull request #2644 from guilleiguaran/allow-assets-debugging
Add config.allow_debugging option
2011-08-24 12:03:51 -03:00
Santiago Pastorino
e65c2feb95 Merge pull request #2644 from guilleiguaran/allow-assets-debugging
Add config.allow_debugging option
2011-08-24 12:03:15 -03:00
Santiago Pastorino
8ac61f5b16 Merge pull request #2668 from guilleiguaran/debug-assets-media-type
Debug assets shouldn't ignore media type for stylesheets. Closes #2625
2011-08-24 11:47:01 -03:00
Santiago Pastorino
d15e7aa368 Merge pull request #2668 from guilleiguaran/debug-assets-media-type
Debug assets shouldn't ignore media type for stylesheets. Closes #2625
2011-08-24 11:46:36 -03:00
Santiago Pastorino
8c0d89ee71 Merge pull request #2390 from arunagw/test_for_environment_file
Test added to check development.rb, test.rb and production.rb content
2011-08-24 11:23:52 -03:00
Santiago Pastorino
1fdae9760a Merge pull request #2390 from arunagw/test_for_environment_file
Test added to check development.rb, test.rb and production.rb content
2011-08-24 11:23:28 -03:00
Santiago Pastorino
125b1b0b91 Merge pull request #2647 from dmathieu/no_rescue
remove useless rescue
2011-08-24 11:03:00 -03:00
Santiago Pastorino
72802c6252 Merge pull request #2647 from dmathieu/no_rescue
remove useless rescue
2011-08-24 11:02:27 -03:00
Anand
25f60ccf1c added missing require array/wrap in serialization 2011-08-23 15:11:15 -07:00
Joost Baaij
0d9363d064 removed the link to my blog to help stop endless comments 2011-08-23 15:11:12 -07:00
Joost Baaij
e3ba2cf2a5 removed the link to my blog to help stop endless comments 2011-08-23 15:10:52 -07:00
Anand
e69553815d added missing require array/wrap in serialization 2011-08-23 15:10:44 -07:00
David Majda
94a780356c Make ActionController::TestCase#recycle! set @protocol to nil
This ensures that the protocol does not get carried over when there are
two or more requests in functional tests. This was a problem when e.g.
the first request was HTTP and the second request was HTTPS.

Closes #2654.

Signed-off-by: Andrew White <andyw@pixeltrix.co.uk>
(cherry picked from commit 68a13eded3)
2011-08-23 15:36:10 +01:00
Andrew White
586b284fb9 Add failing test case for #2654
(cherry picked from commit ebea387e4b)
2011-08-23 15:35:58 +01:00
Andrew White
2af37b0fdd Don't modify params in place - fixes #2624
(cherry picked from commit 14cf4b2e35)
2011-08-23 11:11:37 +01:00
Santiago Pastorino
b11308928b Merge pull request #2411 from ai/debug_assets_by_config
Debug assets by config
2011-08-22 15:53:00 -03:00
Santiago Pastorino
b938b04211 Merge pull request #2411 from ai/debug_assets_by_config
Debug assets by config
2011-08-22 15:51:41 -03:00
Aaron Patterson
1f1d4aa939 Merge branch '3-1-stable' into 3-1-0
* 3-1-stable: (21 commits)
  Added a test to check for correct behaviour with no options in add_index command recorder
  Using .try to test for the existence of a method option in a nil-resistent manner. Inlined the determination of the options hash for reversing using a ternary operator. Shortens the method in a way that keeps the code neat
  Neatened up the invert_add_index method as per suggeston
  Simple fix for correctly inverting an add_index migration when a name has been provided
  Merge pull request #2524 from JonathonMA/fix_ecd37084b28a05f05251
  Fix Sprockets rewrite_asset_path
  Merge pull request #2620 from cesario/3-1-0
  Fix sprockets warnings
  Use typewriter styling on url_for in documentation
  Merge pull request #2609 from guilleiguaran/bump-sprockets-beta14
  remove extra space since comment_if already returns the space. (cherry picked from commit 5e73a2fa50)
  Merge pull request #2596 from dharmatech/patch-1
  Merge pull request #2595 from smartinez87/assets-guide
  Merge pull request #2597 from dharmatech/patch-2
  Merge pull request #2604 from vijaydev/params_wrapper_docs
  Merge pull request #2602 from ernie/fix_predicate_builder_primary_key_assumption
  Merge pull request #2603 from vijaydev/guides
  Merge pull request #2581 from guilleiguaran/debug-assets-in-dev
  Revert "Deprecate the use of non-public methods by Module#delegate"
  mailer guide: fixes indentation, and use fixed width fonts wherever necessary
  ...
2011-08-22 11:20:16 -07:00
David Workman
2f20c6c5ba Added a test to check for correct behaviour with no options in add_index command recorder 2011-08-22 11:04:41 -07:00
David Workman
00c8151d77 Using .try to test for the existence of a method option in a nil-resistent manner. Inlined the determination of the options hash for reversing using a ternary operator. Shortens the method in a way that keeps the code neat 2011-08-22 11:04:31 -07:00
David Workman
9934c97cae Neatened up the invert_add_index method as per suggeston 2011-08-22 11:04:22 -07:00
David Workman
54866b0574 Simple fix for correctly inverting an add_index migration when a name has been provided 2011-08-22 11:04:13 -07:00
Santiago Pastorino
5ec3430a6e Merge pull request #2216 from martinisoft/remove_generated_whitespace
Remove generated whitespace
2011-08-22 10:43:18 -07:00
Santiago Pastorino
c2ab1b1cc3 Merge pull request #2524 from JonathonMA/fix_ecd37084b28a05f05251
Use mysql_creation_options inside rescue block
2011-08-22 14:37:14 -03:00
Santiago Pastorino
9a26ba3b49 Merge pull request #2524 from JonathonMA/fix_ecd37084b28a05f05251
Use mysql_creation_options inside rescue block
2011-08-22 14:36:42 -03:00
Guillermo Iguaran
812d1ae742 Fix Sprockets rewrite_asset_path 2011-08-22 12:25:06 -05:00
Santiago Pastorino
d81fe8d74e Merge pull request #2620 from cesario/3-1-0
Fix CI and rename 1 misleading test case.
2011-08-21 19:56:31 -03:00
Santiago Pastorino
9d1fc0863b Merge pull request #2620 from cesario/3-1-0
Fix CI and rename 1 misleading test case.
2011-08-21 15:55:15 -07:00
Joshua Peek
d7bef0a716 Fix sprockets warnings
Fixes #2598
2011-08-21 16:42:51 -05:00
Franck Verrot
2173e04ec6 Add a trailing space to the comment_if method 2011-08-21 22:47:57 +02:00
Franck Verrot
f63a1341a7 This is a test on --skip-sprockets, not --skip-active-record
(cherry picked from commit 0c79098720e46e2a4a8380703ab9abc7dd0a4121)
2011-08-21 22:47:04 +02:00
asmega
61fa6006db Use typewriter styling on url_for in documentation 2011-08-21 09:19:28 -07:00
asmega
1fd3c269a3 Use typewriter styling on url_for in documentation 2011-08-21 09:19:06 -07:00
Santiago Pastorino
7a6b220fda Merge pull request #2609 from guilleiguaran/bump-sprockets-beta14
Bump sprockets to 2.0.0.beta.14
2011-08-21 11:36:52 -03:00
Santiago Pastorino
a79530a0a6 Merge pull request #2609 from guilleiguaran/bump-sprockets-beta14
Bump sprockets to 2.0.0.beta.14
2011-08-21 11:36:23 -03:00
Santiago Pastorino
cc363855d2 Merge pull request #2615 from cesario/cherry_picks_on_rc6
Cherry picked "remove extra space since comment_if already returns the space." on rc6, already apply on master.
2011-08-21 11:33:31 -03:00
Santiago Pastorino
fe7282e55c Merge pull request #2615 from cesario/cherry_picks_on_rc6
Cherry picked "remove extra space since comment_if already returns the space." on rc6, already apply on master.
2011-08-21 07:32:50 -07:00
Teng Siong Ong
365ebdb1f2 remove extra space since comment_if already returns the space.
(cherry picked from commit 5e73a2fa50)
2011-08-21 11:08:51 +02:00
Santiago Pastorino
088f6f0c95 Merge pull request #2596 from dharmatech/patch-1
ActionController::Redirecting : fix docs typo
2011-08-20 18:29:32 -03:00
Santiago Pastorino
a0cb70644b Merge pull request #2595 from smartinez87/assets-guide
Document debugging assets set by default for dev and test envs on guides
2011-08-20 18:29:23 -03:00
Santiago Pastorino
a7ea1ffb1d Merge pull request #2597 from dharmatech/patch-2
actionpack/lib/action_controller/base.rb: docs typo
2011-08-20 18:29:02 -03:00
Santiago Pastorino
9b7f49374b Merge pull request #2596 from dharmatech/patch-1
ActionController::Redirecting : fix docs typo
2011-08-20 18:27:56 -03:00
Santiago Pastorino
b82bd6c952 Merge pull request #2595 from smartinez87/assets-guide
Document debugging assets set by default for dev and test envs on guides
2011-08-20 18:27:48 -03:00
Santiago Pastorino
52e1e45c54 Merge pull request #2597 from dharmatech/patch-2
actionpack/lib/action_controller/base.rb: docs typo
2011-08-20 18:27:41 -03:00
Aaron Patterson
1d354faa52 Merge pull request #2605 from ernie/3-1-stable-2602-backport
3-1-stable 2602 backport
2011-08-20 12:30:18 -07:00
Santiago Pastorino
3655e7bace Merge pull request #2604 from vijaydev/params_wrapper_docs
Minor edit in the params wrapper api docs
2011-08-20 16:21:43 -03:00
Santiago Pastorino
f8f1e18808 Merge pull request #2604 from vijaydev/params_wrapper_docs
Minor edit in the params wrapper api docs
2011-08-20 16:21:21 -03:00
Aaron Patterson
bf4714fe82 Merge pull request #2602 from ernie/fix_predicate_builder_primary_key_assumption
Fix assumption of primary key name in PredicateBuilder subquery.
2011-08-20 15:14:55 -04:00
Santiago Pastorino
a263cb80d5 Merge pull request #2603 from vijaydev/guides
Minor change in the 3.1 release notes
2011-08-20 15:39:32 -03:00
Santiago Pastorino
d29eec6f4d Merge pull request #2603 from vijaydev/guides
Minor change in the 3.1 release notes
2011-08-20 15:39:05 -03:00
Santiago Pastorino
a7afb84982 Merge pull request #2581 from guilleiguaran/debug-assets-in-dev
Debug assets by default in development and test environments
2011-08-19 19:31:17 -03:00
Santiago Pastorino
c09dbf2062 Merge pull request #2581 from guilleiguaran/debug-assets-in-dev
Debug assets by default in development and test environments
2011-08-19 19:29:50 -03:00
Jon Leighton
b0d95487ed Revert "Deprecate the use of non-public methods by Module#delegate"
This reverts commit aa1d1e4962.

Conflicts:

	activesupport/lib/active_support/core_ext/module/delegation.rb
	activesupport/test/core_ext/module_test.rb
2011-08-19 23:07:49 +01:00
Jon Leighton
1b819d32f6 Revert "Deprecate the use of non-public methods by Module#delegate"
This reverts commit aa1d1e4962.

Conflicts:

	activesupport/lib/active_support/core_ext/module/delegation.rb
	activesupport/test/core_ext/module_test.rb
2011-08-19 23:07:28 +01:00
Vijay Dev
dbdb2304f5 mailer guide: fixes indentation, and use fixed width fonts wherever necessary 2011-08-19 13:12:40 -07:00
Vijay Dev
155f734155 mailer guide: fixes indentation, and use fixed width fonts wherever necessary 2011-08-19 13:12:20 -07:00
Xavier Noria
0df00d9079 minor details revised in a gsub
Regexps have a construct to express alternation of characters, which
is character classes. In addition to being the most specific idiom to
write this pattern, it reads better without the backslashes. Also, it
is better not to use a capture if none is needed. As a side-effect of
these changes, the gsub is marginally faster, but speed is not the
point of this commit.
2011-08-18 03:12:18 -07:00
Jeff Dutil
4b411c80cc Fix ruby typo to correctly render code block in initializer.textile 2011-08-17 17:34:08 -07:00
Jeff Dutil
6f3bac4c60 Fix spacing in plugins.textile to fix html rendering and remove extra whitespace from security.textile 2011-08-17 17:33:55 -07:00
Xavier Noria
2e45cfe01c fixes generation of the AR querying guide 2011-08-17 14:38:08 -07:00
Aaron Patterson
633a5693a7 bumping to 3.1.0.rc6 2011-08-16 15:29:50 -07:00
Aaron Patterson
a19ee5cfd3 properly escape html to avoid invalid utf8 causing XSS attacks 2011-08-16 15:18:53 -07:00
Aaron Patterson
66c3e31dcf Tags with invalid names should also be stripped in order to prevent
XSS attacks.  Thanks Sascha Depold for the report.
2011-08-16 15:17:49 -07:00
Aaron Patterson
f9b642cb15 prevent sql injection attacks by escaping quotes in column names 2011-08-16 15:17:17 -07:00
Aaron Patterson
09ad48f22e Properly escape glob characters. 2011-08-16 15:16:45 -07:00
Jon Leighton
c238ba00a8 Fix non-public method warning in Module#delegate. Fixes #2548. 2011-08-16 22:27:20 +01:00
Xavier Noria
2330c0cfc3 Merge branch '3-1-stable' of github.com:rails/rails into 3-1-stable 2011-08-16 11:19:02 -07:00
Xavier Noria
ae69c4c42f syncs the 3.1 release notes and asset pipeline guide with master 2011-08-16 11:18:51 -07:00
Jon Leighton
29d0ce0103 Use lazy load hooks to set parameter wrapping configuration. This means that it doesn't force Action Controller / Active Record to load, but it doesn't fail if they have already loaded. Thanks @josevalim for the hint. 2011-08-16 19:14:35 +01:00
Jeff Dutil
4b4e67f6dd Fix formatting of active_record_validations_callbacks.textile so guide will render properly at http://edgeguides.rubyonrails.org/active_record_validations_callbacks.html#displaying-validation-errors-in-the-view 2011-08-16 11:14:05 -07:00
Vijay Dev
f3f5a8f0ef document Array#append and Array#prepend methods in AS guide 2011-08-16 11:13:45 -07:00
Sebastian Martinez
ebf0cc4cea Document Hash#extract!. 2011-08-16 11:13:32 -07:00
Jacob Mattingley
927d3c2453 Fixed mistakes in layouts/rendering guide about yield
yield(:unspecified_block) actually returns true even if :unspecified_block never
exists. This means you can't use the form yield(:unspecified_block) or yield.
2011-08-16 11:12:39 -07:00
Vijay Dev
d8c6bab0a3 assets guide - add info about require_directory, minor rephrasings 2011-08-16 11:12:08 -07:00
Vijay Dev
0c3bdc0b16 minor changes in app templates guide 2011-08-16 11:11:54 -07:00
Kamil Śliwak
4eac844b47 Fix a typo in 'Configuring Rails Applications' guide
- The initializer is called `set_autoload_paths`, not `set_autoload_path`. See https://github.com/rails/rails/blob/master/railties/lib/rails/engine.rb#L506
2011-08-16 11:11:33 -07:00
Raul Murciano
dbd72be060 Typo 2011-08-16 11:11:17 -07:00
Raul Murciano
282ee95c69 Action Mailer guide: mention how to use :cc and :bcc parameters. 2011-08-16 11:11:04 -07:00
Raul Murciano
92d3b51bc0 Action Mailer guide update: the :to parameter now supports both String and Array values to indicate recipients. 2011-08-16 11:10:57 -07:00
Vijay Dev
073d9ff25e rephrase how the verbose methods in a migration work 2011-08-16 11:10:52 -07:00
Vijay Dev
9e9b127726 document alias for rails runner 2011-08-16 11:10:37 -07:00
Vijay Dev
388f09c28b fix misleading comment (originally made by Tate Johnson, we lost this commit while porting to the rails repo) 2011-08-16 11:10:11 -07:00
Jon Leighton
0ab65e8608 Fix assets tests in railties 2011-08-16 16:41:23 +01:00
Jon Leighton
458128df79 Don't reference ActiveRecord::Base in initializers/wrap_parameters.rb. Use config.active_record instead. This yields about a 20% decrease in startup time because it means that the connection is not created immediately on startup. Of course, this is only useful if you are not going to immediately use the database after startup. 2011-08-16 16:41:16 +01:00
Jon Leighton
3594102f3b Fix tzinfo require (it broke test_raises_when_an_invalid_timezone_is_defined_in_the_config in railties) 2011-08-16 02:42:39 +01:00
Jon Leighton
4b703765ec Fix wrap_parameters initializer template 2011-08-16 02:28:23 +01:00
Jon Leighton
72de6abce0 Be more lazy about creating time zone objects. Decreases startup time by about 10%. (#734) 2011-08-16 01:34:00 +01:00
Jon Leighton
6cf15ae56a Don't refer to ActionController::Base in the wrap_parameters initializer - use config object instead. Cuts about 15% off the load time. (#734) 2011-08-16 01:00:16 +01:00
Jon Leighton
c388a95173 Bump arel dependency 2011-08-15 23:07:49 +01:00
Jon Leighton
c6bf713e1c Use new SelectManager#source method 2011-08-15 23:03:23 +01:00
Jon Leighton
c701b3f749 Use new SelectManager#projections= method 2011-08-15 23:03:16 +01:00
Jon Leighton
eff8aeeff3 use update.key instead of update.ast.key. make better use of select manager. 2011-08-15 23:03:10 +01:00
Jon Leighton
e85c644260 Use a SelectCore rather than a full SelectManager 2011-08-15 23:03:04 +01:00
Jon Leighton
24ade58875 Refactor building the update manager 2011-08-15 23:02:59 +01:00
Jon Leighton
e81e50888d Support for multi-table updates with limits, offsets and orders
Conflicts:

	activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
2011-08-15 23:02:47 +01:00
Jon Leighton
044fb8c3e2 Support updates with joins. Fixes #522.
Conflicts:

	activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
	activerecord/test/cases/relations_test.rb
2011-08-15 23:01:58 +01:00
Jon Leighton
e749abcc45 Merge pull request #2538 from arunagw/notifications_test_fix
Notifications test fix
2011-08-15 11:54:39 -07:00
Arun Agrawal
f4e535e71e Notification Test Fix 2011-08-16 00:20:06 +05:30
Santiago Pastorino
28e250e645 rake assets:precompile executes in production environment as default if RAILS_ENV was not provided 2011-08-15 15:34:05 -03:00
Jon Leighton
81151eb786 Update travis config on @joshk's instructions 2011-08-15 17:23:27 +01:00
Jon Leighton
6bb6519544 Ensure empty has_many :through association preloaded via joins is marked as loaded. Fixes #2054. 2011-08-15 16:27:27 +01:00
Jon Leighton
7a9da9c58a Merge pull request #2535 from arunagw/delegation_fix
Delegation fix
2011-08-15 08:03:26 -07:00
Arun Agrawal
801cd66738 Including delegation 2011-08-15 19:55:48 +05:30
Jon Leighton
68cb61865a Removing unnecessary require, solve 'circular require considered harmful' warning. 2011-08-15 14:06:42 +01:00
Jon Leighton
75d5195f95 Fix the line number in the backtrace when Module#delegate raises 2011-08-15 13:02:28 +01:00
Jon Leighton
1aab850789 Fix deprecation warnings due to private methods which are delegated to. 2011-08-15 12:54:58 +01:00
Jon Leighton
aa1d1e4962 Deprecate the use of non-public methods by Module#delegate 2011-08-15 12:36:41 +01:00
José Valim
0e19c7c414 Ensure changing RAILS_GROUPS will load the proper dependencies. 2011-08-14 10:53:31 -07:00
Santiago Pastorino
17154e375f Merge pull request #2522 from arunagw/railties_test_fix
Railties test fix
2011-08-14 06:08:02 -07:00
Arun Agrawal
5a5171b057 Need to use initializers true here to pass the test. 2011-08-14 13:48:04 +05:30
Arun Agrawal
322b97884d Bringing back the jquery-rails. One test is dependent. 2011-08-14 13:47:38 +05:30
Santiago Pastorino
41ce1613f1 Merge pull request #2518 from myronmarston/fix_active_record_observer_disabling_3-1
Fix active record observer disabling for 3-1-stable
2011-08-13 09:15:42 -07:00
Myron Marston
fea7359d59 Allow ActiveRecord observers to be disabled.
We have to use Observer#update rather than Observer#send since the enabled state is checked in #update before forwarding the method call on.
2011-08-13 09:02:52 -07:00
Jon Leighton
cf013a6268 Perf: don't mess around with thread local vars unless we actually need to 2011-08-13 16:57:15 +01:00
Jon Leighton
af96a91793 Fix default scope thread safety. Thanks @thedarkone for reporting. 2011-08-13 16:57:09 +01:00
Jon Leighton
2db0455be6 Work around for lolruby bug. (Read on for explanation.)
We were experiencing CI test failures, for example:

* 3-1-stable: http://travis-ci.org/#!/rails/rails/builds/79473/L407
* master: http://travis-ci.org/#!/rails/rails/builds/79507/L80

These failures only happened on 1.8.7-p352, and we were only able to
reproduce on the Travis CI VM worker. We even tried creating a new 32
bit Ubuntu VM and running the tests on that, and it all worked fine.

After some epic trial and error, we discovered that replacing the
following:

  fuu = Marshal.load(Marshal.dump(fuu))

with:

  marshalled = Marshal.dump(fuu)
  fuu = Marshal.load(marshalled)

seemed to prevent the failure.

We have NO IDEA why this is. If anyone has some great insight to
contribute then that is welcome. Otherwise, hopefully this will just
help us get the CI green again.

Many thanks to @joshk for help with sorting this out.
2011-08-13 14:02:41 +01:00
Santiago Pastorino
5b6ac344ff Merge pull request #2512 from arunagw/cant_dup_on_nil_3-1-stable
Cant dup on nil 3 1 stable
2011-08-12 23:38:35 -07:00
Arun Agrawal
d761ec4864 We actually don't need a reverse_merge! here. dup removed was giving error with nil class. 2011-08-13 08:26:30 +05:30
Santiago Pastorino
d9d78d4165 Merge pull request #2497 from akaspick/url_for_fix
When calling url_for with a hash, additional (likely unwanted) values (such as :host) would be returned in the hash
2011-08-11 19:55:48 -03:00
Santiago Pastorino
83d9398ec0 Merge pull request #2489 from grzuy/master
Remove parameters_for_url from form_tag method header
2011-08-11 10:39:52 -03:00
Aaron Patterson
cdf6251c0b Revert "Ensure original exception message is present in both Template::Error#message and Template::Error#inspect."
This reverts commit 403b06e98e.

The call to `message` calls `inspect` on our exception.  The exception
holds a reference to the environment, and the controller.  This string
becomes very large, and the call to `super` dups the string (in tern
doubling the memory used).  I'm reverting this for 3.1 but leaving the
commit on master.  We should stop holding references to so many objects
and reduce the size of our inspect.
2011-08-10 14:37:56 -07:00
Aaron Patterson
47c6a77180 add the gem requirement for sqlite3 2011-08-10 11:40:01 -07:00
Santiago Pastorino
004bb66d00 rake assets:precompile defaults to production env 2011-08-09 20:41:50 -03:00
Jon Leighton
561e8a7dc0 Okay, the new incompatible arel is now called 2.2 and the sun shines upon thee once more 2011-08-09 22:05:39 +01:00
Aaron Patterson
4c492865b1 reduce file stats by improving our dir glob pattern 2011-08-08 21:43:02 -07:00
Jon Leighton
6e2e06043e Remove TODO comment I didn't mean to commit 2011-08-09 00:01:01 +01:00
Jon Leighton
f1c90cea9b Bump arel version
Conflicts:

	activerecord/activerecord.gemspec
2011-08-08 23:55:27 +01:00
Jon Leighton
c202c10965 Fully marshal AR::Base objects. Fixes #2431. 2011-08-08 23:34:06 +01:00
Jon Leighton
dd944cbf58 Make it the responsibility of the connection to hold onto an ARel visitor for generating SQL. This improves the code architecture generally, and solves some problems with marshalling. Adapter authors please take note: you now need to define an Adapter.visitor_for method, but it degrades gracefully with a deprecation warning for now.
Conflicts:

	activerecord/lib/active_record/relation/finder_methods.rb
	activerecord/test/cases/adapter_test.rb
2011-08-08 23:33:31 +01:00
Santiago Pastorino
d008c99f72 Initialize config.assets.version the same way it's done in Sprockets 2011-08-08 12:51:39 -03:00
Joshua Peek
509a98a651 Merge pull request #2448 from igrigorik/master
Asset pipeline fixes: clear out tmp cache and use environment in digest generation
Conflicts:

	railties/test/application/assets_test.rb
2011-08-08 09:45:10 -05:00
Xavier Noria
ed85772c12 guides generation: apparently this workaround for RedCloth is not needed anymore 2011-08-07 16:20:31 -07:00
Gregg Pollack
dfcecdecfa Added irregular zombie inflection, so zombies no longer gets singularized into zomby 2011-08-07 11:36:20 -07:00
Santiago Pastorino
54357879ee Merge pull request #2455 from vijaydev/patch-7
Edit changelog to mention about x_sendfile_header default change
2011-08-07 15:02:05 -03:00
Santiago Pastorino
eff7fddeb2 x_sendfile_header now defaults to nil and production.rb env file doesn't
set a particular value for it. This allows servers to set it through
X-Sendfile-Type, read
https://github.com/rack/rack/blob/master/lib/rack/sendfile.rb for more
info. Anyways you can force this value in your production.rb
2011-08-07 13:13:19 -03:00
José Valim
33d02f1c4d Test against 1.9.3 as well. 2011-08-07 14:48:44 +03:00
Santiago Pastorino
704e9c8c58 Merge pull request #2450 from guilleiguaran/activesupport-gzip-1.8
Fix ActiveSupport::Gzip under Ruby 1.8.7. Closes #2416
2011-08-06 17:20:47 -03:00
Santiago Pastorino
741151c275 Use rake >= 0.9.3.beta.1 in Ruby 1.9.3 2011-08-06 09:16:59 -03:00
Santiago Pastorino
7af63a98e7 Avoid generating app/views/layouts/application.html.erb on mountable engines, just generate the namespaced one 2011-08-05 21:28:14 -03:00
Santiago Pastorino
216d79ef63 Revert "to_key on a destroyed model should return nil". Closes #2440
This reverts commit c5448721b5.
2011-08-05 19:40:05 -03:00
Santiago Pastorino
8118e419ff Fix test for Rubinius 2011-08-05 16:49:50 -03:00
Guillermo Iguaran
b1be622b97 Fix AR test suite error under Rubinius 2.0 2011-08-05 11:51:12 -07:00
Xavier Noria
9efc57f2b7 Revert "Explicitly included hashes in sentence regarding SQL-injection-safe forms"
Reason: The hash form is secure, and preferred over the array form if possible.

This reverts commit 6dc749596c.
2011-08-04 16:57:43 -07:00
Xavier Noria
ab8747589b Revert "grammatical changes"
Reason: As discussed in GitHub, it is debatable, and present tense
is fine (and simple, and preferred).

This reverts commit 54ccda9f0a5e4a5e72a4c159dc8787faaf65e8a2.
2011-08-04 16:57:38 -07:00
Rashmi Yadav
34d69b3d81 The trailing '/' isn't being picked up by Github anyway, and the link works as is. 2011-08-04 16:56:39 -07:00
Waynn Lue
3694a6c055 The trailing '/' isn't being picked up by Github anyway, and the link works as is. 2011-08-04 16:56:32 -07:00
JudeArasu
346cd04704 grammatical changes 2011-08-04 16:56:28 -07:00
Vijay Dev
b0cf7ead38 typo fix 2011-08-04 16:56:24 -07:00
Vijay Dev
19eb720122 minor changes in migrations guide 2011-08-04 16:56:20 -07:00
Vijay Dev
8207d0cb1c fixed incorrect tags 2011-08-04 16:56:17 -07:00
pbflinn
690eae7e42 Fix typo 'console' -> 'constant' 2011-08-04 16:56:13 -07:00
Vishnu Atrai
6b361aa629 Active Resource - guide for destroy 2011-08-04 16:56:08 -07:00
Vishnu Atrai
566d2b91a5 Active Resource - guide for update/save 2011-08-04 16:50:08 -07:00
Vishnu Atrai
814e05e78f Active Resource - guide for create 2011-08-04 16:50:03 -07:00
Vishnu Atrai
35eb96f65f Active Resource - guide for reading and writing data 2011-08-04 16:49:59 -07:00
Waynn Lue
20251c86c8 typo in "wont" 2011-08-04 16:49:53 -07:00
Vijay Dev
ed246f53d2 3.1 release notes Active Record changes, Architectural changes and
organizing sections.
2011-08-04 16:49:48 -07:00
Arun Agrawal
e3e11092cd Adding more info as rake about is fixed 2011-08-04 16:49:43 -07:00
Arun Agrawal
9232033cb1 Rack::Sendfile is no more default middleware. 2011-08-04 16:49:39 -07:00
Waynn Lue
478dc71cd4 "blog" is more common than "weblog" these days. 2011-08-04 16:49:34 -07:00
Vijay Dev
08f4a8c55c 3.1 release notes - added AP and Railties sections 2011-08-04 16:49:30 -07:00
Vijay Dev
d0161024b9 3.1 release notes draft 2011-08-04 16:49:26 -07:00
Vijay Dev
2fb540ed75 prefer to use if..end unless the condition is simple/compact 2011-08-04 16:49:20 -07:00
Vijay Dev
bac54a09b0 remove some parts of the section on shortcut helpers, document custom validators 2011-08-04 16:49:15 -07:00
Vijay Dev
c93adf85a7 make the warning clear about the effect of using validates_associated on both sides on an association. 2011-08-04 16:48:34 -07:00
Vishnu Atrai
88c101bb3f usages of active resouce 2011-08-04 16:48:29 -07:00
Vishnu Atrai
d240ce8a54 configuration for active resource 2011-08-04 16:48:24 -07:00
Vishnu Atrai
35a028d45f Introduction for active resource 2011-08-04 16:48:19 -07:00
Vishnu Atrai
dcb965b5f0 Active Resouce guide initial load 2011-08-04 16:48:13 -07:00
Bratish Goswami
e231c491c2 '/' was outside of anchor tag. 2011-08-04 16:48:09 -07:00
Waynn Lue
f21e8e04a9 Superfluous "the". 2011-08-04 16:47:35 -07:00
Arun Agrawal
8cefafbd38 Extra "l" removed before h2. 2011-08-04 16:47:22 -07:00
Vijay Dev
7e494f0bca document meta method 2011-08-04 16:45:30 -07:00
ejy
740e531688 Removed trailing slash of 'Download and installation' Github URL as per convention 2011-08-04 16:45:25 -07:00
Pete Campbell
f9bd8b2a72 Explicitly included hashes in sentence regarding SQL-injection-safe forms 2011-08-04 16:45:21 -07:00
Alberto Perdomo
d83641381d Association and Callbacks guide: Added section on shortcut syntax 'validates'. 2011-08-04 16:44:27 -07:00
Hendy Tanata
5b51e5802e Fix two spaces between sententes on README.rdoc. 2011-08-04 16:44:21 -07:00
Vijay Dev
d2c9c9ef4d move the note after the scaffold files listing 2011-08-04 16:43:48 -07:00
Aaron Patterson
b0b70700e1 we should not ignore all gems in here 2011-08-04 16:32:33 -07:00
Aaron Patterson
3727232b9c fixing assert_difference issues on ruby 1.8 2011-08-04 14:07:47 -07:00
Jon Leighton
26c410e56f Quote these dates to prevent intermittent test failure. Suppose local time is 00:50 GMT+1. Without the quoting, the YAML parser would parse this as 00:50 UTC, into the local time of 01:50 GMT+1. Then, it would get written into the database in local time as 01:50. When it came back out the UTC date from the database and the UTC date of two weeks ago would be compared. The former would be 23:50, and the latter would be 00:50, so the two dates would differ, causing the assertion to fail. Quoting it prevents the YAML parser from getting involved.
Conflicts:

	activerecord/test/fixtures/pirates.yml
2011-08-04 00:48:54 +01:00
Santiago Pastorino
5f05642df9 Fix a bit precompile and lazy compile comments 2011-08-03 21:06:30 -03:00
Aaron Patterson
e63d3f7a91 make assert_difference error message not suck 2011-08-03 16:55:15 -07:00
Aaron Patterson
c1b85edc2d fixing deprecation notice for dynamic finders that use hashes. fixes #2404 2011-08-03 15:31:48 -07:00
Santiago Pastorino
0c57ae102f Don't require assets group in production by default, you can change this default in the application.rb anyways 2011-08-03 19:18:34 -03:00
Santiago Pastorino
1f1bfaf7d7 This dep is already defined in activerecord.gemspec 2011-08-03 18:14:11 -03:00
Aaron Patterson
3e56758a95 add a migrate class method and delegate to the new instance 2011-08-02 20:03:15 -07:00
Christopher Meiklejohn
96fc0746fb Ensure that .up and .down work as well. 2011-08-02 20:03:11 -07:00
Christopher Meiklejohn
55eadccfbf Support backwards compatible interface for migration down/up with rails 3.0.x. 2011-08-02 20:03:06 -07:00
Aaron Patterson
ebfad374ff use File.directory? as Dir.exists? is only 1.9.2+ 2011-08-01 17:29:14 -07:00
Santiago Pastorino
1711731228 Merge pull request #2324 from zenapsis/3-1-stable
Rails 3.1 throws a Errno::ENOTDIR if files are put in assets directories
2011-08-01 12:32:17 -07:00
Santiago Pastorino
17b0d2cdc8 Merge pull request #2393 from bdurand/fix_cache_read_multi
Fix ArgumentError in ActiveSupport::Cache::CacheStore.read_multi
2011-08-01 14:59:57 -03:00
José Valim
86b792d4fa Merge pull request #2307 from thoefer/3-1-stable-fix1872
Fix the issue where default_url_options is being cached on test cases. Closes #1872. Closes #2031.
2011-08-01 02:44:06 -07:00
thoefer
7b39ddafab modified fix #1872 according to jose valim´s suggestions 2011-08-01 11:28:31 +02:00
Santiago Pastorino
7ee15e8a0f Merge pull request #2382 from vijaydev/rakeaboutfix3.1
Fix #2368 (3-1-stable)
2011-07-31 12:55:06 -07:00
Vijay Dev
c05ceac90b fixes #2368. rake about not showing the middleware, db adapter and db schema version 2011-08-01 00:54:42 +05:30
José Valim
030bb7178b Merge pull request #2373 from arunagw/31_schema_dumper_test_fix
3-1-stable schema dumper test fix
2011-07-31 09:10:30 -07:00
Arun Agrawal
3248c5d5c7 skiping magic comment test. checking encoding_aware?
Loading AS encoding.
2011-07-31 16:03:59 +00:00
Jon Leighton
3c8d805a0f Merge pull request #2372 from bradediger/issue-2346-3-1-stable
Issue 2346 3-1-stable port
2011-07-31 07:29:17 -07:00
Brad Ediger
f2657b0a8b remove_possible_method: test if method exists
This speeds up remove_possible_method substantially since it doesn't
have to rescue a NameError in the common case.

Closes #2346.
2011-07-31 09:04:05 -05:00
Jon Leighton
048215a193 Revert "Replace inline lambdas with named methods" and "Don't wrap operations on collection associations in transactions when they are not needed, so the connection adapter does not send empty BEGIN COMMIT transactions blocks to the database."
This reverts commits df63c99f06 and b17fd25a2d.

The change had unintended side effects, please see #2337.

Conflicts:

	activerecord/test/cases/associations/has_many_associations_test.rb
2011-07-30 23:05:20 +01:00
Aaron Patterson
61c5c3d1f4 delay backtrace scrubbing until we actually raise an exception. fixes #1936 2011-07-29 14:39:26 -07:00
Aaron Patterson
d13df74c33 default writing the schema file as utf-8 2011-07-29 12:28:21 -07:00
Aaron Patterson
4e1f6ab6f6 dump IO encoding value along with schema.rb so the file can be reloaded. fixes #1592 2011-07-29 12:23:58 -07:00
Santiago Pastorino
f2ade6f4b0 Generated apps with --dev or --edge flags depend on git versions of sass-rails and coffee-rails 2011-07-28 16:52:18 -03:00
José Valim
7f5dc9887b Merge pull request #2332 from thedarkone/resources-router-fix-3-1
Backport #2330 into 3-1-stable
2011-07-28 11:21:53 -07:00
thedarkone
34c50895b4 Make use of the inherited initializer. 2011-07-28 20:18:54 +02:00
thedarkone
0753d0bd05 There is no need to be destructive with the passed-in options.
This fixes a bug that is caused by Resource/SingletonResource mangling resource options when using inline "multi"-resource declarations.
2011-07-28 20:18:45 +02:00
Santiago Pastorino
b4cf2914c6 Merge pull request #2326 from castlerock/plugin_generator_fix
pluging generator test fix
2011-07-28 12:49:24 -03:00
Tasveer Singh
b4ca7d3c3d Do not add files in assets/ directories to Sprockets 2011-07-28 11:17:28 -04:00
Santiago Pastorino
f2c83093ac Tidy up a bit plugin new gemspec 2011-07-28 11:58:00 -03:00
Santiago Pastorino
bba9c8d76b Merge pull request #2295 from dgeb/mo-better-plugins
Improve dependency management and gemspec file for plugins
2011-07-28 11:53:13 -03:00
Santiago Pastorino
ac24a53ffc Merge pull request #2319 from thedarkone/errors-include-3-1
Backport #2305 into 3-1-stable
2011-07-28 05:50:06 -07:00
thedarkone
09dd71cbdf Handle the empty array correctly. 2011-07-28 12:24:02 +02:00
Xavier Noria
6f745f4468 contrib app minor tweak 2011-07-27 13:22:32 -07:00
Joshua Peek
1edfadf82e Make Rails.application.assets available in initializers 2011-07-27 15:09:42 -05:00
José Valim
a9dea60e56 Merge pull request #2287 from dgeb/3-1-mailers-in-plugins
Ensure that app/mailers gets created in new plugins
2011-07-27 11:37:33 -07:00
Xavier Noria
348cd238f8 Merge pull request #2302 from christos/performant_options_for_select
Improve performance and memory usage for options_for_select with Ruby 1.8
2011-07-27 08:02:59 -07:00
Christos Zisopoulos
74a450d5e7 Improve performance and memory usage for options_for_select with Ruby 1.8.7 2011-07-27 16:12:22 +02:00
Jon Leighton
e13e25dda5 Update deprecation messages to point out the availability of proxy_association. Fixes #1148. 2011-07-27 12:44:17 +01:00
Jon Leighton
7bf9b9a170 Add a proxy_association method to association proxies, which can be called by association extensions to access information about the association. This replaces proxy_owner etc with proxy_association.owner.
Conflicts:

	activerecord/lib/active_record/associations/collection_proxy.rb
	activerecord/test/cases/associations_test.rb
2011-07-27 12:41:10 +01:00
Lachlan Sylvester
8dade4985b fix some types in schema_test.rb 2011-07-27 01:18:20 -07:00
Jonathan del Strother
626798af1a Replace unnecessary regexp in Dependencies#load_missing_constant 2011-07-26 16:20:38 -07:00
Santiago Pastorino
8220777bed Merge pull request #2279 from jdelStrother/load_missing_constant
Constantize a regexp in Dependencies#load_missing_constant
2011-07-26 19:32:02 -03:00
Dan Gebhardt
b589f0c375 added test case for fix to issue #2094 2011-07-26 14:24:46 -07:00
Dan Gebhardt
75366cb82d fixed problem in which options[:html][:remote] would be overridden in form_for() - fixes #2094 2011-07-26 14:24:38 -07:00
Santiago Pastorino
8f67029a09 Remove cruise files 2011-07-26 18:10:15 -03:00
Santiago Pastorino
8aa49ad23b Merge pull request #2288 from joshk/3-1-stable
Irc notifications (from Travis with love)
2011-07-26 14:08:11 -07:00
Josh Kalderimis
0094cab1da enable Travis CI irc notifications to #rails-contrib on irc.freenode.org 2011-07-26 22:25:06 +02:00
Dan Gebhardt
9d93a443c8 Include empty app/mailers directory in mountable and full plugins 2011-07-26 15:41:08 -04:00
Aaron Patterson
1768b6cd90 fixing tests on ruby trunk 2011-07-26 11:03:31 -07:00
Aaron Patterson
5f6accf8ca fixing whitespace errors 2011-07-26 11:03:26 -07:00
Santiago Pastorino
bfc0b32661 Merge pull request #2278 from dmathieu/fix_actionpack_3-1
Fix actionpack 3 1
2011-07-26 08:08:12 -07:00
Damien Mathieu
f44f412902 use sprocket's append_path and assert_match 2011-07-26 17:04:45 +02:00
Santiago Pastorino
e83250ae2f Check that Rack::Sendfile is not included unless config.action_dispatch.x_sendfile_header is set 2011-07-26 00:18:56 -03:00
Santiago Pastorino
ec2cac2a89 Bump rack up. Closes #2107 2011-07-25 23:02:12 -03:00
Aaron Patterson
a5188333aa bumping to rc5 2011-07-25 16:03:01 -07:00
Aaron Patterson
6dcdcdc696 bumping up arel version 2011-07-25 16:00:54 -07:00
Aaron Patterson
64cb34d63c updating sprockets to beta 12 2011-07-25 15:42:38 -07:00
Santiago Pastorino
0018402af9 Remove unused use_sprockets config 2011-07-25 19:06:30 -03:00
Santiago Pastorino
e10dd20dcf Don't use Rack::Sendfile middleware if x_sendfile_header is not present 2011-07-25 18:54:25 -03:00
Xavier Noria
81789b7961 let TIP and friends handle a multiline paragraph
Normally I would have done this in master, but there was already
a guide with wrapped content, so worked here. I am going to
cross-merge now.
2011-07-25 23:30:59 +02:00
Vijay Dev
ba19ddf0f3 Revert "Add in a tip about opening two command prompt windows"
This reverts commit 1e5fa59d13.

Reason: It's somewhat a grey area. We don't really want to tell the
users how they want to use the terminal.
2011-07-25 23:29:49 +02:00
Vijay Dev
ebb4540717 Revert "Update the TIP formatter to handle multiline tips"
This reverts commit e3dbe66e19.

Reason: Code changes are not allowed in docrails.
2011-07-25 23:29:43 +02:00
Elliot Winkler
b3c06a2659 Improve ch. 1 of the Form Helpers guide 2011-07-25 23:29:39 +02:00
Jason Noble & Ralph Shnelvar
d4e8479ccc Add in a tip about opening two command prompt windows 2011-07-25 23:29:33 +02:00
Jason Noble & Ralph Shnelvar
4eb030eb39 Fix two spaces after end of sentence. 2011-07-25 23:29:28 +02:00
Jason Noble & Ralph Shnelvar
0405394da2 Extend description of rails generate scaffold and what it's options accomplish 2011-07-25 23:29:22 +02:00
Michael Lavrisha
75e0406feb Update the TIP formatter to handle multiline tips
- includes 3 tests
2011-07-25 23:27:51 +02:00
Mike Howard
8fe7fda054 Updated migrations.textile to clarify Using Models in Your Migrations
Rewrote entire section including example code, error message, and work
around.
2011-07-25 23:27:45 +02:00
Jason Noble & Ralph Shnelvar
9e34a4136b Make the rails not found tip more explanatory. 2011-07-25 23:27:40 +02:00
Jason Noble & Ralph Shnelvar
e737b768eb Updated rails_welcome.png to latest Rails welcome page. 2011-07-25 23:27:33 +02:00
Jason Noble & Ralph Shnelvar
b2fc1e818f Update wording of TIP about --database option for rails new 2011-07-25 23:27:28 +02:00
Jason Noble & Ralph Shnelvar
41c024d9d4 Remove "bundle install" section, as rails new ______ runs bundle install for you 2011-07-25 23:27:22 +02:00
John
12faf8087d Fixed Typo 2011-07-25 23:27:17 +02:00
Jason Noble & Ralph Shnelvar
290849c3e9 Fix TIP formatting issue 2011-07-25 23:27:12 +02:00
Jason Noble & Ralph Shnelvar
d80ac95032 Add a note about the fact that the Windows prompt will look different than the linux/osx prompt 2011-07-25 23:27:05 +02:00
Jason Noble & Ralph Shnelvar
be584c4bbd Reformatted to 80 chars. 2011-07-25 23:26:50 +02:00
Michael Lavrisha
ceee7ce98e Rewrite apart of the REST section to be in the present tense
Conflicts:

	railties/guides/source/getting_started.textile
2011-07-25 23:26:19 +02:00
Jason Noble & Ralph Shnelvar
5d7343f86c Wrapped text content to 120 chars 2011-07-25 14:22:06 -07:00
Michael Lavrisha
3cbf9a6da5 Provide consistant indentation for the example code 2011-07-25 14:22:00 -07:00
Ben Marini
d4832f1027 Fix example code for #validates_with instance method 2011-07-25 14:21:52 -07:00
José Valim
19a3c9b41c Merge pull request #2263 from sferik/format_true
Allow a route to have :format => true
2011-07-25 13:44:59 -07:00
Erik Michaels-Ober
78d151dbac Add documentation for :format => true 2011-07-25 12:28:44 -07:00
Erik Michaels-Ober
c41ecd7164 Allow a route to have :format => true
When format is true, it is mandatory (as opposed to :format => false).
This is currently not possible with resource routes, which automatically
make format optional by default.
2011-07-25 11:46:52 -07:00
Santiago Pastorino
05503f1b4f Merge pull request #2260 from davidtrogers/3-1-stable
3 1 stable
2011-07-25 10:50:16 -07:00
Dave Rogers
8a551086ec Ensure the constraints block is only applied to the correct route
addresses issue #1907 - any routes that follow a route with a constraints
  block are inheriting the previous route's constraints.
2011-07-25 10:40:40 -07:00
Santiago Pastorino
5bc0020bb6 Merge pull request #2257 from thedarkone/udpate-all-order-3-1
Backport #2251 into 3-1-stable
2011-07-25 07:21:08 -07:00
thedarkone
787194ee43 Bring back the ability to provide :order for update_all. 2011-07-25 16:12:58 +02:00
José Valim
1d97a7c870 Merge pull request #2256 from thedarkone/polymorphic-url-helper-3-1
Backport #2252 into 3-1-stable
2011-07-25 06:56:41 -07:00
thedarkone
9395e89b72 Make polymorphic_url calls go through application helpers again.
This brings back the ability to overwrite/extend url generating methods in application heleprs.
2011-07-25 15:43:36 +02:00
José Valim
46141ebd3b Merge pull request #2253 from dchelimsky/stringify-parameter-values-in-tests-branched-off-3-1-stable
Stringify parameter values in tests branched off 3-1-stable
2011-07-25 05:32:06 -07:00
David Chelimsky
7fd726d62e Paramify param values in controller tests. 2011-07-25 07:21:42 -05:00
Andrew White
4b1b9ac7d0 Use top level Rails constant 2011-07-24 21:48:22 +01:00
Xavier Noria
eea9ca8dd2 little details seen while reviewing 2011-07-24 21:12:20 +02:00
Jason Noble & Ralph Shnelvar
69505612d4 Moved ActionController, ActionView and ActionDispatch sections under ActionPack 2011-07-24 21:12:16 +02:00
Jason Noble & Ralph Shnelvar
24cbee0c5d Add link to the Layouts and Rendering guide to explain more on view templates 2011-07-24 21:12:09 +02:00
Jason Noble & Ralph Shnelvar
27f4d73e4d Modified the content based on vijaydev's comment
3eb99aab77 (commitcomment-493737)
2011-07-24 21:12:04 +02:00
Jason Noble & Ralph Shnelvar
75f0298f9d Update guide to be based on Rails 3.1. 2011-07-24 21:11:59 +02:00
Jason Noble & Ralph Shnelvar
2d689d5e77 Added link to the RubyGems User's Guide 2011-07-24 21:11:55 +02:00
Jason Noble & Ralph Shnelvar
d62e846769 Added explanation to Components of Rails to help users not get hung up on details 2011-07-24 21:11:49 +02:00
Ken Ip
b14b643463 Update "Getting Started" for Rails 3.1
Add additional files generated by rails 3.1 generator.
2011-07-24 21:11:23 +02:00
Jason Noble & Ralph Shnelvar
fa0751add9 Added some context for rack apps, linked to the Rails on Rack guide. 2011-07-24 21:11:18 +02:00
Mike Howard
f53c7fb929 Clarified notes in 3.2 Creating the Blog Application
Changed descriptino of Gemfile to add reference to Bundler
Changed description of README to add 'You should edit ...'
Changed description of Rakefile to reflect dynamic nature of Rakefile
and point to app/lib/tasks/ as the place to add app-specific rake tasks.
2011-07-24 21:11:13 +02:00
Mike Howard
998a3efad0 Changed wording of paragraph 2.1.1 Models to clarify table/model
relationship.

changed wording 'one table ... corresponds to one model' to 'each table
...'
2011-07-24 21:11:07 +02:00
Xavier Noria
d9b6f898f3 Revert "Tests now require MySQL2 adapter in order to run"
Reason: Setting up MySQL and Postgres needs installing servers
and libraries that perhaps you don't need in your machine. We
think fixing a bug in Active Support without running the suite
of Active Record for all possible drivers is OK. That's why
we explain first --without db, and after that we cover AR
specifically. mysql2 is no different than mysql or pg in that
sense.

This reverts commit 50d5e0f7e8.
2011-07-24 21:11:01 +02:00
Oemuer Oezkir
2793bcda0f Missed a few instances of British English spelling in the last commit
oh and obviously I meant according to Webster, not Weber
2011-07-24 21:10:55 +02:00
Oemuer Oezkir
8b30f1d7ea Changed a few instances of of words in the API docs written in British English to
American English(according to Weber)

Conflicts:

	actionpack/lib/action_controller/metal/request_forgery_protection.rb
	railties/lib/rails/engine.rb
2011-07-24 21:10:51 +02:00
Carol Nichols
582a621b59 Changing Textile emphasis underscores to em tags; the link with underscores that follows is causing the emphasis underscores to be parsed incorrectly.
This appears to be a bug with RedCloth; parsing with official Textile creates the HTML that I expect. I have filed ticket # 226 on RedCloth's lighthouse project and I will attempt to fix the problem with RedCloth.

This commit is a workaround for the RedCloth bug that will give this guide the right formatting.
2011-07-24 21:06:02 +02:00
Evan Farrar
e593f8c1d1 Changed several instances of British English to be American English 2011-07-24 21:05:58 +02:00
Evan Farrar
505a43b244 Replaced ‘ with ' in the guides. 2011-07-24 21:05:52 +02:00
Joe Fiorini
9a16cc075c Tests now require MySQL2 adapter in order to run 2011-07-24 21:05:48 +02:00
gnagno
fdc0468701 now the documentation reflects the actual returned value for a missing translation 2011-07-24 21:05:43 +02:00
Santiago Pastorino
b2eaf968de Merge pull request #2235 from arunagw/location_var_fix_cherry-pick
Location var fix cherry pick from master to 3-1-stable
2011-07-23 23:30:47 -07:00
Raghunadh
fb6a76c9f0 Improve rails:template undefined LOCATION variable error message fixed 2011-07-24 10:04:07 +05:30
Aaron Patterson
5b88219acb just use normal ruby for stubbing 2011-07-23 20:55:38 -07:00
Aaron Patterson
7f7ed15df2 Merge pull request #2229 from gramos/fix-issue-1951
Fix issue 1951 Namespaced model partial_path is wrong in namespaced controllers
2011-07-23 20:48:54 -07:00
Ben Woosley
dbca49bb32 Simple fix to the NoMethodError noted in #2177.
Unfortunately #respond_to?(:controller) won't work as suggested, nor will respond_to?(:params), as #controller is present and #params is delegated to #controller. #delegate makes respond_to? return true regardless whether the target responds to it.
2011-07-23 20:40:43 -07:00
Gaston Ramos
8d0e3c9dc2 - added ActionView::PartialRenderer#merge_path_into_partial(path, partial)
fix issues/1951
2011-07-24 00:24:38 -03:00
Aaron Patterson
be48abb450 simplify singleton_class? method 2011-07-23 20:02:19 -07:00
Damien Mathieu
038e493966 rake assets:precompile should always perform caching - Closes #2199 2011-07-23 17:51:30 -07:00
Santiago Pastorino
434bbb0efc Revert "Merge pull request #2194 from cldwalker/after_initialize"
This reverts commit 198300727d, reversing
changes made to ae65c0b7a4.
2011-07-23 20:49:42 -03:00
Gaston Ramos
1f3f9f1b07 - added test case for issue:
https://github.com/rails/rails/issues/1951
  Namespaced model partial_path is wrong in namespaced controllers
2011-07-23 20:46:06 -03:00
Santiago Pastorino
198300727d Merge pull request #2194 from cldwalker/after_initialize
Fix after_initialize and Base.create edge case
2011-07-23 16:19:33 -07:00
Santiago Pastorino
ae65c0b7a4 Remove jquery-rails from Gemfile 2011-07-23 18:35:17 -03:00
Santiago Pastorino
f41a98e033 Merge pull request #2219 from kommen/fix_fragment_caching_squashed
Fix fragment caching (squashed commits)
2011-07-23 13:50:34 -07:00
Dieter Komendera
15c8bf1012 Fix fragment cache helper regression on cache miss introduced with 03d01ec7.
Contains following patches cherry-picked from @lhahne's 3-0-stable branch:

* Added tests for the output_buffer returned by CacheHelper (c476a6b)
The output_buffer returned by CacheHelper should be html_safe if the original buffer is html_safe.

* made sure that the possible new output_buffer created by CacheHelper is of the same type as the original (39a4f67)
2011-07-23 22:25:24 +02:00
Aaron Patterson
b2285ba1a6 remove unused gems from Gemfile 2011-07-23 13:11:07 -07:00
Aaron Kalin
c4ba1afc41 Remove leading whitespace for optional requires 2011-07-23 14:49:33 -05:00
Santiago Pastorino
66610db037 Merge pull request #2213 from grzuy/3-1-stable
ActiveSupport::Cache::FileStore#file_path_key does not work if initialized with Pathname
2011-07-23 11:38:45 -07:00
Gonzalo Rodriguez
48e134b987 Fix ActiveSupport::Cache::FileStore#file_path_key does not work if initialized with Pathname 2011-07-23 15:15:53 -03:00
Sam Umbach, Zachary Porter and Michael Pell
353479167a Add failing test: ActiveSupport::Cache::FileStore#file_path_key does not work if initialized with Pathname 2011-07-23 12:21:20 -04:00
Santiago Pastorino
0988da62e2 Merge pull request #2172 from arunagw/database-rake-1.9.2_3-1-stable
Database rake 1.9.2 3 1 stable
2011-07-23 07:59:02 -07:00
Santiago Pastorino
36bd8eb624 Merge pull request #2204 from castlerock/3-1-stable
Backport from 3-0-stable for 3-1-stable
2011-07-23 07:34:24 -07:00
Santiago Pastorino
9154c358dc Merge pull request #2203 from arunagw/3-1-stable
3 1 stable fixes #713
2011-07-23 07:23:15 -07:00
Vishnu Atrai
52ec151d07 remove ruby-prof for rubinius in Gemfile cherry-pick 2011-07-23 19:52:27 +05:30
Arun Agrawal
e414d4fcf2 Backporting from master fixes #713 2011-07-23 19:49:40 +05:30
Xavier Noria
a9fc988625 checked all .rb files in the project tree for missing magic comments, one was missing
Came with this one-liner for this:

    find . -name '*.rb' | \
    xargs chardet | \
    grep -v ascii | \
    cut -d: -f1 -s | \
    xargs -n1 ruby -0777 -ne 'puts $FILENAME if $_ !~ /#.*coding:\s*utf/i'

Welcome $_.
2011-07-23 14:56:54 +02:00
Xavier Noria
50203b3cf6 adds a couple of missing magic comments [fixes #1374] 2011-07-23 14:15:24 +02:00
Vijay Dev
ed90144f6f minor refactor in the template guide 2011-07-23 12:30:39 +02:00
Vijay Dev
53f2a568e4 document the change in edge rails which makes a more strict check on the arity of the dynamic finders 2011-07-23 12:30:35 +02:00
Vijay Dev
a7027db920 corrected sentences to make them consistent in command line guide 2011-07-23 12:30:32 +02:00
Vijay Dev
ba4fe8f145 minor corrections in caching guide 2011-07-23 12:30:28 +02:00
JudeArasu
4a84461ba5 grammatical changes 2011-07-23 12:30:24 +02:00
Vishnu Atrai
a6daf4c097 alias added for rails generate guide 2011-07-23 12:30:15 +02:00
Vishnu Atrai
20f1f6ce49 alias added for rails runner guide 2011-07-23 12:30:11 +02:00
JudeArasu
9747758d68 grammatical changes 2011-07-23 12:30:08 +02:00
JudeArasu
cdb44c33d7 typo change 2011-07-23 12:30:03 +02:00
Vishnu Atrai
daeff45185 fixed type 2011-07-23 12:30:00 +02:00
Igor Zubkov
3290b6a24f Fix typo 2011-07-23 12:29:51 +02:00
Bratish Goswami
27a9f1941c Download and installation, License and Support sections added for activemodel 2011-07-23 12:29:46 +02:00
Ray Baxter
94a8e35e4c use the doc conventions for arguments in all cases
See 5c71a4e768 (commitcomment-485675)
2011-07-23 12:29:43 +02:00
Sebastian Gassner
f4558c660d Documentation fix: adding missing equal sign in code sample for ActiveModel::Dirty. 2011-07-23 12:29:32 +02:00
Paul Battley
3a82a92344 Update form helper documentation to match code.
Change d3cfee11 removed the automatically generated object_name_submit id attributes on form submit elements. This makes the documentation match.
2011-07-23 12:29:28 +02:00
Evan Machnic
6e09ea95c2 Fixed asset_url in asset_pipeline doc 2011-07-23 12:29:24 +02:00
Evan Machnic
56325414df image_url documentation in asset_pipelin doc 2011-07-23 12:29:15 +02:00
Vijay Dev
63efe073bb spacing fix 2011-07-23 12:29:12 +02:00
Vijay Dev
8392b78139 Fixing the incorrect change made in bae54c5 2011-07-23 12:29:09 +02:00
Vijay Dev
8a3f4c2066 reword select_date's behaviour clearly when an incomplete options array is passed 2011-07-23 12:29:05 +02:00
Vijay Dev
cc505e1d33 minor corrections in form helpers guide and api docs 2011-07-23 12:29:02 +02:00
Vijay Dev
5bafead575 some corrections in assets pipeline guide 2011-07-23 12:28:58 +02:00
Evan Machnic
26476d90cf Capitalization compliance for asset_pipeline doc 2011-07-23 12:28:54 +02:00
Vijay Dev
7cf4fd93d8 Revert "notextile tag has been placed with ascii quotes"
This reverts commit 3e6052a430.

Reason: Code changes are not allowed in docrails (even if they are related to guides generation)
2011-07-23 12:28:50 +02:00
Ryan Bigg
28ff4e52e5 Complete another review of asset pipeline guide 2011-07-23 12:28:27 +02:00
Richard Hulse
f4d827b23d [asset pipeline] update capistrano task code
This code actually works.
2011-07-23 12:28:23 +02:00
Ray Baxter
9f888b0299 Add seach, tel, url and email inputs as 'Other Helpers of Interest' 2011-07-23 12:28:20 +02:00
Ray Baxter
b9ac90d9fa examples for telephone_field, url_field and email_field 2011-07-23 12:28:16 +02:00
Ray Baxter
c7be43a54e document options to search_field 2011-07-23 12:28:11 +02:00
Ray Baxter
38efb9532b use correct in description 2011-07-23 12:27:54 +02:00
Richard Hulse
f86f8fc454 [asset pipeline] Correct CSS section and include Gem details
Also added note about compress option, which was
not mentioned anywhere and is required
2011-07-23 12:27:49 +02:00
Richard Hulse
56a8997b98 [configuring] add doc for missing assets attribute
.compress turns on the compression using the types
specified in other config options
2011-07-23 12:27:45 +02:00
Ray Baxter
a957300ef1 we're talking about days here, not hours 2011-07-23 12:27:41 +02:00
Ray Baxter
cb62ea9479 wording between select_second, select_minute and
select_hour should be consistent and correct
2011-07-23 12:27:37 +02:00
Ray Baxter
e4ab021b91 fix typo 2011-07-23 12:27:32 +02:00
Ray Baxter
a7d4008674 make documentation agree with test expectations and
behaviour

See: test_select_date_with_incomplete_order in
actionpack/test/template/date_helper_test.rb
2011-07-23 12:27:26 +02:00
Ray Baxter
e6caf3c61a document that second tags are also returned by default 2011-07-23 12:27:21 +02:00
Ray Baxter
28237d625c there is no Time.today method, use Time.now 2011-07-23 12:27:15 +02:00
Ray Baxter
8ff3ebf275 remove stray character 2011-07-23 12:27:12 +02:00
Ray Baxter
36f0386e82 disambiguate uses of post/POST by using "article"
for the related variable passed to  date_select,
time_select and datetime_select
2011-07-23 12:27:02 +02:00
Ray Baxter
a3e54929b8 clarify that classes that include DateHelper can
also manipulate times
2011-07-23 12:26:58 +02:00
Ray Baxter
9831d7bab1 clarify that DateTime objects are allowed arguments
to distance_of_time_in_words
2011-07-23 12:26:54 +02:00
Ray Baxter
5c7cb8a987 use minute instead of second in description of select_minute 2011-07-23 12:26:50 +02:00
Ray Baxter
2f5a15e3e8 show correct helper in description 2011-07-23 12:26:46 +02:00
Ray Baxter
044aa0abea use 'hour' instead of 'minutes' and 'second' for select_hour 2011-07-23 12:26:42 +02:00
Sam Umbach
c2c7f657f0 Switch Tilt link to Textile format 2011-07-23 12:26:38 +02:00
Sam Umbach
dc58a7b2fb Fix typo 2011-07-23 12:26:33 +02:00
Richard Hulse
a64748bb43 [asset pipeline] A few corrections and some new material
Add notes about capistrano task being added to that project
and correction to information about precompilation.
2011-07-23 12:26:29 +02:00
Richard Hulse
0d30929a91 [asset pipeline] Add section on sendfile option
This option has caught a few people out, so it
is a good idea to include an explanation and
a Gotcha.

See Rails bug 1822
See 1822 comment 1585926 for resolution
2011-07-23 12:26:25 +02:00
John Warwick
06636c5e02 Fixing typo in plugins.textile 2011-07-23 12:26:21 +02:00
Vishnu Atrai
de2cc31636 Should be "match" instead of "map" 2011-07-23 12:25:58 +02:00
Vijay Dev
80fc12f3d0 Revert "Fix wildcard route code examples."
This reverts commit 0894d73c75.

Reason: CHANGELOGs should not be changed in docrails.
2011-07-23 12:25:54 +02:00
Hendy Tanata
86908ee513 Fix wildcard route code examples.
Should be "match" instead of "map".
2011-07-23 12:25:50 +02:00
Richard Hulse
f619bccbd2 [asset pipeline] Added information about data uri helper
See Sprockets issue 111
and Sprockets commit cd38a1670a
2011-07-23 12:25:46 +02:00
joeellis
8e0f49e314 Minor grammar mistake 2011-07-23 12:25:41 +02:00
Daniel Dyba
cf122fc71e Modified Migrations file 2011-07-23 12:25:35 +02:00
Akira Matsuda
48a013d6b7 documentation fix: wrong result 2011-07-23 12:25:30 +02:00
Richard Hulse
2a4e204660 [asset pipeline] add capistrano task
Task still needs to symlink default rails default
filestore location, but code may still be settling
2011-07-23 12:25:25 +02:00
Aslam Najeebdeen
2fdb88ebb3 Replaced appropriate word. 2011-07-23 12:25:21 +02:00
Matt Jankowski
170bc98d57 grammar correction for rails/paths #add method arguments 2011-07-23 12:25:17 +02:00
Matt Jankowski
79df11b4a0 misc grammar and clarity changes for rails/engine docs 2011-07-23 12:25:13 +02:00
Matt Jankowski
3b5679fb2a grammar/tense correction to rails application doc 2011-07-23 12:25:06 +02:00
Hrvoje Šimić
ef0b1e79f0 fixed paths, more consistent helpers and paths examples 2011-07-23 12:25:01 +02:00
Richard Hulse
43e69109c1 [asset pipeline] more updates to docs 2011-07-23 12:24:57 +02:00
Vijay Dev
ed611fcde6 use simpler words in docs 2011-07-23 12:24:51 +02:00
Olek Janiszewski
6a4d54b5cc Documentation fixes for rendering partials 2011-07-23 12:24:33 +02:00
Gabriel Horner
06c6252b10 simplify and be more explicit about create and after_initialize tests 2011-07-22 20:14:49 -04:00
Les Fletcher
3dc5f71c17 fix after_initialize edge case (close #2074 and close #2175)
fix behavior when after_initialize is defined and a block is passed to Base.create
2011-07-22 20:14:48 -04:00
Aaron Patterson
6f917adf35 forgot to add this test case 2011-07-22 09:15:19 -07:00
Santiago Pastorino
56a995be63 Merge pull request #2186 from loz/3-1-stable
Fixed engine rake tasks
2011-07-22 08:04:43 -07:00
Jonathan Lozinski
39a9938c75 Added missing runner to engine rake to ensure that engine can run the app rake tasks (as per master) 2011-07-22 14:43:44 +01:00
Aaron Patterson
787f1f3000 use rake tasks to set the default environment variables. fixes #2126 2011-07-21 15:30:37 -07:00
Aaron Patterson
b1464772a6 removing inline source option from rdoc task. fixes #2169 2011-07-21 13:49:45 -07:00
Arun Agrawal
8dc4745c7b This conditions is required to work with database create task. 1.9.2 is having a bug with "Calling return within begin still executes else". 2011-07-21 09:53:44 +05:30
Aaron Patterson
9a6b96a61a no need to sort the values 2011-07-20 15:57:45 -07:00
Franck Verrot
1d674d51b9 assign_nested_attributes_for_collection_association should work with Ruby 1.9 [Closes #2106]
Children attributes can be either String's or Symbol's, so let's check if the object responds to to_i.
2011-07-20 15:57:40 -07:00
Aaron Patterson
56fb7fc1b2 bigdecimal should be typecast to a float on sqlite3. fixes #2162 2011-07-20 10:45:16 -07:00
Josh Kalderimis
ff05736947 this fixes a brittle test in fixtures_test.rb which fails when you are in a timezone which is ahead of UTC but UTC is in the previous day still. 2011-07-20 13:10:58 +02:00
JudeArasu
db20780b6c notextile tag has been placed with ascii quotes 2011-07-20 13:10:48 +02:00
Santiago Pastorino
f3e4dc21f5 Merge pull request #2156 from vijaydev/changelogs31
Adding changelog entry for submit helper change (3-1-stable)
2011-07-19 13:36:15 -07:00
Xavier Noria
8d7f270a0e Merge pull request #2157 from vijaydev/3-1-stable
Avoid Symbol#to_proc (3-1-stable)
2011-07-19 12:49:45 -07:00
Vijay Dev
f78a4e88f6 avoid Symbol#to_proc 2011-07-20 01:07:06 +05:30
Vijay Dev
4792b88367 add entry for submit helper change removing object_name_id 2011-07-20 00:57:29 +05:30
Santiago Pastorino
b6cf638c75 Merge pull request #2147 from norman/3-1-stable
Explicitly require Active Support dependencies (3-1-stable)
2011-07-19 06:38:40 -07:00
Norman Clarke
b8e26e67d7 Explicitly require Active Support dependencies
This fixes errors when using Active Record outside of Rails. In Rails,
these files are required by other classes that are always loaded, so
this error does not happen.

Without core_ext/module/delegation, a NoMethodError is raised because
`delegate` remains undefined.

Without core_ext/class/attribute_acessors, an ArgumentError is raised because
`delegate` does not receive a value for its :to option.
2011-07-19 10:27:57 -03:00
Santiago Pastorino
a719ec0c2d Merge pull request #2140 from mcmire/issue_2078_3-1-stable
Fix for #2078 (against 3-1-stable)
2011-07-18 17:27:46 -07:00
Josh Kalderimis
7deac1fbd0 Added a .travis.yml config and travis specific ci script.
Don't install ruby-debug if running the test suite on Travis,
linecache19 is the main offender, very very slow.

And do not install pg if Travis is bundling the gems, pg will be setup
on Travis soon.
2011-07-18 23:37:04 +02:00
Josh Kalderimis
20aff013f1 This fixes an issue when bundling to a local path (eg. /vendor/bundle).
If you bundle to a local path bundler is not included in it, so
calling "gem 'bundler'" will fail.

Conflicts:

	load_paths.rb
2011-07-18 23:36:33 +02:00
Elliot Winkler
8ebd8416c4 ActiveRecord: Fix eager loading so that giving a blank order clause generates valid SQL 2011-07-18 14:56:07 -06:00
Santiago Pastorino
d963ef96e6 Merge pull request #2135 from jstorimer/ensure-status-codes-are-logged-properly-3-1-stable
Ensure status codes are logged properly (3-1-stable)
2011-07-18 12:45:09 -07:00
Jesse Storimer
c24966f4c3 Ensure that status codes are logged properly
Needed to move AC::Metal::Instrumentation before AM::Metal::Rescue
so that status codes rendered from rescue_from blocks are logged
properly.
2011-07-18 15:32:57 -04:00
José Valim
48379df990 Merge pull request #2121 from arunagw/3-1-plugin_new_gen_test
3 1 plugin new gen test
2011-07-18 06:38:05 -07:00
Jon Leighton
312ee12403 Add autoload declaration for deprecated AssociationCollection 2011-07-18 11:58:56 +01:00
Jon Leighton
3d7ed11c22 Merge pull request #2129 from sikachu/3-1-stable-dynamic_finder
Show a deprecation warning if user passing less number of argument in the
2011-07-18 01:26:27 -07:00
Aaron Patterson
1b97f6c595 make tzinfo a development dependency 2011-07-18 14:30:13 +09:00
Prem Sichanugrist
fa7dd345c3 Refactor test case to use anonymous class - Thank you @tenderlove 2011-07-18 00:35:02 -04:00
Prem Sichanugrist
b2cd66ff9c Show a deprecation warning if user passing less number of argument in the dynamic finder
The previous behavior was unintentional, and some people was relying on it. In the next version of Rails, the dynamic finder will always expecting the number of arguments to be equal or greater (so you can still pass the options to it.) It will raise the ArgumentError otherwise.
2011-07-17 19:30:11 -04:00
Jon Leighton
2b33d05c24 Don't do remove_possible_method when delegate is used. Two reasons: 1) warnings should be shown, and fixed at the source and 2) the code is slow. Fixes #1937. 2011-07-18 00:22:46 +01:00
Santiago Pastorino
567930882f Merge pull request #2048 from sikachu/3-1-stable-test_fix
Fix a wrong assertion on url_helper_test, and add missing `#html_safe?` a
2011-07-17 12:49:18 -07:00
Prem Sichanugrist
79fa146b1c Fix a wrong assertion on url_helper_test, and refactor html_safe test to be in its method 2011-07-17 15:41:14 -04:00
Arun Agrawal
09f57801d1 Not creating script/rails in full mode. from master. 2011-07-18 00:24:01 +05:30
Arun Agrawal
777fcc5cfd More changes for plugin_new_generator. 2011-07-17 23:53:29 +05:30
Arun Agrawal
e35d5200cb Adding tests for gemspec file creation 2011-07-17 23:08:35 +05:30
Xavier Noria
b6675d8a80 synchronizes assets.rake with master 2011-07-17 00:48:17 +02:00
Santiago Pastorino
b88e3687d2 Merge pull request #2103 from loz/3-1-stable
Added gem helper tasks to Rakefile for engine plugins.
2011-07-16 08:43:19 -07:00
Jonathan Lozinski
1fdf6f6796 Added gem helper tasks to Rakefile for engine plugins. It makes sense for this to be there given they're being generated to be gemified.
Altered addition to Rakefile so that it won't add GemHelper if the user specified --skip-gemspec
2011-07-16 15:58:59 +01:00
Jon Leighton
fb95dee926 Deprecated the AssociationCollection constant 2011-07-16 14:22:34 +01:00
Santiago Pastorino
0f37def4bb Merge pull request #2065 from elight/3-1-stable
Backport of cache_key fix from master
2011-07-16 06:06:33 -07:00
Santiago Pastorino
3fb70171e3 Fix the output a bit 2011-07-16 09:36:11 -03:00
Aaron Patterson
5e2c1d2c3a Merge pull request #2099 from htanata/backport_2090_to_3-1-stable
Backport #2090 to 3-1-stable
2011-07-16 00:31:35 -07:00
Hendy Tanata
357e7bb83b Fix wildcard route code example in changelog. 2011-07-16 12:30:58 +08:00
Evan Light
2cbac3c6f8 Closes #2065
Cache key was incorrectly using timezone-dependent record#updated_at when it should be using a timezone-independent value to generate the cache key
2011-07-15 22:11:03 -04:00
Santiago Pastorino
68e2b8a614 Merge pull request #2092 from loz/3-1-stable
Fixed engine gemspec so that app, config, and db are packaged up
2011-07-15 14:38:39 -07:00
Jonathan Lozinski
4662b997b4 Fixed engine gemspec so that app, config, and db are packaged up 2011-07-15 22:14:00 +01:00
Santiago Pastorino
9441c945eb Fix indentation 2011-07-14 15:25:07 -03:00
Santiago Pastorino
13b215307c Merge pull request #2071 from bfolkens/3-1-stable
write_cookies! nil exception in ActionDispatch::TestRequest
2011-07-14 11:23:14 -07:00
Bradford Folkens
36836f1add write_cookies! in ActionDispatch::TestRequest won't write nil value when == 'u' on 1.8.7 2011-07-14 13:03:03 -05:00
Santiago Pastorino
08202833fe Bump rack up 2011-07-13 21:41:58 -03:00
José Valim
675c20e1bc Use cache/assets instead. 2011-07-12 22:56:01 -03:00
José Valim
d0f05a6fee assets.cache_store now defaults to filesystem. You will want to share tmp/assets_cache between deploys. 2011-07-12 22:31:10 -03:00
Santiago Pastorino
a91afeb42a Merge pull request #2040 from SAP-Oxygen/3-1-stable-sqlbypass-patch
Fix for SqlBypass session store
2011-07-12 15:05:05 -07:00
Santiago Pastorino
926ef07cc8 Merge pull request #2039 from SAP-Oxygen/3-1-stable-session-id-patch-with-test
Fix for session ID fixation issue in ActiveRecord::SessionStore (squashed commits)
2011-07-12 15:04:47 -07:00
Joseph Wong
b87f8d8635 Fix for SqlBypass session store
Two issues fixed:
1) connection_pool is not defined - needed by SessionStore#drop_table!
and create_table! since c94651f

2) initialization of connection to the default of AR::Base.connection
only occurred at the singleton level - the instance level method defined
by cattr_accessor did not have this logic
2011-07-12 11:01:56 -07:00
Joseph Wong
63fdd2c90a Fixed session ID fixation for ActiveRecord::SessionStore
I have found that Rails will take an invalid session ID specified by the
client and materialize a session based on that session ID. This means
that it is possible, among other things, for a client to use an
arbitrarily weak session ID or for a client to resurrect a previous used
session ID. In other words, we cannot guarantee that all session IDs are
generated by the server and that they are (statistically) unique through
time.

The fix is to always generate a new session ID in #get_session if an
existing session cannot be found under the incoming session ID.

Also added new tests that make sure that an invalid session ID is never
materialized into a new session, regardless of whether it comes in via a
cookie or a URL parameter (when :cookie_only => false).
2011-07-12 10:57:20 -07:00
Jon Leighton
5c591e5c96 Fix exception if old and new targets are both nil. Fixes #1471.
Conflicts:

	activerecord/test/models/comment.rb
2011-07-12 00:16:44 +01:00
Joshua Peek
15438c41bb Ensure Dir.glob is sorted 2011-07-11 16:08:15 -07:00
Marc-Andre Lafortune
f4858e4639 Generate valid default fixtures for models with a type column
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-07-11 19:47:22 -03:00
Joshua Peek
a9980d17e9 Float sprockets again 2011-07-11 13:10:02 -05:00
Julius Markūnas
a23997329a #many? uses count instead of select - a bit faster 2011-07-11 17:40:55 +02:00
José Valim
33f76e1669 Require assets in all environments by default and provide a way to opt-out from uglifier. 2011-07-11 11:19:47 -03:00
José Valim
4c76991120 Make Rails.groups accept arrays. 2011-07-10 08:35:06 -03:00
Sam Pohlenz
e249dd9b3e Include TagHelper within AssetTagHelper 2011-07-10 08:04:22 -03:00
Santiago Pastorino
a7319a9af9 to_key on a destroyed model should return nil 2011-07-09 15:38:08 -03:00
Santiago Pastorino
de44f41b7f Merge pull request #2022 from amatsuda/having_vargs_nomethoderror_fix_3-1-stable
having() raises NoMethodError (3-1-stable)
2011-07-09 08:44:34 -07:00
Akira Matsuda
8a4fdbbcd3 formats 2011-07-09 21:35:19 +09:00
Akira Matsuda
7f37ed0152 fix AR having() not to raise NoMethodError when the given argument does not respond to empty?
having raises NoMethodError: undefined method `empty?' when a Fixnum or Date/Time were passed via varargs
2011-07-09 21:35:09 +09:00
Jon Leighton
ca94acf0be Foo.joins(:bar).includes(:bar) should result in a single query with :bar as a join. Related: #1873. 2011-07-09 11:39:38 +01:00
Ryan Bigg
7a8b0eced7 Add section about debugging assets 2011-07-09 12:26:25 +02:00
Ryan Bigg
d0f9a31a0d Clarify that per-controller asset files are not 'magically' loaded by the controller, but rather need to be required 2011-07-09 12:26:16 +02:00
Christopher Scott Hernandez
d17d45595b Updated active_record_querying.textile: intro paragraph of 'Conditions' to change 'find method' to 'where method' 2011-07-09 12:25:57 +02:00
Vijay Dev
6dad5b2d11 update Rails version. (rails console didn't exist in 2.1) 2011-07-09 12:25:49 +02:00
Oge Nnadi
2f5ebd9a0e Changed the value that log_level takes to match the examples in the paragraph above 2011-07-09 12:25:40 +02:00
Akira Matsuda
3cb67e442f find(:first) => first 2011-07-09 12:24:07 +02:00
Shawn Drost
a9f4d7b4d2 document HashWithIndifferentAccess#extractable_options? 2011-07-09 12:22:57 +02:00
JudeArasu
4f36daf1a6 rails text been added before version 2011-07-09 12:22:50 +02:00
James Miller
bd13a6824e Remove attachment_fu, add CarrierWave to suggested uploader libraries 2011-07-09 12:22:42 +02:00
Santiago Pastorino
2aefff8f76 config should always be an AS::InheritableOptions object. Closes #1992 2011-07-08 21:44:31 -03:00
Xavier Noria
7cef8ad32f backports f6a6b51 and ad912c0 2011-07-09 00:10:50 +02:00
Tomas D'Stefano
15f5c3bcbd Destroy association habtm record before destroying the record itself. Fixes issue #402. 2011-07-08 22:31:50 +01:00
Jon Leighton
6d2acc1195 Ensure that the foreign key gets set when doing record.create_association or record.create_association. Fixes #1960. 2011-07-08 21:03:40 +01:00
José Valim
9370855d54 Move config.default_asset_host_protocol to the railtie. 2011-07-07 19:16:36 -03:00
Santiago Pastorino
d7be017c7e Merge pull request #2002 from knapo/3-1-stable
Backport of #1997
2011-07-07 09:30:16 -07:00
Santiago Pastorino
0b62aa021f Merge pull request #2001 from tobsch/3-1-stable
Now accepting css/js files in deeper directory structures by default.
2011-07-07 09:23:13 -07:00
knapo
7c051ab075 Make ActiveRecord::Batches#find_each to not return self.
This caused that `find_each` was producing extra db call taking all the records from db, and was less efficient than `ActiveRecord::Base#all`.
2011-07-07 18:13:29 +02:00
Tobias Schlottke
564139620c Now accepting css/js files in deeper directory structures by default.
This is useful for engines with own application.{js|css}-files.
See: https://github.com/rails/rails/issues/1520
2011-07-07 17:56:48 +02:00
Dmitriy Kiriyenko
fd8dbfa776 Add require ActiveSupport delegation to ActiveRecord::Relation class. 2011-07-07 17:09:03 +02:00
Santiago Pastorino
ec27814883 Merge pull request #1990 from simonbaird/3-1-stable
rake db:test:purge creates mysql database with wrong charset & collation (3-1-stable)
2011-07-06 20:10:17 -07:00
José Valim
8d0f03923c Give higher priority to assets.cache_store. 2011-07-06 18:00:39 -07:00
José Valim
d8e2a1fd8a Make compressors lazily load. 2011-07-06 21:45:36 -03:00
Jon Leighton
fe2167f3f1 Don't construct association scope in initializer. This yields a big performance gain for cases where the association is never used to load the target, for example with preloading. Related: #1873. 2011-07-07 01:08:06 +01:00
Simon Baird
f44c3ea457 Fix charset/collate in mysql recreate_database
See new method mysql_creation_options. It is used by both
create_database and recreate_database so they are consistent.

(Manual cherry pick of 3ba3125b24)
2011-07-07 09:43:16 +10:00
José Valim
a05d59fe06 Deprecate stream at the class level.
This is because only template rendering works with streaming.
Setting it at the class level was also changing the behavior
of JSON and XML responses, closes #1337.
2011-07-06 20:33:01 -03:00
Santiago Pastorino
3a92bc7906 Merge pull request #1789 from grantneufeld/schema_column_exists_options_hash_3_1
Fix default options argument on ActiveRecord::ConnectionAdaptors::Table#column_exists?
2011-07-06 12:00:35 -07:00
Santiago Pastorino
e7ac539c62 Merge pull request #1904 from oriolgual/1571_fix_for_3_1_stable
Fix #1571 for 3-1-stable
2011-07-06 11:57:36 -07:00
Oriol Gual
7c6a8406f4 Fix reverse order with new Arel Nodes (#1571) 2011-07-06 20:50:56 +02:00
Santiago Pastorino
d5bc701e87 Merge pull request #1982 from spohlenz/backport-1778
Backport of #1778 (fix nested fields_for when Hash-based model is passed)
2011-07-06 11:36:05 -07:00
Santiago Pastorino
01d881cb3e Merge pull request #1895 from arunagw/fix_test_for_jruby_db-3-1-stable
Fix test for jruby db 3 1 stable
2011-07-06 11:15:55 -07:00
Xavier Noria
afe8eb56ec Merge pull request #1983 from vijaydev/cherrypicks-validator-gem
Cherrypick for 3-1-stable - adding w3c_validators gem
2011-07-06 05:37:19 -07:00
Vijay Dev
53903f4265 add w3c_validators gem to the doc group to fix failing validation of guides 2011-07-06 17:50:54 +05:30
Sam Pohlenz
7f3e45c2ec Test for extractable_options? within nested fields_for.
This fixes an error when a record object that is a subclass of Hash is
passed to fields_for, which is incorrectly interpreted as field options.
2011-07-06 21:25:07 +09:30
Xavier Noria
07ea84a03b syncs guides with master 2011-07-05 01:49:25 +02:00
Dieter Komendera
5a7c8e27eb Only call set_owner_attributes for has_one association if target exists. 2011-07-05 00:15:43 +01:00
Andrew White
5bb37ab867 Revert "The rails gem doesn't have a lib directory."
RubyGems requires at least one require_path.

This reverts commit 92c852f7e2.
2011-07-04 16:57:36 +01:00
Andrew White
92c852f7e2 The rails gem doesn't have a lib directory. 2011-07-04 14:54:29 +01:00
Andrew White
cee27beb0c Use an instance variable to store the current masss assignment options
(cherry picked from commit 9f7442a3ab)
2011-07-04 06:49:15 +01:00
Vijay Dev
d764378489 Reversing the changes done in c278a2c while still resolving #1857.
The changes broke bulk migration tests and were fixed in 4d256bc6;
however that brought back the issue of #1857 and so this commit goes
back to the original scenario and just adds change_table to the list
of methods which are to be recorded in the CommandRecorder. The
method_missing now delegates all calls to the underlying connection as
before.
2011-07-03 17:28:03 +01:00
José Valim
9ed063244a Merge pull request #1949 from dmathieu/cherry-picks
Cherry picks for 3-1-stable
2011-07-03 07:17:18 -07:00
Damien Mathieu
a96d77aac4 all numerics should be html_safe - Closes #1935 2011-07-03 16:12:51 +02:00
Prem Sichanugrist
01c1a86566 Fix failing test on uninitialized Rails.config.assets.prefix
This was introduced in [2684f17a17] 💣
2011-07-03 15:58:33 +02:00
José Valim
91718c866b Merge pull request #1947 from spohlenz/refactor-asset-paths-3-1
Refactor sprockets asset paths to allow for alternate asset environments
2011-07-02 21:15:09 -07:00
Sam Pohlenz
b494b5cf9d Add documentation for asset_prefix and asset_environment
(cherry picked from commit 21344bc33b)
2011-07-03 13:40:30 +09:30
Sam Pohlenz
add63ee220 Add tests for alternate asset prefix/environment
(cherry picked from commit 0613f3bcdb)
2011-07-03 13:40:19 +09:30
Sam Pohlenz
b8fa5f65a6 Refactor sprockets asset paths to allow for alternate asset environments 2011-07-03 13:40:01 +09:30
José Valim
108210cffe Merge pull request #1946 from spohlenz/fix-engine-migrations-check-3-1
Fix engine migrations check
2011-07-02 21:08:41 -07:00
Sam Pohlenz
55d93f3221 Fix has_migrations? check in Rails::Engine
(cherry picked from commit a7a58af244)
2011-07-03 13:32:54 +09:30
Santiago Pastorino
986e193b8c Merge pull request #1942 from dmathieu/url_for
Cherry Pick for 1940
2011-07-02 18:17:56 -07:00
Damien Mathieu
827e8a5983 provide a more explicit message when using url_for with nil
This fixes the problem of having a non-explicit message when the :location option is not provided in respond_with.
2011-07-03 02:13:53 +02:00
Aaron Patterson
896638238b a few minor performance improvements: fewer strings, fewer range objects, fewer method calls 2011-07-01 15:20:28 -07:00
José Valim
b6315d597b require 'thread' before using Mutex 2011-07-01 14:52:28 -07:00
Aaron Patterson
37eef89a2b calling super is super. if the other object is exactly equal, we can return early 2011-07-01 14:39:13 -07:00
Aaron Patterson
d5de496b87 remove unused codes 2011-07-01 14:39:10 -07:00
Andrew White
7467df72a8 It's autoload all the way down
(cherry picked from commit 2d16515e52)
2011-07-01 21:45:08 +01:00
Andrew White
a8410a2ca5 Don't require ActionView::Context as it's autoloaded
(cherry picked from commit 79924c637d)
2011-07-01 20:38:03 +01:00
Andrew White
0155e10a73 Revert "Add missing require for ActionView::AssetPaths"
This reverts commit ad1d3db983.
2011-07-01 20:37:37 +01:00
Andrew White
1e56adacee Add missing requires for ActionView::Context and Module#instance_method_names
(cherry picked from commit fdaecbed84)
2011-07-01 20:20:16 +01:00
Andrew White
ad1d3db983 Add missing require for ActionView::AssetPaths
(cherry picked from commit 987eb7d423)
2011-07-01 20:19:53 +01:00
Ernie Miller
280b657e60 Require attr_internal before using in ActionView::Helpers
(cherry picked from commit 3a2ef52ad6)

Signed-off-by: Andrew White <andyw@pixeltrix.co.uk>
2011-07-01 20:19:06 +01:00
Aaron Patterson
2d459d25dc reduce calls to owners_by_key and to read_attribute, respond_to? etc 2011-07-01 09:56:00 -07:00
Bogdan Gusiev
337a446ab2 Fixed ActionView::FormOptionsHelper#select with :multiple => false
(cherry picked from commit 0fdac01876)

Signed-off-by: Andrew White <andyw@pixeltrix.co.uk>
2011-07-01 13:00:55 +01:00
Jon Leighton
92c68dabd5 Add an extremely lulzy deprecation warning which tries to detect if AssociationReflection#build_association has been overridden, but ignores the block argument. 2011-06-30 23:39:43 +01:00
Jon Leighton
65813a6317 Assign the association attributes to the associated record before the before_initialize callback of the record runs. Fixes #1842. 2011-06-30 23:39:43 +01:00
Jon Leighton
da9c79b693 Remove AssociationReflection#create_association and AssociationReflection#create_association! - they are not called from anywhere. 2011-06-30 23:39:43 +01:00
Aaron Patterson
ef787cf3e3 match method signature of the superclass 2011-06-30 15:32:51 -07:00
Aaron Patterson
19f5576de3 call super rather than delegating to the other objects equal? method 2011-06-30 15:32:47 -07:00
Aaron Patterson
94d2b0b62a just alias eql? to == for frewer method calls 2011-06-30 15:32:42 -07:00
Aaron Patterson
83005cf501 only calculate method name once 2011-06-30 15:32:38 -07:00
Aaron Patterson
68b8710f8d cache the plural name on the reflection so we do not pay pluralize costs on joins 2011-06-30 15:32:34 -07:00
José Valim
e495ad8ddd Make sure respond_with with :js tries to render a template in all cases 2011-06-30 11:48:01 -03:00
Santiago Pastorino
185ba01baf Bump up rack-cache and tzinfo 2011-06-30 10:09:52 -03:00
Santiago Pastorino
ba09937983 Allow CI to use the latest rubygems version 2011-06-30 08:33:48 -03:00
Santiago Pastorino
314d40a819 Update CI config 2011-06-30 08:33:48 -03:00
José Valim
cb307d1c4a Add has_key? and key? methods to CookieJar removed in 0ca69ca65f 2011-06-30 08:02:37 -03:00
José Valim
8471d43596 Merge pull request #1912 from arunagw/new_plugin_g_test
Fix plugin_new_generator_test.rb
2011-06-30 02:11:17 -07:00
Arun Agrawal
ae94305b6f Fix test for plugin_new_generator_test.rb 2011-06-30 08:40:50 +05:30
Santiago Pastorino
a6d8fefd86 Move Coffee generators and templates to Coffee Railtie and create javascript_engine ("js") for apps that remove Coffee gem 2011-06-29 21:18:42 -03:00
Jon Leighton
22bcb4e093 CommandRecorder should delegate in method_missing where possible. Fixes some tests in migration_test.rb under mysql. The problem was introduced in c278a2c5e1. 2011-06-30 00:48:03 +01:00
Jon Leighton
b09ef6d139 Define to_ary on ActiveRecord::Base to return nil. Improve performance of Array#flatten under 1.9, see comment for details. 2011-06-30 00:20:38 +01:00
Xavier Noria
dc921ffae3 sub suffices here 2011-06-29 23:47:28 +02:00
José Valim
c093ea9f4e Fix configurable cristalization and tests. 2011-06-29 13:58:34 -03:00
José Valim
fe6e890f63 [IMPORTANT] Make "sprockets/railtie" require explicit.
This makes "sprockets/railtie" explicit. This means that sprockets will
be loaded when you require "rails/all". If you are not using requiring
"rails/all", you need to manually load it with all other framework
railties.

In order to be complete, this commit also adds --skip-sprockets to
the rails generator.
2011-06-29 09:42:36 -03:00
Rashmi Yadav
df5971d093 3-1-stable fix test when running Jruby. If Jruby Platform is available the gem will change. 2011-06-29 08:18:13 +05:30
José Valim
0b794f91e9 Update railties.gemspec 2011-06-28 20:56:51 -03:00
José Valim
20db68701a Copy the bin to railties so it also works if you don't have the rails gem. 2011-06-28 20:56:44 -03:00
Arun Agrawal
23f7dad6c6 Using not effected timezone in tests. 2011-06-28 16:53:59 -07:00
Santiago Pastorino
4cee36044b Merge pull request #1885 from guilleiguaran/3-1-stable
Bump ARel to 2.1.3 (3-1-stable)
2011-06-28 14:59:10 -07:00
Guillermo Iguaran
4b12d7f369 Bump ARel to 2.1.3 2011-06-28 16:04:30 -05:00
Raimonds Simanovskis
cbf3e33176 Fix test_finding_with_cross_table_order_and_limit for Oracle
Use latest Arel syntax and pass each order by expression as separate argument to order method as otherwise invalid Oracle SQL is generated.
2011-06-28 13:49:35 -07:00
Ernie Miller
c26c273761 Support reversal of ARel orderings in reverse_sql_order 2011-06-28 13:12:58 -07:00
Vijay Dev
eb3e523434 record unsupported methods in CommandRecorder instead of letting the unsupported methods go through to the underlying db causing errors like duplicate columns to occur when rolling back migrations 2011-06-28 12:05:52 -07:00
Damien Mathieu
f170045c59 comparing different classes returns nil 2011-06-28 11:47:37 -07:00
Damien Mathieu
c5b43afd6c allow comparison on model objects - Closes #1858 2011-06-28 11:47:32 -07:00
Aaron Patterson
e0fae7265f remove useless assignment 2011-06-28 10:58:08 -07:00
Aaron Patterson
d8646163e5 lock_optimistically is typically true, so evaluate the common failure case first 2011-06-28 10:51:32 -07:00
Aaron Patterson
558b5bb490 reduce object allocation during AR instantiation 2011-06-28 10:22:47 -07:00
Aaron Patterson
196f92f366 remove the check for needs_type_condition? because ensure_proper_type will pick up the type column 2011-06-27 20:44:49 -07:00
Aaron Patterson
992b3b5e06 stop using && for the short circuit side effect 2011-06-27 18:16:16 -07:00
Aaron Patterson
5d954b4e38 let strings be converted to symbols inside the interpreter 2011-06-27 18:16:12 -07:00
Aaron Patterson
9fd0d91b26 avoice paying hash cost if there are no serialized attributes 2011-06-27 17:47:13 -07:00
Aaron Patterson
2fe088a53d cache column defaults for AR object instantiation 2011-06-27 17:47:09 -07:00
Aaron Patterson
b927f0a894 AR object instantiation is ~30% faster in the simple case 2011-06-27 16:15:44 -07:00
Aaron Patterson
0de56aac7f initialize instance variables 2011-06-27 14:47:32 -07:00
Aaron Patterson
3a14e6fdd5 oops! remove debugging codes 2011-06-27 14:47:27 -07:00
Aaron Patterson
0abb7b8c39 default create_with_value to a hash so we can eliminate conditionals, add test surrounding create_with(nil) behavior 2011-06-27 14:19:22 -07:00
Xavier Noria
3f759bfa7d the generated ALT attribute for images no longer contains the digest, if any 2011-06-27 23:00:52 +02:00
David Heinemeier Hansson
7d0c725a49 Merge pull request #1699 from chriseppstein/asset_urls
asset_path will now use asset_host definition
2011-06-27 12:19:56 -07:00
José Valim
0f128b1f67 Skip if it is actually a pluralize scheme. 2011-06-27 11:27:39 -07:00
José Valim
14cfc4503d Edited railties/lib/rails/paths.rb via GitHub 2011-06-27 09:55:28 -07:00
Chris Eppstein
4b8bd7a54f Merge remote-tracking branch 'rails/3-1-stable' into asset_urls
* rails/3-1-stable: (49 commits)
  Add JavaScript Runtime name to the Rails Info properties (thanks Sam Ruby)
  Merge pull request #1481 from arunagw/lib_assets
  Improve ordering of multiple columns on postgresql
  judgement -> judgment, according to guidelines
  Follow rails convention by using Array.wrap
  Allow to specify mass-assignment roles as array
  Apply the default scope earlier when doing calculations. Fixes #1682.
  updated rspec link
  grammar changes in named routes description and clarity around possibilities for options
  font style changes in perf guide
  grammar changes to log subscriber docs
  move example code to be above reconfiguring discussion; add clarity about silencers and filters; misc grammar changes - for backtrace cleaners
  Fixed typo
  use present tense on examples
  more detail on how the flow between redirect and show works, and minor grammar
  remove extra space and clarify how an exception is made for controller wide layouts
  reorder layout selection examples to occur in the order that the code does, and provide more detail on why each selection is made
  singularize module and be explicit about what is delivered
  grammar (missing "a") and formatting
  elaborate details on why to use _url instead of _path in mailers
  ...

Conflicts:
	actionpack/lib/action_view/helpers/asset_paths.rb
	actionpack/lib/sprockets/helpers/rails_helper.rb
2011-06-27 08:56:37 -07:00
David Heinemeier Hansson
94c08a6f95 Add JavaScript Runtime name to the Rails Info properties (thanks Sam Ruby) 2011-06-27 11:59:23 +02:00
David Heinemeier Hansson
7423e22092 Merge pull request #1481 from arunagw/lib_assets
Generating /lib/assets  for assets
2011-06-27 11:49:42 +02:00
Santiago Pastorino
54531b87b6 Merge pull request #1849 from raviolicode/postgresql-fix-3-1
[3-1-stable] Fix for complex ordering of multiple columns on postgresql
2011-06-24 15:05:44 -07:00
Lucia Escanellas
975ff5debb Improve ordering of multiple columns on postgresql
* Only on postgresql, order("first asc, second asc") was invalid
* Closes #1720
2011-06-24 17:48:22 -03:00
Santiago Pastorino
e65f11494c Merge pull request #1844 from jeroenj/cachesweeper-fix-3-1
Fixes an issue where cache sweepers
2011-06-24 08:44:42 -07:00
Xavier Noria
2bdc381483 judgement -> judgment, according to guidelines 2011-06-24 17:19:42 +02:00
José Valim
c8ff12ca97 Merge pull request #1839 from wildchild/3-1-stable
Allow to specify roles for mass-assignment as array
2011-06-23 18:34:06 -07:00
Alexander Uvarov
79956db91c Follow rails convention by using Array.wrap 2011-06-24 03:27:54 +06:00
Alexander Uvarov
52302f0856 Allow to specify mass-assignment roles as array 2011-06-24 03:20:28 +06:00
Jon Leighton
03580e0fa3 Apply the default scope earlier when doing calculations. Fixes #1682. 2011-06-23 19:58:15 +01:00
Mikhail Dieterle
43141e9a17 updated rspec link 2011-06-23 18:18:13 +02:00
Matt Jankowski
bad16df756 grammar changes in named routes description and clarity around possibilities for options 2011-06-23 18:18:07 +02:00
Vijay Dev
e002cf2fa6 font style changes in perf guide 2011-06-23 18:18:02 +02:00
Matt Jankowski
3cebef78c2 grammar changes to log subscriber docs 2011-06-23 18:17:57 +02:00
Matt Jankowski
eaee931f5d move example code to be above reconfiguring discussion; add clarity about silencers and filters; misc grammar changes - for backtrace cleaners 2011-06-23 18:17:51 +02:00
Mikhail Dieterle
6d4e3f3a0a Fixed typo 2011-06-23 18:17:46 +02:00
Matt Jankowski
877153843a use present tense on examples 2011-06-23 18:17:39 +02:00
Matt Jankowski
56cf974dbc more detail on how the flow between redirect and show works, and minor grammar 2011-06-23 18:17:34 +02:00
Matt Jankowski
26284ad475 remove extra space and clarify how an exception is made for controller wide layouts 2011-06-23 18:17:28 +02:00
Matt Jankowski
cf1341f386 reorder layout selection examples to occur in the order that the code does, and provide more detail on why each selection is made 2011-06-23 18:17:23 +02:00
Matt Jankowski
b3d8e50d4c singularize module and be explicit about what is delivered 2011-06-23 18:17:17 +02:00
Matt Jankowski
30ac5fffec grammar (missing "a") and formatting 2011-06-23 18:17:11 +02:00
Matt Jankowski
bb679d2cae elaborate details on why to use _url instead of _path in mailers 2011-06-23 18:16:50 +02:00
Arun Agrawal
57bdf7eabf Closing </yaml> 2011-06-23 18:16:23 +02:00
Vijay Dev
ae8d53e586 document Active Record's reverse_order method 2011-06-23 18:16:17 +02:00
Vijay Dev
741a417c72 AR: use where in place of find 2011-06-23 18:16:10 +02:00
Vijay Dev
421841d838 minor changes in getting started guide 2011-06-23 18:16:04 +02:00
Vijay Dev
f2d18b83ad document the instance_reader option for class_attribute 2011-06-23 18:15:58 +02:00
Aaron Patterson
98ae4821bb Merge pull request #1795 from metaskills/ss_db_tasks
Update SQL Server DB Rake Tasks
2011-06-23 09:09:25 -07:00
Jeroen Jacobs
2b72bb9846 Tests only after filters in cache sweepers 2011-06-23 17:56:37 +02:00
Jeroen Jacobs
a46d231c79 Fixes an issue where cache sweepers with only after filters would have no controller object
It would raise undefined method controller_name for nil
2011-06-23 17:56:24 +02:00
José Valim
90b47bdc34 Edited actionpack/actionpack.gemspec via GitHub 2011-06-23 07:39:45 -07:00
Joshua Peek
a70f65cbdd Revert "Bump sprockets requirement"
This reverts commit 5a7465c2d7.
2011-06-22 11:28:29 -05:00
José Valim
5e7efbf793 Update CHANGELOG. 2011-06-22 12:51:22 -03:00
Aaron Patterson
15f09c5e32 Merge pull request #1809 from nicksieger/more-jruby-gem-for-database-fixes
More jruby gem for database fixes
2011-06-21 13:21:58 -07:00
Nick Sieger
4a5f1ce939 Use non-'jdbc*' names so that db:create and db:drop work 2011-06-21 13:10:05 -07:00
Nick Sieger
1cbbe067d4 Convert database names to ones appropriate for JRuby 2011-06-21 13:10:05 -07:00
Nick Sieger
198cd8bcc1 Add generic 'jdbc' database option 2011-06-21 13:08:59 -07:00
Nick Sieger
e1d6667652 Remove superfluous pg driver install instructions 2011-06-21 13:08:59 -07:00
José Valim
2d3a98db94 Require helpers so autoload is properly setup. 2011-06-21 15:21:53 -03:00
José Valim
4d3719a042 Merge pull request #1804 from guilleiguaran/3-1-stable
Use uglifier from rubygems instead of git repo  (3-1-stable)
2011-06-21 09:51:22 -07:00
Guillermo Iguaran
ddf224c1b9 Use uglifier from rubygems instead of git repo 2011-06-21 11:29:04 -05:00
Joshua Peek
5a7465c2d7 Bump sprockets requirement 2011-06-21 11:27:48 -05:00
José Valim
36123b92ee Don't use deprecated stuff. 2011-06-21 13:05:49 -03:00
Joshua Peek
9324b54c33 Assign Rails.cache to sprockets 2011-06-21 09:38:25 -05:00
José Valim
c4794b08ec Create an :assets group in the Gemfile.
This group is required by default only on development and test
(you can change it on config/application.rb).

`rake assets:precompile` will automatically add the assets group
to Rails.groups (and consequently Bundler.require) and should work
transparently.
2011-06-21 11:30:45 -03:00
José Valim
db909f8b3a Rename AV::Helpers::AssetPaths to AV::AssetPaths to solve autoload mess. 2011-06-21 11:27:27 -03:00
José Valim
77b00cb500 Add Rails.groups to encapsulate available groups for require. 2011-06-21 11:25:48 -03:00
Ken Collins
e5cf2add10 Update SQL Server db related rake tasks.
* Uses open source smoscript since scptxfr came out in 2000.
  * Uses sqlcmd which replaces osql.
  * Takes advantage of host/user/pass passed down by TinyTDS.
2011-06-20 22:08:31 -04:00
José Valim
7ff4aeddbe Merge pull request #1791 from cmeiklejohn/3-1-stable
Cherry pick of pull #1787 into 3-1-stable
2011-06-20 11:32:48 -07:00
Christopher Meiklejohn
03d01ec73e Streamline fragment_for SafeBuffer logic to make it more concise and robust against unsafe buffers. 2011-06-20 14:20:58 -04:00
Grant Neufeld
88aa2efd69 Fix default options argument on ActiveRecord::ConnectionAdaptors::Table#column_exists?
Changed the default value for the `options` argument on `ActiveRecord::ConnectionAdapters::Table#column_exists?` from `nil` to an empty Hash `{}`.

That method calls through to `ActiveRecord::ConnectionAdapters::SchemaStatements#column_exists?` which expects `options` to be a Hash.

When `options` was `nil`, an error would occur in cases where the column did exist because the called method attempted to perform a key lookup on options.
2011-06-20 11:45:20 -06:00
Daniel Azuma
f542188e7a Add missing require 'set'
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-06-20 08:53:39 -03:00
José Valim
c533517362 Merge pull request #1773 from bensie/class-attr-3-1-stable
Instance reader method on class_attribute - 3-1-stable
2011-06-19 09:09:04 -07:00
James Miller
e5f6abd1ff Add option to omit creating an instance reader method on class_attribute 2011-06-19 08:28:58 -07:00
José Valim
e402b688cc Merge pull request #1771 from arunagw/require_rel_remove
Require rel remove from 3-1-stable
2011-06-19 04:52:44 -07:00
José Valim
9dca40d4d4 Merge pull request #1768 from stevehodgkiss/3-1-stable
3 1 stable
2011-06-19 04:50:21 -07:00
Xavier Noria
cbd6fa7c05 explains why links are gsub'ed, and changes the regexp delimiters
Conflicts:

	Rakefile
2011-06-19 11:41:45 +02:00
Arun Agrawal
7e7ac1239d Removing require_relative gem. Linecache new version 0.46 is out and
it's loading rbx-require-relative > 0.0.4
2011-06-19 15:08:35 +05:30
Steve Hodgkiss
aba7a43273 Fix inconsistencies by being polite to the wrapped body. Needed for Rack::Sendfile to function properly. See issue #1761. 2011-06-19 06:05:13 +01:00
Chris Eppstein
0e5891ad91 Added a configuration setting:
config.action_controller.default_asset_host_protocol

It's best to leave this unset.

When unset the :request protocol is used whenever it can be and
:relative is used in the other situations.

When set to :request then assets hosts will be disabled when there
is no request in scope and will use the request protocol whenever a
request is in scope.

If set to :relative, then a relative protocol is always used except
for stylesheet link tags which must use the :request protocol to
avoid double downloads in IE6&7.
2011-06-18 12:12:58 -07:00
Chris Eppstein
97208647ef Move the config bootstrapping to initialization to minimize access to the Rails.application global. 2011-06-18 12:10:09 -07:00
Chris Eppstein
a2233638aa Merge remote-tracking branch 'rails/3-1-stable' into asset_urls
* rails/3-1-stable: (68 commits)
  Revert changes done in c56618ec, 51cb7459 and 030950a. The links are pointing to files/*/*.html for usage in api.rubyonrails.org and as a result are broken in GitHub blobs. This is unavoidable (at least for now).
  copy-edits 7c2db6c, cbf2af1, and f391f94
  Added 'Configuring Assets' section to configuring guide
  Update remove_index documentation
  Typo.
  minor clean up generators section
  add info that plugin installs need git or svn installed
  document doc:* rake tasks
  typo changes fixed
  fixed typo chnages
  add details on how to use specific annotations in rake:notes
  document how rake notes work
  The name for the plain text template in Rails3 appears to be method.text.erb, not, method.text.plain.erb.  Updated the doc to reflect this change.  Also fixed a reference to an example that was incorrect.
  form => form_for
  Tweak linebreak in ActionController::Redirecting doc
  Updated rails´s guides on the config.serve_static_assets and it´s settings in production mode using WEBrick. This documentation has it´s roots in #issue1657. You have to set config.serve_static_assets to true in production mode with WEBrick as only this includes ActionDispatch::Static.
  Improve documentation around status code argument of redirect_to
  minor copy edit 0bdeddb
  Jruby => JRuby, Mysql => MySQL
  Moving hint down. As required after all database examples.
  ...
2011-06-18 09:41:29 -07:00
Vijay Dev
7e65b00ab5 Revert changes done in c56618ec, 51cb7459 and 030950a. The links are
pointing to files/*/*.html for usage in api.rubyonrails.org and as a
result are broken in GitHub blobs. This is unavoidable (at least for now).

Conflicts:

	README.rdoc
2011-06-18 12:41:35 +02:00
Xavier Noria
1acc327223 copy-edits 7c2db6c, cbf2af1, and f391f94 2011-06-18 11:42:34 +02:00
Ryan Bigg
e516f2bc52 Added 'Configuring Assets' section to configuring guide 2011-06-18 11:42:28 +02:00
Lucia Escanellas
a7813a64a6 Update remove_index documentation
* Changes should better reflect present code behavior
* Related to issue: https://github.com/rails/rails/issues/1624
2011-06-18 11:42:06 +02:00
R.T. Lechow
e63fd899c7 Typo. 2011-06-18 11:42:01 +02:00
Vijay Dev
09d8c26a2f minor clean up generators section 2011-06-18 11:41:54 +02:00
Vijay Dev
334f62c454 add info that plugin installs need git or svn installed 2011-06-18 11:41:48 +02:00
Vijay Dev
a4f6227d1d document doc:* rake tasks 2011-06-18 11:41:39 +02:00
JudeAr
4ad6c331d5 typo changes fixed 2011-06-18 11:41:33 +02:00
JudeAr
d9bea8411a fixed typo chnages 2011-06-18 11:41:28 +02:00
Vijay Dev
063c432a39 add details on how to use specific annotations in rake:notes 2011-06-18 11:41:23 +02:00
Vijay Dev
96da5bda09 document how rake notes work 2011-06-18 11:41:17 +02:00
Jason Fox
6a8fd87c2e The name for the plain text template in Rails3 appears to be method.text.erb, not, method.text.plain.erb. Updated the doc to reflect this change. Also fixed a reference to an example that was incorrect. 2011-06-18 11:41:10 +02:00
Vijay Dev
96b82aa2be form => form_for 2011-06-18 11:41:03 +02:00
Christine Yen
bb139ed0cf Tweak linebreak in ActionController::Redirecting doc 2011-06-18 11:40:58 +02:00
thoefer
cb4fbe3ba3 Updated rails´s guides on the config.serve_static_assets and it´s settings in production mode using WEBrick. This documentation has it´s roots in #issue1657. You have to set config.serve_static_assets to true in production mode with WEBrick as only this includes ActionDispatch::Static. 2011-06-18 11:40:35 +02:00
Christine Yen
7e37db4218 Improve documentation around status code argument of redirect_to 2011-06-18 11:40:27 +02:00
Vijay Dev
b67621347e minor copy edit 0bdeddb 2011-06-18 11:40:20 +02:00
Arun Agrawal
35ee51f9b3 Jruby => JRuby, Mysql => MySQL 2011-06-18 11:40:14 +02:00
Arun Agrawal
05648ea9c5 Moving hint down. As required after all database examples. 2011-06-18 11:40:09 +02:00
Arun Agrawal
cf2818a15a Using "Finally" at the end of database section. 2011-06-18 11:40:03 +02:00
Arun Agrawal
0e1e61508f Added Doc for Postgresql database with Jruby Platform. #jruby 2011-06-18 11:39:57 +02:00
Arun Agrawal
739f8e9051 Added doc for Mysql database with Jruby platform #jruby 2011-06-18 11:39:51 +02:00
Arun Agrawal
f43ae976ae Adding doc for Sqlite3 database for Jruby platform #jruby 2011-06-18 11:39:44 +02:00
JudeArasu
c9c774dd73 typo changes 2011-06-18 11:39:38 +02:00
Sebastian Martinez
899c736cea Prefer Time.current over Time.now on example code 2011-06-18 11:39:33 +02:00
Sebastian Martinez
9387c70dbd Add Time#all_* to AS guides. 2011-06-18 11:39:26 +02:00
Vijay Dev
415f2e2b20 fix minor errors in nested model guide 2011-06-18 11:39:18 +02:00
Vijay Dev
78f880f48b document the instance_accessor option for cattr_accessor 2011-06-18 11:39:13 +02:00
Lukas Stejskal
108fdbaf31 fix two typos: and array -> an array 2011-06-18 11:39:07 +02:00
Robert Massaioli
4d3ec4c6a8 cycle: make an odd number be marked as odd.
Just a minor issue that was annoying me so I thought that I would jump in and fix it.
2011-06-18 11:39:00 +02:00
Vijay Dev
9994bd4750 assets are in app now and not in public 2011-06-18 11:38:23 +02:00
Sebastian Martinez
745665dc9d Add example for rails server port option. 2011-06-18 11:38:15 +02:00
thoefer
99aca48193 fixed typo for a methodname 2011-06-18 11:38:13 +02:00
Uģis Ozols
25d18746a8 with -> will 2011-06-18 11:37:57 +02:00
Vijay Dev
f73d1a6236 document server options 2011-06-18 11:37:49 +02:00
Vijay Dev
d010686ab0 more command guide changes 2011-06-18 11:37:43 +02:00
Vijay Dev
c71e78dad4 make some changes to the command line guide 2011-06-18 11:37:38 +02:00
Vijay Dev
2bc8ba6513 minor changes in templates guide 2011-06-18 11:37:32 +02:00
Vijay Dev
32aa7d5d14 add missing end in example 2011-06-18 11:37:26 +02:00
Vijay Dev
cbeb1c1e3d favor includes over old AR way 2011-06-18 11:37:19 +02:00
Vijay Dev
6a86a44734 fixed incorrect command usage. (This section needs to be updated in any case). 2011-06-18 11:37:08 +02:00
Vijay Dev
ee7043b89e minor fixes in action view guide 2011-06-18 11:37:02 +02:00
Santiago Pastorino
391b373986 Merge pull request #1752 from brianmario/bump-mysql2
Bump mysql2 to 0.3.6
2011-06-17 10:22:05 -07:00
Brian Lopez
89adadd39a bump mysql2 to 0.3.6 2011-06-17 09:32:43 -07:00
José Valim
6759e67304 Merge pull request #1749 from dmathieu/simple_format
Cherry pick changes to simple_format from master
2011-06-17 07:39:39 -07:00
Damien Mathieu
0ee586dffb cherry-pick changes in simple_format from master - Closes #1745 2011-06-17 16:35:52 +02:00
Jon Leighton
b2efd2a75a Add require 'pathname' as it has not already been required in some circumstances 2011-06-17 14:55:52 +01:00
Xavier Noria
61fd398825 AS guide: expands safe string docs regarding destructive methods, coercion, copying, etc. 2011-06-17 10:58:13 +02:00
Ken Collins
f960cb2832 Allow the connection pool's #table_exists? method to give the connections #table_exists? method a chance. 2011-06-17 09:05:13 +02:00
Jon Leighton
1cc0c3f52c Perf fix - Use an instance variable instead of a class_attribute. Thanks @josevalim and @jhawthorn for the prompting. 2011-06-16 21:16:54 +01:00
José Valim
f24d8fa796 Merge pull request #1735 from SAP-Oxygen/3-1-stable-app_plugins_ordering_patch
Patch for #1458 - [3.1.0.rc1] App plugins initialized before engines and plugins inside engines
2011-06-16 13:14:49 -07:00
José Valim
5be61ea5a9 Fix SafeBuffers by adding a dirty flag. 2011-06-16 17:05:53 -03:00
Joseph Wong
a89dfbf2e4 Patch for #1458 - [3.1.0.rc1] App plugins initialized before engines
and plugins inside engines

It seems that plugins inside a Rails 3.1 application proper (i.e. in
/vendor/plugins) are initialized before engines and plugins inside
engines.

After some debugging, I found the culprit in
Rails::Application::Railties#all:

  def all(&block)
    @all ||= railties + engines + super
    @all.each(&block) if block
    @all
  end

The call to super here implicitly passes the &block argument, which
has the unfortunate side-effect of adding the plugin initializers
first (in front of other railties and engines) in the case of
Rails::Engine#initializers:

def initializers
  initializers = []
  railties.all { |r| initializers += r.initializers }
  initializers += super
  initializers
end

The solution here is to replace the super call with a call
to #plugins.
2011-06-16 12:58:08 -07:00
wycats
f4db3d72ea Make the API for compression consistent between JS and CSS. By default, users just need to say whether they want compression or not, and a default will be chosen by a Railtie. In the case of CSS, this default is already chosen by the sass-rails gem.
Users can still explicitly choose a compressor in their application.rb if they have a preference, but will usually want to let plugins choose defaults in their Railties.
2011-06-16 12:08:26 -07:00
Chris Eppstein
ad161158de Stylesheet link tags should use the request protocol to avoid duplicate download of stylesheets in IE7 and IE8. 2011-06-16 09:03:05 -07:00
Santiago Pastorino
efa9695c21 Merge pull request #1728 from vijaydev/doc-merge-fix
Doc merge fixes (3-1-stable)
2011-06-16 06:19:04 -07:00
José Valim
c5930b406c Merge pull request #1726 from arunagw/mysql_bump_3-1-stable
Mysql bump to 0.3.5
2011-06-16 05:02:18 -07:00
José Valim
60a319040f Merge pull request #1460 from SAP-Oxygen/27d7083addd1bc8ecf0ef258a50c5e36eb980060
[3.1.0.rc1] Plugins inside engines not eager-loaded properly and their rake tasks ignored
2011-06-16 03:37:40 -07:00
Vijay Dev
eb89729370 fix merge errors 2011-06-16 11:37:38 +05:30
Arun Agrawal
bf588c69de Mysql bump 2011-06-16 10:48:28 +05:30
Santiago Pastorino
014008d349 Merge pull request #1724 from brianmario/lazy-mysql2-casting
re-enable eager-casting for mysql2
2011-06-15 20:23:16 -07:00
Brian Lopez
d2b13403ff bump mysql2 version 2011-06-15 20:17:35 -07:00
Brian Lopez
7b04e5051e on second thought, lets keep casting on by default. it can be disabled in database.yml by setting 'cast: false' 2011-06-15 20:03:12 -07:00
José Valim
a7039df4ce load_generators from engine should also handle self automatically. 2011-06-15 11:52:45 -07:00
Santiago Pastorino
677df61c82 Merge pull request #1719 from ryanb/fix_generated_engine_javascript
Fix generated JavaScript for mountable engine in 3-1-stable
2011-06-15 11:21:44 -07:00
Ryan Bates
7f9656640d properly require javascript libraries when generating mountable engine (from baf2a9c) 2011-06-15 11:16:11 -07:00
Santiago Pastorino
b4b27a34e9 Merge pull request #1716 from ryanb/namespace_engine_assets_3_1
Namespace engine assets for 3-1-stable
2011-06-15 10:45:26 -07:00
Ryan Bates
40dd641ede namespace engine assets 2011-06-15 09:58:38 -07:00
José Valim
1f813d98e0 Merge pull request #1713 from dmathieu/3-1-cherry
Cherry picking encoding for 3.1
2011-06-15 04:08:45 -07:00
Lukáš Konarovský
055a88d345 Use assert_equal instead of assert in uploaded file test. 2011-06-15 13:03:07 +02:00
Damien Mathieu
fa5529366c all requests are utf-8. Don't use the external encoding. 2011-06-15 13:01:30 +02:00
Damien Mathieu
f6fe174168 encode the uploaded file's name in the default external encoding - Closes #869 2011-06-15 13:01:25 +02:00
Damien Mathieu
9267a431b8 simplify to only one condition
Signed-off-by: Andrew White <andyw@pixeltrix.co.uk>
2011-06-15 09:52:02 +01:00
Andrew White
8624996f9c Make MissingTranslation exception handler respect :rescue_format 2011-06-15 01:21:59 +01:00
José Valim
5daef25f0a Merge pull request #1702 from brianmario/lazy-mysql2-casting
Turn off mysql2's eager-casting
2011-06-14 15:50:55 -07:00
Brian Lopez
aeb7beb3c6 mysql2 casting changes require mysql2 >= 0.3.3 2011-06-14 15:42:08 -07:00
Brian Lopez
e56567c0b2 Turn off eager casting for mysql2, so ActiveRecord can lazily cast values later. This should help performance for tables with complex types like DATETIME, TIMESTAMP 2011-06-14 15:17:01 -07:00
Joshua Peek
78587a5835 Fix appending sprockets paths 2011-06-14 14:41:51 -05:00
Joseph Wong
27d7083add Patch for https://github.com/rails/rails/issues/1460
[3.1.0.rc1] Plugins inside engines not eager-loaded properly and their
rake tasks ignored

Working with the new support for plugins inside engines in Rails 3.1,
I found that certain things that work for regular plugins don't work
for these new nested plugins. In particular, these methods in
Rails::Engine don't seem to understand that an engine could have
nested plugins:

#load_tasks
#load_generators
#load_console
#eager_load!

A solution which worked out for me is to move the calls to
railties.all { ... } from the overriding methods in Rails::Application
into Rails::Engine.
2011-06-14 11:11:26 -07:00
Chris Eppstein
1380a6180a Add asset_url helper and refactor the asset paths so that asset hosts can be used during asset precompilation. 2011-06-14 09:51:51 -07:00
Chris Eppstein
729d8688af OrderedOptions must implement respond_to? if it implements method_missing. 2011-06-14 09:51:51 -07:00
Jon Leighton
34d16e1ff6 Add Gemfile dependency for require_relative on mri18. This is a dependency of linecache which is a dependency of ruby-debug. However, the latest release of linecache (0.45) omits the dependency from its gemspec, causing the build to fail. I have emailed the maintainer so we should remove this when it's fixed upstream. 2011-06-13 22:20:29 +01:00
Andrew White
a52b14100a Remove obsolete compatibility module 2011-06-13 18:29:15 +01:00
Andrew White
45509ee6b7 Pass mass-assignment options to nested models - closes #1673. 2011-06-13 13:07:44 +01:00
Andrew White
113466cd94 Rename tests to reflect associations 2011-06-13 10:02:24 +01:00
José Valim
00c12ff100 Merge pull request #1675 from thoefer/3-1-stable
Fix for startup problems due to deprecation warning on nested models
2011-06-13 01:17:28 -07:00
thoefer
1863f12713 Make sure to have a Hash under the i18n keys 'activerecord.attributes' and 'activerecord.models' as this might not always be the case. See issue #1662. 2011-06-12 21:28:38 +02:00
Jon Leighton
fb1fd61634 Add support for using an ARCONFIG environment variable to specify the location of the config.yml file for running the tests 2011-06-12 19:13:25 +01:00
Jon Leighton
df63c99f06 Replace inline lambdas with named methods 2011-06-12 18:31:42 +01:00
Jon Leighton
bdd549a1c0 Refactor tests to be less brittle 2011-06-12 18:31:26 +01:00
Jon Leighton
5f43a2a2b1 Move BEGIN and COMMIT into IGNORED_SQL rather than having them as a special case in assert_queries 2011-06-12 18:31:20 +01:00
benedikt
b17fd25a2d Don't wrap operations on collection associations in transactions when they are not needed, so the connection adapter does not send empty BEGIN COMMIT transactions blocks to the database. 2011-06-12 18:26:29 +01:00
Andrew White
c1938d16fd Define ActiveSupport#to_param as to_str - closes #1663 2011-06-12 15:23:12 +01:00
Xavier Noria
e51b8fb38e backslash insertion for RDoc main page ignores code blocks, also adds comments to explain what's this hack about 2011-06-12 15:04:02 +02:00
José Valim
edc0b2b80b Make i18n tests more robust. 2011-06-12 12:44:27 +02:00
Xavier Noria
7c4625a113 revises the pattern that excludes generator templates in API generation
With the previous pattern RDoc processed

    railties/lib/rails/generators/rails/plugin_new/templates/test/%name%_test.rb

and that resulted in a spurious "<" class.
2011-06-12 12:09:54 +02:00
José Valim
0bbc145f68 Update CHANGELOG. 2011-06-11 18:04:27 +02:00
José Valim
c19bd4f88e Add a deprecation for nested i18n namespace lookup. 2011-06-11 17:58:07 +02:00
José Valim
83efad01e9 Get rid of the alternate namespace lookup. 2011-06-11 17:31:11 +02:00
Santiago Pastorino and José Ignacio Costa
41b73fe033 Revert "Make sure that we don't perform in-place mutation on SafeBuffer string"
This reverts commit 317e7c829d.
2011-06-10 23:08:58 -03:00
Aaron Patterson
e88508eb20 Merge pull request #1641 from sikachu/3-1-stable-render-inline
Render inline fix for 3-1-stable
2011-06-10 16:28:06 -07:00
Xavier Noria
0127cf652c s/Bundle/Bundler/ 2011-06-11 01:19:18 +02:00
Xavier Noria
467772b3ea shell out to run bundler on app generation, see rationale in the comment 2011-06-11 01:19:10 +02:00
thoefer
dfca4d1f08 Fixed minor typo: 'Arraw' to 'Array' 2011-06-11 01:16:45 +02:00
ganesh
b3ade0cc05 shallow_path example updated 2011-06-11 01:16:40 +02:00
John Hinnegan
e17d4e0651 update palmist link on performance_testing 2011-06-11 01:16:35 +02:00
Ben Orenstein
f0d7aa25f0 Describe the user name 'variable' in a way that doesn't confuse the textile parser. 2011-06-11 01:16:18 +02:00
Bratish Goswami
3e29f6ae62 Added acronym and reference link for Model–view–controller
Conflicts:

	README.rdoc
2011-06-11 01:14:21 +02:00
Vijay Dev
0ac6f8a77b minor corrections in configuring guide 2011-06-11 01:13:31 +02:00
Vijay Dev
9ce59acf8c remove generators section from command line guide in favor of the separate generator guide 2011-06-11 01:13:23 +02:00
Vijay Dev
cc1e983ab0 fix generators guide url 2011-06-11 01:13:14 +02:00
Vijay Dev
ed863a01ef use git: rather than https: in git remote urls; else, github asks for passwords everytime we push 2011-06-11 01:13:07 +02:00
Vijay Dev
a1a1d62bc0 minor fixes from 5acf76d 2011-06-11 01:12:56 +02:00
Vijay Dev
290708ce3d fix incorrect validation examples
Conflicts:

	railties/guides/source/active_record_validations_callbacks.textile
2011-06-11 01:12:41 +02:00
Vijay Dev
3de9d6b0ff fix typo
Conflicts:

	actionmailer/lib/action_mailer/base.rb
2011-06-11 01:11:51 +02:00
Prem Sichanugrist
317e7c829d Make sure that we don't perform in-place mutation on SafeBuffer string
This will make sure `render :inline` is working.

Closes #1633
2011-06-10 18:43:59 -04:00
Prem Sichanugrist
ff48edd442 Update CHANGELOG to mention the json_escape change 2011-06-10 18:43:50 -04:00
José Valim
55fd92f929 Merge pull request #1630 from BDQ/engine_migrations_3_1
Ensure engine migrations are copied in correct sequence for 3.1
2011-06-10 05:48:06 -07:00
Brian Quinn
b48f8090f4 Updated test to ensure correct sequence when copying engine/plugin migrations. 2011-06-10 13:02:37 +01:00
Stefan Sprenger
0fab87f824 Prepend bundle exec to get the correct Rake version 2011-06-10 13:02:33 +01:00
Brian Quinn
2d4d7ccf33 Ensure engine migrations are copied in the same sequence that they are required. 2011-06-10 12:59:41 +01:00
Andrew White
21a8dc7a79 Ensure number helpers can handle HTML safe strings - closes #1597. 2011-06-10 11:21:16 +01:00
Aaron Patterson
279781f896 bumping to 3.1.0.rc4 2011-06-09 15:53:49 -07:00
Aaron Patterson
58ac641d3e ensuring that json_escape returns html safe strings when passed an html safe string 2011-06-09 15:29:30 -07:00
Damien Mathieu
dc73c2c38f don't reinitialize the arel_table unless the table_name changes 2011-06-09 14:40:26 -07:00
Jacob Poulsgaard Tjoernholm
7cca6a2640 Fix issue #1598 by adding a dependency to the RDoc gem. 2011-06-09 14:38:13 -07:00
Aaron Patterson
9e71825d5f Merge pull request #1610 from sikachu/3-1-stable-javascript
Make sure `escape_javascript` return `SafeBuffer` if the incoming argumen
2011-06-09 11:39:09 -07:00
Prem Sichanugrist
66dbef6d79 Make sure escape_javascript return SafeBuffer if the incoming argument is already html_safe 2011-06-09 14:28:21 -04:00
David Heinemeier Hansson
fa6b12aeed Indention style + whitespace for readability 2011-06-09 01:29:25 +02:00
David Heinemeier Hansson
da8ba393bd If you set a js_compressor, it means that you want shit compressed -- we dont need a second option to turn that on 2011-06-09 01:28:56 +02:00
Aaron Patterson
aefd703443 bumping to 3.1.0.rc3 2011-06-08 14:34:20 -07:00
Marian Rudzynski
31023da1b6 use association_primary_key in AssociationScope#add_constraints
(cherry picked from commit 1f7c3d0264)
2011-06-08 22:03:51 +01:00
Aaron Patterson
5c498faeff Merge pull request #1566 from sikachu/3-1-stable-changelog
Update CHANGELOG to mention the new SafeBuffer change
2011-06-08 09:21:39 -07:00
Bhavin Kamani
696a94baa9 fix connection not established error while running rake task
db:schema:dump
(cherry picked from commit e9a2ff8bb7)
2011-06-08 17:12:23 +01:00
Prem Sichanugrist
d2b0605a3f Update CHANGELOG to mention the new SafeBuffer change 2011-06-08 11:59:01 -04:00
José Valim
a40833cad6 Merge pull request #1562 from sikachu/3-1-i18n-convention
Brought back alternative convention for namespaced models in i18n.
2011-06-08 08:14:03 -07:00
thoefer
3451bcb62e Brought back alternative convention for namespaced models in i18n. 2011-06-08 11:10:56 -04:00
José Valim
abc029d64e Merge pull request #1561 from sikachu/3-1-escapejs
Make escape_javascript happy to handle SafeBuffers
2011-06-08 08:10:24 -07:00
Paul Gallagher
4663893726 Make escape_javascript happy to handle SafeBuffers
* see GH#1553
* allow for the fact that gsub on SafeBuffer does not pass match variables $1, $2 etc to a block
2011-06-08 11:06:58 -04:00
José Valim
caa0b1d816 Merge pull request #1557 from guilleiguaran/multiple-sources-sprockets-3-1
Multiple sources in sprockets helpers (backported from master)
2011-06-08 06:26:18 -07:00
Guillermo Iguaran
6e9714ca1e Allow multiple sources in Sprockets helpers 2011-06-08 08:13:50 -05:00
Raimonds Simanovskis
64a5865b05 Do not hardcode :id as it was ignored by mass assignment filter
As a result test was failing on Oracle where ids are assigned by default from 1000
2011-06-08 11:18:06 +02:00
José Valim
623c16f4f8 Merge pull request #1546 from sikachu/31safebuffer
Fix failing ActionPack tests on 3-1-stable
2011-06-07 23:19:45 -07:00
Prem Sichanugrist
719e05da06 Add proper fix to mail_to helper.
* Fix the problem on manipulating on the `ActiveSupport::SafeBuffer`
* Make sure that we run `escape_javascript` on the `String`, to avoid unexpected behavior.
2011-06-08 01:51:48 -04:00
Prem Sichanugrist
d1a74755b3 Adapt [823aa223ef] to make sure we perform cloning before manipulation only on OutputBuffer.
After the fragment rendering, `Builder` returns the `String` object instead of `ActionView::OutputBuffer`. Somehow the same procedure which was in [823aa223ef] does not play nice with the String, and result in the fragment got lost.
2011-06-08 01:07:39 -04:00
Prem Sichanugrist
509aa66360 Fix simple_format helper to work correctly with the new SafeBuffer rule.
This has been ported from `3-0-stable` [ed3796434a]
2011-06-08 00:25:56 -04:00
Christopher Meiklejohn
eb85169b9a Fragment caching needs to operate on the pure output, not the
safebuffer.
2011-06-08 00:24:18 -04:00
Aaron Patterson
26648978b6 bumping to rails 3.1.0.rc2 2011-06-07 17:01:20 -07:00
Michael Koziarski
a06fec6dc0 Ensure that the strings returned by SafeBuffer#gsub and friends aren't considered html_safe?
Also make sure that the versions of those methods which modify a string in place such as gsub! can't be called on safe buffers at all.

Conflicts:

	activesupport/test/safe_buffer_test.rb
2011-06-07 17:01:20 -07:00
Jon Leighton
e1498611d5 When you add a record to a polymorphic has_one, you should be able to access the owner from the associated record 2011-06-08 00:33:18 +01:00
Jon Leighton
f5f020be43 Allow polymorphic has_one to work when the association is set before the owner has been saved. Fixes #1524. 2011-06-08 00:33:18 +01:00
Vijay Dev
b7ea35d588 fix spacing
Conflicts:

	railties/guides/source/configuring.textile
2011-06-08 00:27:37 +02:00
Vijay Dev
f8f00cc96c add missing generator configs 2011-06-08 00:25:15 +02:00
Vijay Dev
2cbd02449d proof reading and fixes in configuring guide 2011-06-08 00:25:08 +02:00
Vijay Dev
da5122e5fa fix indents and a code error in caching guide 2011-06-08 00:25:01 +02:00
Xavier Noria
296ca01f16 mention assets:clean in railties CHANGELOG 2011-06-07 22:02:36 +02:00
Xavier Noria
ea8b05c46e sprockets gzips assets now
Conflicts:

	railties/lib/rails/tasks/assets.rake
2011-06-07 22:00:21 +02:00
Dmitriy Kiriyenko
54f5fb5dc3 Do not use default_scope in ActiveRecord::Persistence#touch. 2011-06-07 18:43:24 +01:00
Dmitriy Kiriyenko
96711aa0a9 This way asserting that updated_at was changed in touch look more obvious. 2011-06-07 18:43:24 +01:00
Aaron Patterson
a9959115e6 Merge pull request #1528 from chriseppstein/3-1-stable
Update project Gemfile to use the sass-rails rc
2011-06-07 10:11:26 -07:00
Chris Eppstein
654514a306 Use the sass-rails release candidate until full release. 2011-06-07 10:08:19 -07:00
José Valim
69b25ebb2b Merge pull request #1527 from guilleiguaran/3-1-stable
Rails::Server#app should be nice with Rack::URLMap (3.1 stable)
2011-06-07 09:41:57 -07:00
Guillermo Iguaran
8d758d87a9 Fixing Rails::Server#app under Rack::URLMap 2011-06-07 11:36:02 -05:00
Xavier Noria
645f138c55 adds missing require 2011-06-07 12:07:00 +02:00
Aaron Patterson
377b15a223 make sure AR isolated tests set the environment variable 2011-06-06 18:01:19 -07:00
Aaron Patterson
75fb26aeca oops! add parens so the block is properly bound 2011-06-06 16:59:51 -07:00
Aaron Patterson
945b131eb2 set the environment variable from the rake file 2011-06-06 16:51:28 -07:00
Aaron Patterson
606108a069 more oracle fixes 2011-06-06 15:46:50 -07:00
Aaron Patterson
50d331d551 do not muck with the load path, that is the test task responsibility 2011-06-06 15:46:50 -07:00
Aaron Patterson
10eb47913d updating configs for oracle 2011-06-06 15:46:50 -07:00
Aaron Patterson
b8714ed907 add test to the include path 2011-06-06 15:46:50 -07:00
Aaron Patterson
e504101b36 please use ruby -I lib:test path/to/test.rb, or export RUBY_OPT 2011-06-06 15:46:50 -07:00
Vijay Dev
95f3046643 add info about docrails policy on changelogs 2011-06-06 22:50:55 +02:00
Vijay Dev
fa1aad741d comment the recorder methods 2011-06-06 22:47:04 +02:00
Vijay Dev
59016b9b97 up and down are no longer class methods in a migration 2011-06-06 22:46:53 +02:00
Vijay Dev
7262d9286b rearrange sections of the commandline guide giving more importance to rake tasks 2011-06-06 22:46:45 +02:00
Vijay Dev
3962d947b8 document assets related rake tasks 2011-06-06 22:46:31 +02:00
Mariusz Pękala
b6826beccb Validations guide: order of :after_save callback was incorrect.
The guide was contracting itself. First it stated that 'there is a list
of callbacks in order of execution', on the list 'after_save' was placed
before 'after_create', and then there was a warning that 'after_save'
runs after them. I am not sure about 'around_' callbacks, but let's
leave that for another patch.
2011-06-06 22:46:25 +02:00
Guillermo Iguaran
c1ce1684a5 Change http://api.rubyonrails.com to http://api.rubyonrails.org 2011-06-06 22:46:19 +02:00
Vijay Dev
5d4b73af8b minor edits in migrations guide 2011-06-06 22:45:58 +02:00
Vijay Dev
47670a5e03 annotate class_eval method for active resource schema attributes 2011-06-06 22:45:52 +02:00
Guillermo Iguaran
527499ca12 Remove trailing white-spaces 2011-06-06 22:45:45 +02:00
Vijay Dev
670ae129cf correct code indendation in the initialization guide 2011-06-06 22:45:39 +02:00
Vijay Dev
3432775131 s/ActiveRecord/Active Record according to api guidelines 2011-06-06 22:45:31 +02:00
Vijay Dev
b1919b1cf3 minor corrections in generators guide 2011-06-06 22:45:23 +02:00
Vijay Dev
2974869bbc fix incorrect module name for wrap parameters 2011-06-06 22:45:16 +02:00
Vijay Dev
dff7c62ef0 some grammatical corrections 2011-06-06 22:45:10 +02:00
Vijay Dev
0e8857b65e fix incorrect output 2011-06-06 22:45:04 +02:00
Alberto Perdomo
f9087ee29c Fixed order of parameters in assert_equal call examples, first expected, then actual object. 2011-06-06 22:44:58 +02:00
Rohit Arondekar
9726ed8caf Upcoming version of Rails is upon us so no need to refer to it. [API DOCS] 2011-06-06 22:44:51 +02:00
Vijay Dev
424d72586f use clearer variable name in examples 2011-06-06 22:44:43 +02:00
Waynn Lue
d57cfc1b54 add a missing "the" and normalize the use of periods. 2011-06-06 22:44:35 +02:00
Prem Sichanugrist
eade59177d Revise documentation indentation from [79990505e5] 2011-06-06 22:44:29 +02:00
ganesh
5e44184a4e updated Changelog 2011-06-06 22:44:23 +02:00
Linux on Rails
f7ac354f4c FIXED: error with url_for & link_to when we have nested resources. 2011-06-06 22:44:11 +02:00
Vijay Dev
69b3c9cf9a remove stray ( 2011-06-06 22:44:02 +02:00
Vijay Dev
40e7682e11 fix indentation, fixed-width for nils 2011-06-06 22:43:31 +02:00
brianp
50a73916aa Fixed sections regarding validations and callbacks to mention the touch method does not fire either validations or callbacks as stated in the docs. 2011-06-06 22:43:23 +02:00
Ben Orenstein
f4a4d5fa1c Change hashrocket spacing to match conventions. 2011-06-06 22:43:16 +02:00
Vijay Dev
f51cea64ad add alias info for runner command 2011-06-06 22:43:06 +02:00
Ayose
6ad8f6ef5c Edited activerecord/lib/active_record/transactions.rb via GitHub 2011-06-06 22:42:44 +02:00
Ayose
700fd6d29b The URL http://dev.mysql.com/doc/refman/5.0/en/savepoints.html is no longer available 2011-06-06 22:42:37 +02:00
Akira Matsuda
6f3d997578 s/a/an/ 2011-06-06 22:42:30 +02:00
Akira Matsuda
4c716e660c s/an/a/ 2011-06-06 22:42:23 +02:00
Guillermo Iguaran
48b90967b0 Removing trailing white-spaces 2011-06-06 22:42:17 +02:00
Mark Roghelia
8ac4e4dbce The example in the API docs incorrectly indicated that form_for would use the same default route for both new and previously persisted records. The default path given in the example would have generated a routing error for new records. form_for actually uses polymorphic_path to determine which route to use based on the state of the record. The example has been updated to reflect the method's actual behavior. 2011-06-06 22:42:05 +02:00
Hendy Tanata
7ff491c567 Fix punctuation. 2011-06-06 22:41:58 +02:00
Hendy Tanata
2e7a039050 Update Rails coding conventions link. 2011-06-06 22:41:50 +02:00
Evan Farrar
3a22027088 Typo and sentence restructuring 2011-06-06 22:40:52 +02:00
Vijay Dev
5ab4b9e6ff removed references to old remote_* helpers; add info about 3.1 adding multipart option to a form with file_field automatically 2011-06-06 22:40:25 +02:00
Vijay Dev
39e5cbc918 fix typo 2011-06-06 22:39:06 +02:00
Vijay Dev
1d654cc4ec document aliases for commands and update rails versions 2011-06-06 22:38:57 +02:00
Ben Orenstein
8b72166ae8 Fix incorrect description of the returned results. 2011-06-06 22:38:49 +02:00
Ben Orenstein
97fd8c0ffd Copy edits 64148ab96b (previous commit). Please squash at will. 2011-06-06 22:38:42 +02:00
Ben Orenstein
5eaf012673 Improve 'Joining Tables' section with additional examples and explanation. 2011-06-06 22:38:34 +02:00
Ben Orenstein
7dcbbae9ee Don't you lie to me! 2011-06-06 22:38:25 +02:00
Sebastian Martinez
c32ba39785 Fix font styling on associations.rb 2011-06-06 22:37:04 +02:00
diego
9d275a8bd2 Added missing quote in grouped_options_for_select example 2011-06-06 22:36:12 +02:00
Thais Camilo
64db0ee3f5 Stop linking Rails guidelines to GitHub wiki 2011-06-06 22:36:03 +02:00
Thais Camilo
e856157748 Stop linking API Guidelines to GitHub wiki 2011-06-06 22:35:55 +02:00
Thais Camilo
8c358d0beb On "contribute" guide: remove mention of LH 2011-06-06 22:35:48 +02:00
Sebastian Martinez
20f1f9eee3 Revert this, commited by mistake. 2011-06-06 22:35:41 +02:00
Sebastian Martinez
815dd81cf2 Fix grammar mistake. Lets vs let's. 2011-06-06 22:35:30 +02:00
Sebastian Martinez
e5fb9018bd Fix fixed-fonts stlye on rails_on_rack guide. 2011-06-06 22:35:22 +02:00
Jon Leighton
d7edce20fb Don't ensure all keys in build_results are only written once, otherwise we get false positive builds reported. 2011-06-06 21:24:42 +01:00
Jon Leighton
dc4da12c55 Make sure that the build/drop database rake tasks take account of the test/config.yml config 2011-06-06 21:24:36 +01:00
Jon Leighton
4a395817ef Fix double definition of #teardown. Thanks @mike-burns 👍 2011-06-06 17:57:57 +01:00
Jon Leighton
fe2b411be6 Fix another CIfail 🔥 Deleting RAILS_ENV from ENV doesn't produce the desired result if RACK_ENV is still defined. And in any case it's better to be explicit here, so just set RALS_ENV=development. 2011-06-06 17:57:51 +01:00
David Heinemeier Hansson
50a7e8e0a0 Depend on latest Sprockets beta 2011-06-06 18:29:07 +02:00
Jon Leighton
1f59c57ef1 Solve the RAILS_ENV problem in the railties tests in a more generic way 2011-06-06 13:54:31 +01:00
José Valim
1bc159fbd2 Merge pull request #1508 from vijaydev/rake_rdoc_fixes_cherry_picks
Rake deprecation fixes - cherry picks
2011-06-06 05:27:51 -07:00
Akira Matsuda
f3fa66f1ff Ensure RDoc::Task exists even if 'rdoc/task' was not required 2011-06-06 17:49:28 +05:30
Akira Matsuda
84fac20720 require 'rake/rdoctask' if failed to require 'rdoc/task'
fixes a regression introduced by b921679d0d
require 'rdoc/task' fails if the system RDoc version is below 2.4.2 (e.g. CRuby 1.8.7)
2011-06-06 17:49:19 +05:30
José Valim
ae534f2134 Merge pull request #1505 from arunagw/3-1-stable
Cherry-picked from master to fix the build
2011-06-06 03:53:01 -07:00
Arun Agrawal
e909fa4112 Fix for CI server. Dependent on RAILS_ENV=development 2011-06-06 16:19:28 +05:30
Arun Agrawal
077ffe0287 loading_test.rb with RAILS_ENV=development 2011-06-06 16:19:23 +05:30
Arun Agrawal
710dfff120 framework_test.rb also dependent on RAILS_ENV=development 2011-06-06 16:19:18 +05:30
José Valim
0c4fd88686 Merge pull request #1478 from arunagw/warning_cherry-picks
Some Cherry-picks for 1.9.2 warning removal
2011-06-06 02:43:44 -07:00
Jon Leighton
3ac805b6ea load_path_test.rb is also dependent on RAILS_ENV=development 2011-06-05 18:28:01 +01:00
José Valim
af1c020d2e Merge pull request #1495 from arunagw/fixed_failing_isolated_test
Fixed failing isolated test
2011-06-05 08:30:09 -07:00
Arun Agrawal
596f6ec505 Loading multi_json instead of i18n gem.
Don't know why it's giving error with i18n gem. 
Changing this as it dosn't matter with specific gem.
2011-06-05 20:39:59 +05:30
Jon Leighton
04d238bfb5 Fix adapter_test.rb to make no assumptions about the database name 2011-06-05 11:29:05 +01:00
Jon Leighton
6925423b26 Fix typo 2011-06-05 11:28:58 +01:00
Jon Leighton
550064cbde Bring back oracle specific crap 2011-06-04 23:50:06 +01:00
Jon Leighton
f9e3d4bc59 Refactor Active Record test connection setup. Please see the RUNNING_UNIT_TESTS file for details, but essentially you can now configure things in test/config.yml. You can also run tests directly via the command line, e.g. ruby path/to/test.rb (no rake needed, uses default db connection from test/config.yml). This will help us fix the CI by enabling us to isolate the different Rails versions to different databases. 2011-06-04 23:25:36 +01:00
Jon Leighton
f9464a28d2 Force RAILS_ENV=development in rackup_test.rb. This fixes a problem on the CI server. For some reason the RAILS_ENV on the CI server is production, which means that the ActionDispatch::Static middleware is not used, and so the request in 'config.ru can be racked up' returns a 404 rather than a 200. 2011-06-04 23:21:59 +01:00
Xavier Noria
3939fbde6d adds Vijay Dev to the new Rails Guides Reviewers team
See http://weblog.rubyonrails.org/2011/6/2/news-from-the-documentation-front
2011-06-05 00:16:10 +02:00
Xavier Noria
63eab0b416 move Ryan up, since the list is ordered by surname 2011-06-04 14:35:30 +02:00
Xavier Noria
7bbcf53010 adds Ryan Bigg to the credits page of the guides, he is the author of the new configuring guide 2011-06-04 14:27:16 +02:00
Xavier Noria
aedc627f06 specify image dimensions for pictures in the guides credits page 2011-06-04 14:27:05 +02:00
Vijay Dev
b6040f4e84 fixes Rake::RDocTask deprecation warnings from rake 0.9.0 2011-06-04 09:01:34 +05:30
Vijay Dev
a81c2ec560 fixes Rake::GemPackageTask deprecation warnings from rake 0.9.0 2011-06-04 09:01:26 +05:30
wycats
63467a4301 Restructure TemplateAssertions-related code to eliminate circular requires.
Also, no need to include dependencies in AS::Concerns inside included blocks.
2011-06-04 08:57:56 +05:30
Yehuda Katz
639dca435f Merge pull request #1473 from lardawge/fix_broken_asset_pipeline_paths
Fix broken asset pipeline paths
2011-06-03 18:31:50 -07:00
Larry Sprock
3b75ec92f5 Bring inline with master 2011-06-03 10:55:10 -07:00
Larry Sprock
8b8e18198b Don't need asset_path twice 2011-06-03 10:54:35 -07:00
Larry Sprock
9b55007486 Generate correct asset paths when using asset pipeline 2011-06-03 10:34:49 -07:00
wycats
80745f19c4 Another missed piece of the merge. I screwed up this merge. I am sorry :( 2011-06-03 10:14:02 -07:00
Andrew White
67f5c076de Don't double assign attributes - closes #1467. 2011-06-03 13:58:14 +01:00
wycats
de6394208c Remove explicit sprockets usage. This should have come over in the merge, but for some reason it didn't. 2011-06-02 17:06:34 -07:00
wycats
5b300a9ea4 Pull back in asset_path 2011-06-02 16:10:38 -07:00
wycats
b5ac04a31b Renaming helper in the Rake task, but why is this needed in the first place? (paging JP) 2011-06-02 11:06:04 -07:00
wycats
af83304992 Update generator config to support hiding namespaces and pass the app into generator blocks 2011-06-02 10:59:13 -07:00
wycats
7a8d3d7603 Make sure that Sprockets::Helpers::RailsHelper can be found 2011-06-02 10:59:13 -07:00
wycats
ee018be796 Move the last pockets of Sprockets stuff into the Sprockets directory 2011-06-02 10:59:13 -07:00
wycats
476d679c33 Move javascript/css helpers into the Sprockets helper and just have them override the old behavior 2011-06-02 10:59:13 -07:00
wycats
866889c526 Start moving some logic from being embedded in AV into the Rails Sprockets extensions 2011-06-02 10:59:13 -07:00
David Heinemeier Hansson
2c6127ffd8 Revert "Renaming helper in the Rake task, but why is this needed in the first place? (paging JP)" -- Waiting on YK to fix.
This reverts commit e144b3e3cf.
2011-06-02 12:39:31 -05:00
Jon Leighton
03d087d4df Fix broken test. You know, the merge button will be the end of us... 2011-06-01 23:14:09 +01:00
Jon Leighton
1243683913 Merge pull request #1451 from arunagw/3-1-stable
3-1-stable import to java_import
2011-06-01 12:42:33 -07:00
Arun Agrawal
42b8fb1667 Import => java_import performance test #jruby 2011-06-02 00:55:15 +05:30
Jon Leighton
df0e2db9d9 Merge pull request #1444 from arunagw/3-1-stable
Jruby fixes for 3 1 stable
2011-06-01 11:39:00 -07:00
Arun Agrawal
68fc6baf1b Indented as required. 2011-06-01 23:48:43 +05:30
Arun Agrawal
425c892a8f Fixed tests for JDOM. File From Xml is working now 2011-06-01 23:35:44 +05:30
Arun Agrawal
88813e1cf7 Fixing XMLMini_JDOM 2011-06-01 23:35:44 +05:30
Arun Agrawal
60c9b7bc5c Using java_import instead of import. Need with rake 0.9.0 2011-06-01 23:35:43 +05:30
Arun Agrawal
98cd7ca8ec Loading files if PLATFORM available. 2011-06-01 23:35:43 +05:30
Arun Agrawal
7f34d5bc0b Adding comment 2011-06-01 18:51:03 +01:00
Vishnu Atrai
26d0f42f18 AttributeMethodTest test fix #jruby 2011-06-01 18:51:03 +01:00
Brian Mathiyakom
8a4013ddd0 Fix issue #1272
Set reverse_order_value when asked to reverse_order().
Do the actual reversal in build_arel.
2011-06-01 18:30:14 +01:00
Andrew White
f1fe3c2d52 Raise NameError instead of ArgumentError in ActiveSupport::Dependencies
ActiveSupport::Dependencies now raises NameError if it finds an existing
constant in load_missing_constant. This better reflects the nature of
the error which is usually caused by calling constantize on a nested constant.

Closes #1423
2011-06-01 01:12:41 +01:00
Jon Leighton
5ca2e57a2f Merge pull request #1437 from joshk/ar_collection_new_alias
Ar collection new alias
2011-05-31 15:53:49 -07:00
Jon Leighton
3c09ae786d Merge pull request #1437 from joshk/ar_collection_new_alias
Ar collection new alias
2011-05-31 15:49:46 -07:00
Jon Leighton
668767091f Merge pull request #1437 from joshk/ar_collection_new_alias
Ar collection new alias
2011-05-31 15:48:13 -07:00
Josh Kalderimis
22b02cb049 added an alias for new to build to the AR collection proxy, this corrects an issue where the collection proxies were not consistent 2011-06-01 00:42:02 +02:00
Andrew White
de7fecbb39 Make MemCacheStore work with Ruby 1.9 and -Ku 2011-05-31 23:20:54 +01:00
Jon Leighton
f4e3b70e9c Ensure that calculations properly override the select value even if it's set in the default scope. Fixes #1395. 2011-05-31 21:12:40 +01:00
Erik Fonselius
c22364b60d Failing test for aggregating on default_scope with select 2011-05-31 21:12:40 +01:00
Jon Leighton
64d7348b98 Only save the record once when calling create! on a collection association. Fixes #1360. 2011-05-31 20:32:55 +01:00
Farley Knight
842043e352 Tests for issue #1360 2011-05-31 20:32:47 +01:00
Jon Leighton
9d179135b0 Implementing @dmathieu's cleaner fix from #1425. Unfortunately he deleted the branch so I cannot just merge it. 2011-05-31 18:37:37 +01:00
Aaron Patterson
1c42bd5444 Merge pull request #1375 from amatsuda/disable_im_by_default_on_test_31
Disable IdentityMap by default for ActiveRecord testing on 3-1-stable
2011-05-28 10:39:11 -07:00
Akira Matsuda
37304e3be9 Disable IdentityMap by default for ActiveRecord testing
because enabling IM by default will possibly hide some bugs on 3.1 default behavior
2011-05-28 20:59:33 +09:00
jacott
db05478d92 fixed asset_paths when called from sprockets for relative_url_root 2011-05-28 08:50:00 +02:00
Aaron Patterson
18a2dfbbcf work around bug in the sqlite3 bindings. fixes #1289 2011-05-27 14:12:08 -07:00
Aaron Patterson
c0c9a336be fixing test for mysql2 2011-05-27 11:45:49 -07:00
Aaron Patterson
37b2104109 adding a test for #1322 2011-05-27 11:45:32 -07:00
dmathieu
9cb8a18200 don't raise an exception if the format isn't recognized
Fixed while traveling to heuruko
2011-05-27 07:50:44 +02:00
José Valim
3868624c79 Merge pull request #1313 from joshk/deprecation_message_correction
Deprecation message correction
2011-05-25 14:56:10 -07:00
Josh Kalderimis
a1936b4a6b correction to the AR::Base#attributes= guard_protected_attributes deprecation message 2011-05-25 23:44:52 +02:00
wycats
9701014b96 Renaming helper in the Rake task, but why is this needed in the first place? (paging JP) 2011-05-25 11:37:47 -07:00
José Valim
289f9cedef Everyone receives app as argument for consistency.
Conflicts:

	railties/lib/rails/application.rb
2011-05-25 01:39:09 +02:00
Jon Leighton
b519b0cac9 Fix infinite recursion where a lazy default scope references a scope. Fixes #1264. 2011-05-25 00:18:08 +01:00
Andrew White
8a4263c957 Ignore :includes on through associations 2011-05-25 00:17:53 +01:00
Jon Leighton
63a659847b Ensure that the surrounding code in Relation#to_a respects the default_scope (as well as having Relation#arel respect the default scope). Fixes #1233. 2011-05-25 00:17:15 +01:00
Andrew White
0daf574648 Failing tests for #1233. 2011-05-25 00:17:00 +01:00
wycats
c08f845c91 Update default Gemfile to point to sass-rails, not sass 2011-05-24 16:14:02 -07:00
wycats
23820a2042 Hide css:* and the default stylesheet from rails g 2011-05-24 16:13:53 -07:00
wycats
5d9eb1a44e Update generator config to support hiding namespaces and pass the app into generator blocks 2011-05-24 16:13:45 -07:00
tomhuda
e1043cc848 Move SCSS generators and default templates from Rails to the Sass Railtie (d435726312601edb3ba6f97b34f562221f72c1f8).
* Sass gem registers a compressor
* Sass gem registers generators for assets and scaffold
* Create a default stylesheet_engine ("css") for apps that remove the Sass gem
2011-05-24 16:13:39 -07:00
tomhuda
7eed5c0303 Change compressor API so that plugins can register default compressors for their stylesheet or JS engines and still allow the user to turn off compression 2011-05-24 16:13:32 -07:00
Aaron Patterson
656e7b0807 rescue record invalid exceptions and return false from the save method. fixes #796 2011-05-24 11:26:53 -07:00
Aaron Patterson
1d864e823a add tests surrounding behavior of save and save! for associations that have validation errors 2011-05-24 11:26:49 -07:00
Aaron Patterson
b102e60bf5 adding a test for create! with invalid associations 2011-05-24 11:26:44 -07:00
Aaron Patterson
d48563352f do not bother with assert_nothing_raised, the test will fail and we get a better trace without it 2011-05-24 11:26:39 -07:00
Joey Butler
177666ebcf Add failing test case for issue 796 2011-05-24 11:26:34 -07:00
David Heinemeier Hansson
c77bdc017b Remove asserts for js ext stuff thats not used any more 2011-05-24 10:22:45 -05:00
David Heinemeier Hansson
da1ee0e371 The asset pipeline is always on for new apps, dont need the legacy js ext stuff 2011-05-24 07:46:30 -05:00
Jon Leighton
872a9c1b50 Fix problem with loading polymorphic associations which have been defined in an abstract superclass. Fixes #552. 2011-05-23 20:30:26 +01:00
Jon Leighton
3cbfc8cc4e Deprecate ActiveSupport::SecureRandom. Just use SecureRandom which is provided by the standard library. 2011-05-23 20:24:44 +01:00
Jon Leighton
5a6927ec1e Replace references to ActiveSupport::SecureRandom with just SecureRandom, and require 'securerandom' from the stdlib when active support is required. 2011-05-23 20:24:44 +01:00
José Valim
b648286a0c Merge pull request #1235 from joshk/deprecate_kernel_requires
Deprecate kernel requires
2011-05-23 12:20:30 -07:00
Josh Kalderimis
d79e2846da deprecate AS core_ext/kernel/requires in 3.1 2011-05-23 19:54:00 +02:00
José Valim
65f54a66b0 Move content length to the server, this brings the same behavior as in rack 1.2. 2011-05-23 10:32:04 +02:00
José Valim
72368610f0 Use Rack 1.3.0. 2011-05-23 00:33:48 -07:00
1178 changed files with 18743 additions and 34880 deletions

47
.gitignore vendored
View File

@@ -1,22 +1,27 @@
# Don't put *.swp, *.bak, etc here; those belong in a global ~/.gitignore.
# Check out http://help.github.com/ignore-files/ for how to set that up.
debug.log
pkg
.bundle
Gemfile.lock
.Gemfile
/.bundle
/.ruby-version
/pkg
/dist
/doc/rdoc
/*/doc
/*/test/tmp
/activerecord/sqlnet.log
/activemodel/test/fixtures/fixture_database.sqlite3
/activesupport/test/fixtures/isolation_test
/railties/test/500.html
/railties/test/fixtures/tmp
/railties/test/initializer/root/log
/railties/doc
/railties/guides/output
/railties/tmp
/RDOC_MAIN.rdoc
debug.log
doc/rdoc
activemodel/doc
activeresource/doc
activerecord/doc
activerecord/sqlnet.log
actionpack/doc
actionmailer/doc
activesupport/doc
activesupport/test/tmp
activemodel/test/fixtures/fixture_database.sqlite3
actionpack/test/tmp
activesupport/test/fixtures/isolation_test
dist
railties/test/500.html
railties/test/fixtures/tmp
railties/test/initializer/root/log
railties/doc
railties/guides/output
railties/tmp
.rvmrc
.rbenv-version
RDOC_MAIN.rdoc

View File

@@ -1,11 +1,8 @@
script: 'ci/travis.rb'
before_install:
- gem install bundler
rvm:
- 1.8.7
- 1.9.2
- 1.9.3
- 2.0.0
env:
- "GEM=railties"
- "GEM=ap,am,amo,ares,as"
@@ -24,5 +21,5 @@ notifications:
on_success: change
on_failure: always
rooms:
- secure: "YA1alef1ESHWGFNVwvmVGCkMe4cUy4j+UcNvMUESraceiAfVyRMAovlQBGs6\n9kBRm7DHYBUXYC2ABQoJbQRLDr/1B5JPf/M8+Qd7BKu8tcDC03U01SMHFLpO\naOs/HLXcDxtnnpL07tGVsm0zhMc5N8tq4/L3SHxK7Vi+TacwQzI="
- secure: "CGWvthGkBKNnTnk9YSmf9AXKoiRI33fCl5D3jU4nx3cOPu6kv2R9nMjt9EAo\nOuS4Q85qNSf4VNQ2cUPNiNYSWQ+XiTfivKvDUw/QW9r1FejYyeWarMsSBWA+\n0fADjF1M2dkDIVLgYPfwoXEv7l+j654F1KLKB69F0F/netwP9CQ="
bundler_args: --path vendor/bundle

87
Gemfile
View File

@@ -1,64 +1,89 @@
source 'https://rubygems.org'
source "http://rubygems.org"
gemspec
if ENV['AREL']
gem 'arel', :path => ENV['AREL']
else
gem 'arel'
end
gem 'bcrypt-ruby', '~> 3.0.0'
gem 'jquery-rails'
if ENV['JOURNEY']
gem 'journey', :path => ENV['JOURNEY']
else
gem 'journey'
gem "arel", :path => ENV['AREL']
end
gem "bcrypt-ruby", "~> 3.0.0"
gem "jquery-rails"
# This needs to be with require false to avoid
# it being automatically loaded by sprockets
gem 'uglifier', '>= 1.0.3', :require => false
gem "uglifier", ">= 1.0.3", :require => false
# execjs >= 2.1.0 doesn't work with Ruby 1.8
gem 'execjs', '< 2.1.0'
gem 'rake', '>= 0.8.7'
gem 'mocha', '~> 0.14', :require => false
gem "rake", ">= 0.8.7"
gem "mocha", "0.10.5"
group :doc do
# The current sdoc cannot generate GitHub links due
# to a bug, but the PR that fixes it has been there
# for some weeks unapplied. As a temporary solution
# this is our own fork with the fix.
gem 'sdoc', :git => 'git://github.com/fxn/sdoc.git'
gem 'RedCloth', '~> 4.2'
gem 'w3c_validators'
gem "sdoc", :git => 'git://github.com/fxn/sdoc.git'
gem "RedCloth", "~> 4.2" if RUBY_VERSION < "1.9.3"
gem "w3c_validators"
end
# AS
gem 'memcache-client', '>= 1.8.5'
gem "memcache-client", ">= 1.8.5"
platforms :mri_18 do
gem "system_timer"
gem "json"
end
# Add your own local bundler stuff
instance_eval File.read '.Gemfile' if File.exists? '.Gemfile'
instance_eval File.read ".Gemfile" if File.exists? ".Gemfile"
platforms :mri do
group :test do
gem 'ruby-prof', '~> 0.11.2' if RUBY_VERSION < '2.0'
gem 'ruby-prof', '~> 0.11.2'
end
end
platforms :ruby do
gem 'yajl-ruby'
gem 'nokogiri', '>= 1.4.5', '< 1.6'
if ENV["RB_FSEVENT"]
gem "rb-fsevent"
end
gem "json"
gem "yajl-ruby"
gem "nokogiri", ">= 1.4.4"
# AR
gem 'sqlite3', '~> 1.3.5'
gem "sqlite3", "~> 1.3.4"
group :db do
gem 'pg', '>= 0.11.0'
gem 'mysql', '>= 2.8.1'
gem 'mysql2', '>= 0.3.10'
gem "pg", ">= 0.11.0"
gem "mysql", ">= 2.8.1"
gem "mysql2", ">= 0.3.10"
end
end
platforms :jruby do
gem "json"
gem "activerecord-jdbcsqlite3-adapter", ">= 1.2.0"
# This is needed by now to let tests work on JRuby
# TODO: When the JRuby guys merge jruby-openssl in
# jruby this will be removed
gem "jruby-openssl"
group :db do
gem "activerecord-jdbcmysql-adapter", ">= 1.2.0"
gem "activerecord-jdbcpostgresql-adapter", ">= 1.2.0"
end
end
# gems that are necessary for ActiveRecord tests with Oracle database
if ENV['ORACLE_ENHANCED_PATH'] || ENV['ORACLE_ENHANCED']
platforms :ruby do
gem "ruby-oci8", ">= 2.0.4"
end
if ENV['ORACLE_ENHANCED_PATH']
gem "activerecord-oracle_enhanced-adapter", :path => ENV['ORACLE_ENHANCED_PATH']
else
gem "activerecord-oracle_enhanced-adapter", :git => "git://github.com/rsim/oracle-enhanced.git"
end
end

View File

@@ -1,131 +0,0 @@
GIT
remote: git://github.com/fxn/sdoc.git
revision: 9977ca4ecf83a76d637861f79319b11830d51de5
specs:
sdoc (0.3.19)
json (>= 1.1.3)
rdoc (~> 3.10)
PATH
remote: .
specs:
actionmailer (3.2.19)
actionpack (= 3.2.19)
mail (~> 2.5.4)
actionpack (3.2.19)
activemodel (= 3.2.19)
activesupport (= 3.2.19)
builder (~> 3.2)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.5)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
activemodel (3.2.19)
activesupport (= 3.2.19)
builder (~> 3.2)
activerecord (3.2.19)
activemodel (= 3.2.19)
activesupport (= 3.2.19)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.19)
activemodel (= 3.2.19)
activesupport (= 3.2.19)
activesupport (3.2.19)
i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
rails (3.2.19)
actionmailer (= 3.2.19)
actionpack (= 3.2.19)
activerecord (= 3.2.19)
activeresource (= 3.2.19)
activesupport (= 3.2.19)
bundler (~> 1.0)
railties (= 3.2.19)
railties (3.2.19)
actionpack (= 3.2.19)
activesupport (= 3.2.19)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
GEM
remote: https://rubygems.org/
specs:
RedCloth (4.2.9)
arel (3.0.3)
bcrypt-ruby (3.0.1)
benchmark-ips (1.2.0)
builder (3.2.2)
erubis (2.7.0)
execjs (2.0.2)
i18n (0.6.11)
journey (1.0.4)
jquery-rails (3.1.0)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.1)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
memcache-client (1.8.5)
metaclass (0.0.4)
mime-types (1.25.1)
mocha (0.14.0)
metaclass (~> 0.0.1)
multi_json (1.10.1)
mysql (2.9.1)
mysql2 (0.3.15)
nokogiri (1.5.11)
pg (0.17.1)
polyglot (0.3.5)
rack (1.4.5)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.4)
rack
rack-test (0.6.2)
rack (>= 1.0)
rake (10.2.2)
rdoc (3.12.2)
json (~> 1.4)
sqlite3 (1.3.9)
thor (0.19.1)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.41)
uglifier (2.5.0)
execjs (>= 0.3.0)
json (>= 1.8.0)
w3c_validators (1.2)
json
nokogiri
yajl-ruby (1.2.0)
PLATFORMS
ruby
DEPENDENCIES
RedCloth (~> 4.2)
arel
bcrypt-ruby (~> 3.0.0)
benchmark-ips
execjs (< 2.1.0)
journey
jquery-rails
memcache-client (>= 1.8.5)
mocha (~> 0.14)
mysql (>= 2.8.1)
mysql2 (>= 0.3.10)
nokogiri (>= 1.4.5, < 1.6)
pg (>= 0.11.0)
rails!
rake (>= 0.8.7)
sdoc!
sqlite3 (~> 1.3.5)
uglifier (>= 1.0.3)
w3c_validators
yajl-ruby

View File

@@ -1 +1 @@
3.2.19.github2
3.1.8

View File

@@ -18,7 +18,7 @@ you to present the data from database rows as objects and embellish these data o
with business logic methods. Although most Rails models are backed by a database, models
can also be ordinary Ruby classes, or Ruby classes that implement a set of interfaces as
provided by the ActiveModel module. You can read more about Active Record in its
{README}[link:/rails/rails/blob/master/activerecord/README.rdoc].
{README}[link:files/activerecord/README_rdoc.html].
The Controller layer is responsible for handling incoming HTTP requests and providing a
suitable response. Usually this means returning \HTML, but Rails controllers can also
@@ -29,7 +29,7 @@ In Rails, the Controller and View layers are handled together by Action Pack.
These two layers are bundled in a single package due to their heavy interdependence.
This is unlike the relationship between Active Record and Action Pack which are
independent. Each of these packages can be used independently outside of Rails. You
can read more about Action Pack in its {README}[link:/rails/rails/blob/master/actionpack/README.rdoc].
can read more about Action Pack in its {README}[link:files/actionpack/README_rdoc.html].
== Getting Started
@@ -61,17 +61,13 @@ can read more about Action Pack in its {README}[link:/rails/rails/blob/master/ac
* The {Ruby on Rails Guides}[http://guides.rubyonrails.org].
* The {API Documentation}[http://api.rubyonrails.org].
== Contributing
We encourage you to contribute to Ruby on Rails! Please check out the {Contributing to Rails
guide}[http://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html] for guidelines about how
to proceed. {Join us}[http://contributors.rubyonrails.org]!
== Build Status {<img src="https://secure.travis-ci.org/rails/rails.png"/>}[http://travis-ci.org/rails/rails]
== Dependency Status {<img src="https://gemnasium.com/rails/rails.png?travis"/>}[https://gemnasium.com/rails/rails]
== License
Ruby on Rails is released under the MIT license.

View File

@@ -1,238 +0,0 @@
= Releasing Rails
In this document, we'll cover the steps necessary to release Rails. Each
section contains steps to take during that time before the release. The times
suggested in each header are just that: suggestions. However, they should
really be considered as minimums.
== 10 Days before release
Today is mostly coordination tasks. Here are the things you must do today:
=== Is the CI green? If not, make it green. (See "Fixing the CI")
Do not release with a Red CI. You can find the CI status here:
http://travis-ci.org/#!/rails/rails
=== Is Sam Ruby happy? If not, make him happy.
Sam Ruby keeps a test suite that makes sure the code samples in his book (Agile
Web Development with Rails) all work. These are valuable integration tests
for Rails. You can check the status of his tests here:
http://intertwingly.net/projects/dashboard.html
Do not release with Red AWDwR tests.
=== Are the postgres tests green? If not, make them green
Currently Travis CI doesn't run the Active Record postgres tests. They are
working to resolve this, but in the mean time, it is crucial to ensure that
the tests are still green before release.
=== Do we have any git dependencies? If so, contact those authors.
Having git dependencies indicates that we depend on unreleased code.
Obviously rails cannot be released when it depends on unreleased code.
Contact the authors of those particular gems and work out a release date that
suits them.
=== Contact the security team (either Koz or tenderlove)
Let them know of your plans to release. There may be security issues to be
addressed, and that can impact your release date.
=== Notify implementors.
Ruby implementors have high stakes in making sure Rails works. Be kind and
give them a heads up that Rails will be released soonish.
Send an email just giving a heads up about the upcoming release to these
lists:
* team@jruby.org
* community@rubini.us
* rubyonrails-core@googlegroups.com
Implementors will love you and help you.
== 3 Days before release
This is when you should release the release candidate. Here are your tasks
for today:
=== Is the CI green? If not, make it green.
=== Is Sam Ruby happy? If not, make him happy.
=== Are the postgres tests green? If not, make them green
=== Contact the security team. CVE emails must be sent on this day.
=== Create a release branch.
From the stable branch, create a release branch. For example, if you're
releasing Rails 3.0.10, do this:
[aaron@higgins rails (3-0-stable)]$ git checkout -b 3-0-10
Switched to a new branch '3-0-10'
[aaron@higgins rails (3-0-10)]$
=== Update each CHANGELOG.
Many times commits are made without the CHANGELOG being updated. You should
review the commits since the last release, and fill in any missing information
for each CHANGELOG.
You can review the commits for the 3.0.10 release like this:
[aaron@higgins rails (3-0-10)]$ git log v3.0.9..
If you're doing a stable branch release, you should also ensure that all of
the CHANGELOG entries in the stable branch are also synced to the master
branch.
=== Update the RAILS_VERSION file to include the RC.
=== Build and test the gem.
Run `rake install` to generate the gems and install them locally. Then try
generating a new app and ensure that nothing explodes.
This will stop you from looking silly when you push an RC to rubygems.org and
then realise it is broken.
=== Release the gem.
IMPORTANT: Due to YAML parse problems on the rubygems.org server, it is safest
to use Ruby 1.8 when releasing.
Run `rake release`. This will populate the gemspecs with data from
RAILS_VERSION, commit the changes, tag it, and push the gems to rubygems.org.
Here are the commands that `rake release` should use, so you can understand
what to do in case anything goes wrong:
$ rake all:build
$ git commit -am'updating RAILS_VERSION'
$ git tag -m'tagging rc release' v3.0.10.rc1
$ git push
$ git push --tags
$ for i in $(ls dist); do gem push $i; done
=== Send Rails release announcements
Write a release announcement that includes the version, changes, and links to
github where people can find the specific commit list. Here are the mailing
lists where you should announce:
* rubyonrails-core@googlegroups.com
* rubyonrails-talk@googlegroups.com
* ruby-talk@ruby-lang.org
Use markdown format for your announcement. Remember to ask people to report
issues with the release candidate to the rails-core mailing list.
IMPORTANT: If any users experience regressions when using the release
candidate, you *must* postpone the release. Bugfix releases *should not*
break existing applications.
=== Post the announcement to the Rails blog.
If you used markdown format for your email, you can just paste it in to the
blog.
* http://weblog.rubyonrails.org
=== Post the announcement to the Rails twitter account.
== Time between release candidate and actual release
Check the rails-core mailing list and the github issue list for regressions in
the RC.
If any regressions are found, fix the regressions and repeat the release
candidate process. We will not release the final until 72 hours after the
last release candidate has been pushed. This means that if users find
regressions, the scheduled release date must be postponed.
When you fix the regressions, do not create a new branch. Fix them on the
stable branch, then cherry pick the commit to your release branch. No other
commits should be added to the release branch besides regression fixing commits.
== Day of release
Many of these steps are the same as for the release candidate, so if you need
more explanation on a particular step, so the RC steps.
Today, do this stuff in this order:
* Apply security patches to the release branch
* Update CHANGELOG with security fixes.
* Update RAILS_VERSION to remove the rc
* Build and test the gem
* Release the gems
* Email security lists
* Email general announcement lists
=== Emailing the rails security announce list
Email the security announce list once for each vulnerability fixed.
You can do this, or ask the security team to do it.
Email the security reports to:
* rubyonrails-security@googlegroups.com
* linux-distros@vs.openwall.org
Be sure to note the security fixes in your announcement along with CVE numbers
and links to each patch. Some people may not be able to upgrade right away,
so we need to give them the security fixes in patch form.
* Blog announcements
* Twitter announcements
* Merge the release branch to the stable branch.
* Drink beer (or other cocktail)
== Misc
=== Fixing the CI
There are two simple steps for fixing the CI:
1. Identify the problem
2. Fix it
Repeat these steps until the CI is green.
=== Manually trigger docs generation
We have a post-receive hook in GitHub that calls the docs server on pushes.
It triggers generation and publication of edge docs, updates the contrib app,
and generates and publishes stable docs if a new stable tag is detected.
The hook unfortunately is not invoked by tag pushing, so once the new stable
tag has been pushed to origin, please run
rake publish_docs
You should see something like this:
Rails master hook tasks scheduled:
* updates the local checkout
* updates Rails Contributors
* generates and publishes edge docs
If a new stable tag is detected it also
* generates and publishes stable docs
This needs typically a few minutes.
Note you do not need to specify the tag, the docs server figures it out.
Also, don't worry if you call that multiple times or the hook is triggered
again by some immediate regular push, if the scripts are running new calls
are just queued (in a queue of size 1).

View File

@@ -75,12 +75,7 @@ RDoc::Task.new do |rdoc|
# since no autolinking happens there and RDoc displays the backslash
# otherwise.
rdoc_main.gsub!(/^(?=\S).*?\b(?=Rails)\b/) { "#$&\\" }
rdoc_main.gsub!(%r{link:/rails/rails/blob/master/(\w+)/README\.rdoc}, "link:files/\\1/README_rdoc.html")
# Remove Travis and Gemnasium status images from API pages. Only GitHub
# README page gets these images. Travis' https build image is used to avoid
# GitHub caching: http://about.travis-ci.org/docs/user/status-images
rdoc_main.gsub!(%r{^== (Build|Dependency) Status.*}, '')
rdoc_main.gsub!(%r{link:blob/master/(\w+)/README\.rdoc}, "link:files/\\1/README_rdoc.html")
File.open(RDOC_MAIN, 'w') do |f|
f.write(rdoc_main)
@@ -94,7 +89,7 @@ RDoc::Task.new do |rdoc|
rdoc.options << '-f' << 'sdoc'
rdoc.options << '-T' << 'rails'
rdoc.options << '-e' << 'UTF-8'
rdoc.options << '-c' << 'utf-8'
rdoc.options << '-g' # SDoc flag, link methods to GitHub
rdoc.options << '-m' << RDOC_MAIN
@@ -190,7 +185,7 @@ end
#
desc 'Publishes docs, run this AFTER a new stable tag has been pushed'
task :publish_docs do
Net::HTTP.new('api.rubyonrails.org', 8080).start do |http|
Net::HTTP.new('rails-hooks.hashref.com').start do |http|
request = Net::HTTP::Post.new('/rails-master-hook')
response = http.request(request)
puts response.body

View File

@@ -1,123 +1,26 @@
## Rails 3.2.19 (Jul 2, 2014) ##
* No changes.
## Rails 3.2.18 (May 6, 2014) ##
* No changes.
## Rails 3.2.17 (Feb 18, 2014) ##
* No changes.
## Rails 3.2.16 (Dec 3, 2013) ##
* No changes.
## Rails 3.2.15 (Oct 16, 2013) ##
## Rails 3.1.8 (Aug 9, 2012)
* No changes.
## Rails 3.2.14 (Jul 22, 2013) ##
## Rails 3.1.7 (Jul 26, 2012)
* No changes.
## Rails 3.2.13 (Mar 18, 2013) ##
## Rails 3.1.6 (Jun 12, 2012)
* No changes.
## Rails 3.1.5 (May 31, 2012) ##
## Rails 3.2.12 (Feb 11, 2013) ##
* Increase minimum version of mail.
* No changes.
## Rails 3.1.1 (October 7, 2011) ##
* No changes
## Rails 3.2.11 (Jan 8, 2013) ##
## Rails 3.1.0 (August 30, 2011) ##
* No changes.
* No changes
## Rails 3.2.10 (Jan 2, 2013) ##
* No changes.
## Rails 3.2.9 (Nov 12, 2012) ##
* The return value from mailer methods is no longer relevant. This fixes a bug,
which was introduced with 3.2.9.
Backport #8450
Fix #8448
class ExampleMailer < ActionMailer::Base
# in 3.2.9, returning a falsy value from a mailer action, prevented the email from beeing sent.
# With 3.2.10 the return value is no longer relevant. If you call mail() the email will be sent.
def nil_returning_mailer_action
mail()
nil
end
end
*Yves Senn*
## Rails 3.2.9 (Nov 12, 2012) ##
* Do not render views when mail() isn't called.
Fix #7761
*Yves Senn*
## Rails 3.2.8 (Aug 9, 2012) ##
* No changes.
## Rails 3.2.7 (Jul 26, 2012) ##
* No changes.
## Rails 3.2.6 (Jun 12, 2012) ##
* No changes.
## Rails 3.2.5 (Jun 1, 2012) ##
* No changes.
## Rails 3.2.4 (May 31, 2012) ##
* No changes.
## Rails 3.2.3 (March 30, 2012) ##
* Upgrade mail version to 2.4.3 *ML*
## Rails 3.2.2 (March 1, 2012) ##
* No changes.
## Rails 3.2.1 (January 26, 2012) ##
* No changes.
## Rails 3.2.0 (January 20, 2012) ##
* Upgrade mail version to 2.4.0 *ML*
* Remove Old ActionMailer API *Josh Kalderimis*
Please check [3-1-stable](https://github.com/rails/rails/blob/3-1-stable/actionmailer/CHANGELOG.md) for previous changes.
Please check [3-0-stable](https://github.com/rails/rails/blob/3-0-stable/actionmailer/CHANGELOG) for previous changes.

View File

@@ -137,13 +137,13 @@ The Base class has the full list of configuration options. Here's an example:
== Download and installation
The latest version of Action Mailer can be installed with RubyGems:
The latest version of Action Mailer can be installed with Rubygems:
% [sudo] gem install actionmailer
Source code can be downloaded as part of the Rails project on GitHub
* https://github.com/rails/rails/tree/3-2-stable/actionmailer
* https://github.com/rails/rails/tree/master/actionmailer
== License
@@ -155,7 +155,7 @@ Action Mailer is released under the MIT license.
API documentation is at
* http://api.rubyonrails.org
* http://api.rubyonrails.com
Bug reports and feature requests can be filed with the rest for the Ruby on Rails project here:

View File

@@ -6,9 +6,6 @@ Gem::Specification.new do |s|
s.version = version
s.summary = 'Email composition, delivery, and receiving framework (part of Rails).'
s.description = 'Email on Rails. Compose, deliver, receive, and test emails using the familiar controller/view pattern. First-class support for multipart email and attachments.'
s.license = 'MIT'
s.required_ruby_version = '>= 1.8.7'
s.author = 'David Heinemeier Hansson'
@@ -20,5 +17,5 @@ Gem::Specification.new do |s|
s.requirements << 'none'
s.add_dependency('actionpack', version)
s.add_dependency('mail', '~> 2.5.4')
s.add_dependency('mail', '~> 2.5')
end

View File

@@ -40,10 +40,12 @@ require 'active_support/lazy_load_hooks'
module ActionMailer
extend ::ActiveSupport::Autoload
autoload :AdvAttrAccessor
autoload :Collector
autoload :Base
autoload :DeliveryMethods
autoload :MailHelper
autoload :OldApi
autoload :TestCase
autoload :TestHelper
end

View File

@@ -0,0 +1,28 @@
module ActionMailer
module AdvAttrAccessor #:nodoc:
def adv_attr_accessor(name, deprecation=nil)
ivar = "@#{name}"
deprecation ||= "Please pass :#{name} as hash key to mail() instead"
class_eval <<-ACCESSORS, __FILE__, __LINE__ + 1
def #{name}=(value)
ActiveSupport::Deprecation.warn "#{name}= is deprecated. #{deprecation}"
#{ivar} = value
end
def #{name}(*args)
raise ArgumentError, "expected 0 or 1 parameters" unless args.length <= 1
if args.empty?
ActiveSupport::Deprecation.warn "#{name}() is deprecated and will be removed in future versions."
#{ivar} if instance_variable_names.include?(#{ivar.inspect})
else
ActiveSupport::Deprecation.warn "#{name}(value) is deprecated. #{deprecation}"
#{ivar} = args.first
end
end
ACCESSORS
self.protected_instance_variables << ivar if self.respond_to?(:protected_instance_variables)
end
end
end

View File

@@ -1,11 +1,11 @@
require 'mail'
require 'action_mailer/tmail_compat'
require 'action_mailer/collector'
require 'active_support/core_ext/array/wrap'
require 'active_support/core_ext/object/blank'
require 'active_support/core_ext/proc'
require 'active_support/core_ext/string/inflections'
require 'active_support/core_ext/hash/except'
require 'active_support/core_ext/module/anonymous'
require 'action_mailer/log_subscriber'
module ActionMailer #:nodoc:
@@ -23,16 +23,16 @@ module ActionMailer #:nodoc:
#
# Examples:
#
# class Notifier < ActionMailer::Base
# default :from => 'no-reply@example.com',
# class Notifier < ActionMailer::Base
# default :from => 'no-reply@example.com',
# :return_path => 'system@example.com'
#
# def welcome(recipient)
# @account = recipient
# mail(:to => recipient.email_address_with_name,
# :bcc => ["bcc@example.com", "Order Watcher <watcher@example.com>"])
# end
# end
# def welcome(recipient)
# @account = recipient
# mail(:to => recipient.email_address_with_name,
# :bcc => ["bcc@example.com", "Order Watcher <watcher@example.com>"])
# end
# end
#
# Within the mailer method, you have access to the following methods:
#
@@ -123,8 +123,8 @@ module ActionMailer #:nodoc:
#
# <%= users_url(:host => "example.com") %>
#
# You should use the <tt>named_route_url</tt> style (which generates absolute URLs) and avoid using the
# <tt>named_route_path</tt> style (which generates relative URLs), since clients reading the mail will
# You should use the <tt>named_route_url</tt> style (which generates absolute URLs) and avoid using the
# <tt>named_route_path</tt> style (which generates relative URLs), since clients reading the mail will
# have no concept of a current URL from which to determine a relative path.
#
# It is also possible to set a default host that will be used in all mailers by setting the <tt>:host</tt>
@@ -132,10 +132,13 @@ module ActionMailer #:nodoc:
#
# config.action_mailer.default_url_options = { :host => "example.com" }
#
# When you decide to set a default <tt>:host</tt> for your mailers, then you need to make sure to use the
# <tt>:only_path => false</tt> option when using <tt>url_for</tt>. Since the <tt>url_for</tt> view helper
# will generate relative URLs by default when a <tt>:host</tt> option isn't explicitly provided, passing
# <tt>:only_path => false</tt> will ensure that absolute URLs are generated.
# Setting <tt>ActionMailer::Base.default_url_options</tt> directly is now deprecated, use the configuration
# option mentioned above to set the default host.
#
# If you do decide to set a default <tt>:host</tt> for your mailers you want to use the
# <tt>:only_path => false</tt> option when using <tt>url_for</tt>. This will ensure that absolute URLs are
# generated because the <tt>url_for</tt> view helper will, by default, generate relative URLs when a
# <tt>:host</tt> option isn't explicitly provided.
#
# = Sending mail
#
@@ -150,8 +153,8 @@ module ActionMailer #:nodoc:
#
# = Multipart Emails
#
# Multipart messages can also be used implicitly because Action Mailer will automatically detect and use
# multipart templates, where each template is named after the name of the action, followed by the content
# Multipart messages can also be used implicitly because Action Mailer will automatically detect and use
# multipart templates, where each template is named after the name of the action, followed by the content
# type. Each such detected template will be added as a separate part to the message.
#
# For example, if the following templates exist:
@@ -214,15 +217,15 @@ module ActionMailer #:nodoc:
#
# = Observing and Intercepting Mails
#
# Action Mailer provides hooks into the Mail observer and interceptor methods. These allow you to
# register classes that are called during the mail delivery life cycle.
# Action Mailer provides hooks into the Mail observer and interceptor methods. These allow you to
# register objects that are called during the mail delivery life cycle.
#
# An observer class must implement the <tt>:delivered_email(message)</tt> method which will be
# An observer object must implement the <tt>:delivered_email(message)</tt> method which will be
# called once for every email sent after the email has been sent.
#
# An interceptor class must implement the <tt>:delivering_email(message)</tt> method which will be
# An interceptor object must implement the <tt>:delivering_email(message)</tt> method which will be
# called before the email is sent, allowing you to make modifications to the email before it hits
# the delivery agents. Your class should make any needed modifications directly to the passed
# the delivery agents. Your object should make any needed modifications directly to the passed
# in Mail::Message instance.
#
# = Default Hash
@@ -295,9 +298,9 @@ module ActionMailer #:nodoc:
# information and a cryptographic Message Digest 5 algorithm to hash important information)
# * <tt>:enable_starttls_auto</tt> - When set to true, detects if STARTTLS is enabled in your SMTP server
# and starts to use it.
# * <tt>:openssl_verify_mode</tt> - When using TLS, you can set how OpenSSL checks the certificate. This is
# really useful if you need to validate a self-signed and/or a wildcard certificate. You can use the name
# of an OpenSSL verify constant ('none', 'peer', 'client_once','fail_if_no_peer_cert') or directly the
# * <tt>:openssl_verify_mode</tt> - When using TLS, you can set how OpenSSL checks the certificate. This is
# really useful if you need to validate a self-signed and/or a wildcard certificate. You can use the name
# of an OpenSSL verify constant ('none', 'peer', 'client_once','fail_if_no_peer_cert') or directly the
# constant (OpenSSL::SSL::VERIFY_NONE, OpenSSL::SSL::VERIFY_PEER,...).
#
# * <tt>sendmail_settings</tt> - Allows you to override options for the <tt>:sendmail</tt> delivery method.
@@ -313,16 +316,29 @@ module ActionMailer #:nodoc:
#
# * <tt>delivery_method</tt> - Defines a delivery method. Possible values are <tt>:smtp</tt> (default),
# <tt>:sendmail</tt>, <tt>:test</tt>, and <tt>:file</tt>. Or you may provide a custom delivery method
# object eg. MyOwnDeliveryMethodClass.new. See the Mail gem documentation on the interface you need to
# object eg. MyOwnDeliveryMethodClass.new. See the Mail gem documentation on the interface you need to
# implement for a custom delivery agent.
#
# * <tt>perform_deliveries</tt> - Determines whether emails are actually sent from Action Mailer when you
# call <tt>.deliver</tt> on an mail message or on an Action Mailer method. This is on by default but can
# call <tt>.deliver</tt> on an mail message or on an Action Mailer method. This is on by default but can
# be turned off to aid in functional testing.
#
# * <tt>deliveries</tt> - Keeps an array of all the emails sent out through the Action Mailer with
# <tt>delivery_method :test</tt>. Most useful for unit and functional testing.
#
# * <tt>default_charset</tt> - This is now deprecated, use the +default+ method above to
# set the default +:charset+.
#
# * <tt>default_content_type</tt> - This is now deprecated, use the +default+ method above
# to set the default +:content_type+.
#
# * <tt>default_mime_version</tt> - This is now deprecated, use the +default+ method above
# to set the default +:mime_version+.
#
# * <tt>default_implicit_parts_order</tt> - This is now deprecated, use the +default+ method above
# to set the default +:parts_order+. Parts Order is used when a message is built implicitly
# (i.e. multiple parts are assembled from templates which specify the content type in their
# filenames) this variable controls how the parts are ordered.
class Base < AbstractController::Base
include DeliveryMethods
abstract!
@@ -337,6 +353,7 @@ module ActionMailer #:nodoc:
self.protected_instance_variables = %w(@_action_has_layout)
helper ActionMailer::MailHelper
include ActionMailer::OldApi
private_class_method :new #:nodoc:
@@ -376,7 +393,7 @@ module ActionMailer #:nodoc:
end
def mailer_name
@mailer_name ||= anonymous? ? "anonymous" : name.underscore
@mailer_name ||= name.underscore
end
attr_writer :mailer_name
alias :controller_path :mailer_name
@@ -448,24 +465,13 @@ module ActionMailer #:nodoc:
# method, for instance).
def initialize(method_name=nil, *args)
super()
@mail_was_called = false
@_message = Mail.new
process(method_name, *args) if method_name
end
def process(*args) #:nodoc:
lookup_context.skip_default_locale!
super
@_message = NullMail.new unless @mail_was_called
end
class NullMail #:nodoc:
def body; '' end
def method_missing(*args)
nil
end
end
def mailer_name
@@ -536,7 +542,7 @@ module ActionMailer #:nodoc:
#
# * <tt>:subject</tt> - The subject of the message, if this is omitted, Action Mailer will
# ask the Rails I18n class for a translated <tt>:subject</tt> in the scope of
# <tt>[mailer_scope, action_name]</tt> or if this is missing, will translate the
# <tt>[:actionmailer, mailer_scope, action_name]</tt> or if this is missing, will translate the
# humanized version of the <tt>action_name</tt>
# * <tt>:to</tt> - Who the message is destined for, can be a string of addresses, or an array
# of addresses.
@@ -562,8 +568,8 @@ module ActionMailer #:nodoc:
# method.
#
# When a <tt>:return_path</tt> is specified as header, that value will be used as the 'envelope from'
# address for the Mail message. Setting this is useful when you want delivery notifications
# sent to a different address than the one in <tt>:from</tt>. Mail will actually use the
# address for the Mail message. Setting this is useful when you want delivery notifications
# sent to a different address than the one in <tt>:from</tt>. Mail will actually use the
# <tt>:return_path</tt> in preference to the <tt>:sender</tt> in preference to the <tt>:from</tt>
# field for the 'envelope from' value.
#
@@ -615,9 +621,8 @@ module ActionMailer #:nodoc:
# end
#
def mail(headers={}, &block)
# Guard flag to prevent both the old and the new API from firing.
# On master this flag was renamed to `@_mail_was_called`.
# On master there is only one API and this flag is no longer used as a guard.
# Guard flag to prevent both the old and the new API from firing
# Should be removed when old API is removed
@mail_was_called = true
m = @_message
@@ -746,4 +751,3 @@ module ActionMailer #:nodoc:
ActiveSupport.run_load_hooks(:action_mailer, self)
end
end

View File

@@ -22,9 +22,9 @@ module ActionMailer #:nodoc:
def custom(mime, options={})
options.reverse_merge!(:content_type => mime.to_s)
@context.formats = [mime.to_sym]
@context.freeze_formats([mime.to_sym])
options[:body] = block_given? ? yield : @default_render.call
@responses << options
end
end
end
end

View File

@@ -4,12 +4,12 @@ module ActionMailer
class LogSubscriber < ActiveSupport::LogSubscriber
def deliver(event)
recipients = Array.wrap(event.payload[:to]).join(', ')
info("\nSent mail to #{recipients} (#{format_duration(event.duration)})")
info("\nSent mail to #{recipients} (%1.fms)" % event.duration)
debug(event.payload[:mail])
end
def receive(event)
info("\nReceived mail (#{format_duration(event.duration)})")
info("\nReceived mail (%.1fms)" % event.duration)
debug(event.payload[:mail])
end
@@ -19,4 +19,4 @@ module ActionMailer
end
end
ActionMailer::LogSubscriber.attach_to :action_mailer
ActionMailer::LogSubscriber.attach_to :action_mailer

View File

@@ -0,0 +1,255 @@
require 'active_support/concern'
require 'active_support/core_ext/object/try'
require 'active_support/core_ext/object/blank'
module ActionMailer
module OldApi #:nodoc:
extend ActiveSupport::Concern
included do
extend ActionMailer::AdvAttrAccessor
self.protected_instance_variables.concat %w(@parts @mail_was_called @headers)
# Specify the BCC addresses for the message
adv_attr_accessor :bcc
# Specify the CC addresses for the message.
adv_attr_accessor :cc
# Specify the charset to use for the message. This defaults to the
# +default_charset+ specified for ActionMailer::Base.
adv_attr_accessor :charset
# Specify the content type for the message. This defaults to <tt>text/plain</tt>
# in most cases, but can be automatically set in some situations.
adv_attr_accessor :content_type
# Specify the from address for the message.
adv_attr_accessor :from
# Specify the address (if different than the "from" address) to direct
# replies to this message.
adv_attr_accessor :reply_to
# Specify the order in which parts should be sorted, based on content-type.
# This defaults to the value for the +default_implicit_parts_order+.
adv_attr_accessor :implicit_parts_order
# Defaults to "1.0", but may be explicitly given if needed.
adv_attr_accessor :mime_version
# The recipient addresses for the message, either as a string (for a single
# address) or an array (for multiple addresses).
adv_attr_accessor :recipients, "Please pass :to as hash key to mail() instead"
# The date on which the message was sent. If not set (the default), the
# header will be set by the delivery agent.
adv_attr_accessor :sent_on, "Please pass :date as hash key to mail() instead"
# Specify the subject of the message.
adv_attr_accessor :subject
# Specify the template name to use for current message. This is the "base"
# template name, without the extension or directory, and may be used to
# have multiple mailer methods share the same template.
adv_attr_accessor :template, "Please pass :template_name or :template_path as hash key to mail() instead"
# Define the body of the message. This is either a Hash (in which case it
# specifies the variables to pass to the template when it is rendered),
# or a string, in which case it specifies the actual text of the message.
adv_attr_accessor :body
end
def process(method_name, *args)
initialize_defaults(method_name)
super
unless @mail_was_called
create_parts
create_mail
end
@_message
end
# Add a part to a multipart message, with the given content-type. The
# part itself is yielded to the block so that other properties (charset,
# body, headers, etc.) can be set on it.
def part(params)
ActiveSupport::Deprecation.warn "part() is deprecated and will be removed in future versions. " <<
"Please pass a block to mail() instead."
params = {:content_type => params} if String === params
if custom_headers = params.delete(:headers)
params.merge!(custom_headers)
end
part = Mail::Part.new(params)
yield part if block_given?
@parts << part
end
# Add an attachment to a multipart message. This is simply a part with the
# content-disposition set to "attachment".
def attachment(params, &block)
ActiveSupport::Deprecation.warn "attachment() is deprecated and will be removed in future versions. " <<
"Please use the attachments[] API instead."
params = { :content_type => params } if String === params
params[:content] ||= params.delete(:data) || params.delete(:body)
if params[:filename]
params = normalize_file_hash(params)
else
params = normalize_nonfile_hash(params)
end
part(params, &block)
end
protected
def normalize_nonfile_hash(params)
content_disposition = "attachment;"
mime_type = params.delete(:mime_type)
if content_type = params.delete(:content_type)
content_type = "#{mime_type || content_type};"
end
params[:body] = params.delete(:data) if params[:data]
{ :content_type => content_type,
:content_disposition => content_disposition }.merge(params)
end
def normalize_file_hash(params)
filename = File.basename(params.delete(:filename))
content_disposition = "attachment; filename=\"#{File.basename(filename)}\""
mime_type = params.delete(:mime_type)
if (content_type = params.delete(:content_type)) && (content_type !~ /filename=/)
content_type = "#{mime_type || content_type}; filename=\"#{filename}\""
end
params[:body] = params.delete(:data) if params[:data]
{ :content_type => content_type,
:content_disposition => content_disposition }.merge(params)
end
def create_mail
m = @_message
set_fields!({:subject => @subject, :to => @recipients, :from => @from,
:bcc => @bcc, :cc => @cc, :reply_to => @reply_to}, @charset)
m.mime_version = @mime_version if @mime_version
m.date = @sent_on.to_time rescue @sent_on if @sent_on
@headers.each { |k, v| m[k] = v }
real_content_type, ctype_attrs = parse_content_type
main_type, sub_type = split_content_type(real_content_type)
if @parts.size == 1 && @parts.first.parts.empty?
m.content_type([main_type, sub_type, ctype_attrs])
m.body = @parts.first.body.encoded
else
@parts.each do |p|
m.add_part(p)
end
m.body.set_sort_order(@implicit_parts_order)
m.body.sort_parts!
if real_content_type =~ /multipart/
ctype_attrs.delete "charset"
m.content_type([main_type, sub_type, ctype_attrs])
end
end
wrap_delivery_behavior!
m.content_transfer_encoding = '8bit' unless m.body.only_us_ascii?
@_message
end
# Set up the default values for the various instance variables of this
# mailer. Subclasses may override this method to provide different
# defaults.
def initialize_defaults(method_name)
@charset ||= self.class.default[:charset].try(:dup)
@content_type ||= self.class.default[:content_type].try(:dup)
@implicit_parts_order ||= self.class.default[:parts_order].try(:dup)
@mime_version ||= self.class.default[:mime_version].try(:dup)
@cc, @bcc, @reply_to, @subject, @from, @recipients = nil, nil, nil, nil, nil, nil
@mailer_name ||= self.class.mailer_name.dup
@template ||= method_name
@mail_was_called = false
@parts ||= []
@headers ||= {}
@sent_on ||= Time.now
@body ||= {}
end
def create_parts
if String === @body
@parts.unshift create_inline_part(@body)
elsif @parts.empty? || @parts.all? { |p| p.content_disposition =~ /^attachment/ }
lookup_context.find_all(@template, [@mailer_name]).each do |template|
self.formats = template.formats
@parts << create_inline_part(render(:template => template), template.mime_type)
end
if @parts.size > 1
@content_type = "multipart/alternative" if @content_type !~ /^multipart/
end
# If this is a multipart e-mail add the mime_version if it is not
# already set.
@mime_version ||= "1.0" unless @parts.empty?
end
end
def create_inline_part(body, mime_type=nil)
ct = mime_type || "text/plain"
main_type, sub_type = split_content_type(ct.to_s)
Mail::Part.new(
:content_type => [main_type, sub_type, {:charset => charset}],
:content_disposition => "inline",
:body => body
)
end
def set_fields!(headers, charset) #:nodoc:
m = @_message
m.charset = charset
m.subject ||= headers.delete(:subject) if headers[:subject]
m.to ||= headers.delete(:to) if headers[:to]
m.from ||= headers.delete(:from) if headers[:from]
m.cc ||= headers.delete(:cc) if headers[:cc]
m.bcc ||= headers.delete(:bcc) if headers[:bcc]
m.reply_to ||= headers.delete(:reply_to) if headers[:reply_to]
end
def split_content_type(ct)
ct.to_s.split("/")
end
def parse_content_type
if @content_type.blank?
[ nil, {} ]
else
ctype, *attrs = @content_type.split(/;\s*/)
attrs = Hash[attrs.map { |attr| attr.split(/=/, 2) }]
[ctype, {"charset" => @charset}.merge!(attrs)]
end
end
end
end

View File

@@ -19,9 +19,8 @@ module ActionMailer
options.stylesheets_dir ||= paths["public/stylesheets"].first
# make sure readers methods get compiled
options.asset_path ||= app.config.asset_path
options.asset_host ||= app.config.asset_host
options.relative_url_root ||= app.config.relative_url_root
options.asset_path ||= app.config.asset_path
options.asset_host ||= app.config.asset_host
ActiveSupport.on_load(:action_mailer) do
include AbstractController::UrlFor

View File

@@ -15,22 +15,9 @@ module ActionMailer
include TestHelper
included do
class_attribute :_mailer_class
setup :initialize_test_deliveries
setup :set_expected_mail
end
module ClassMethods
def tests(mailer)
case mailer
when String, Symbol
self._mailer_class = mailer.to_s.camelize.constantize
when Module
self._mailer_class = mailer
else
raise NonInferrableMailerError.new(mailer)
end
self._mailer_class = mailer
end
def mailer_class
@@ -48,6 +35,8 @@ module ActionMailer
end
end
module InstanceMethods
protected
def initialize_test_deliveries
@@ -75,8 +64,16 @@ module ActionMailer
def read_fixture(action)
IO.readlines(File.join(Rails.root, 'test', 'fixtures', self.class.mailer_class.name.underscore, action))
end
end
included do
class_attribute :_mailer_class
setup :initialize_test_deliveries
setup :set_expected_mail
end
end
include Behavior
end
end

View File

@@ -0,0 +1,37 @@
module Mail
class Message
def set_content_type(*args)
message = 'Message#set_content_type is deprecated, please just call ' <<
'Message#content_type with the same arguments'
ActiveSupport::Deprecation.warn(message, caller[0,2])
content_type(*args)
end
alias :old_transfer_encoding :transfer_encoding
def transfer_encoding(value = nil)
if value
message = 'Message#transfer_encoding is deprecated, ' <<
'please call Message#content_transfer_encoding with the same arguments'
ActiveSupport::Deprecation.warn(message, caller[0,2])
content_transfer_encoding(value)
else
old_transfer_encoding
end
end
def transfer_encoding=(value)
message = 'Message#transfer_encoding= is deprecated, ' <<
'please call Message#content_transfer_encoding= with the same arguments'
ActiveSupport::Deprecation.warn(message, caller[0,2])
self.content_transfer_encoding = value
end
def original_filename
message = 'Message#original_filename is deprecated, please call Message#filename'
ActiveSupport::Deprecation.warn(message, caller[0,2])
filename
end
end
end

View File

@@ -1,8 +1,8 @@
module ActionMailer
module VERSION #:nodoc:
MAJOR = 3
MINOR = 2
TINY = 19
MINOR = 1
TINY = 8
PRE = nil
STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')

View File

@@ -471,18 +471,6 @@ class BaseTest < ActiveSupport::TestCase
assert_equal(%{<img alt="Dummy" src="http://local.com/images/dummy.png" />}, mail.body.to_s.strip)
end
test 'the view is not rendered when mail was never called' do
mail = BaseMailer.without_mail_call
assert_equal('', mail.body.to_s.strip)
mail.deliver
end
test 'the return value of mailer methods is not relevant' do
mail = BaseMailer.with_nil_as_return_value
assert_equal('Welcome', mail.body.to_s.strip)
mail.deliver
end
# Before and After hooks
class MyObserver
@@ -574,19 +562,6 @@ class BaseTest < ActiveSupport::TestCase
assert_equal ["notify"], FooMailer.action_methods
end
test "mailer can be anonymous" do
mailer = Class.new(ActionMailer::Base) do
def welcome
mail
end
end
assert_equal "anonymous", mailer.mailer_name
assert_equal "Welcome", mailer.welcome.subject
assert_equal "Anonymous mailer body", mailer.welcome.body.encoded.strip
end
protected
# Execute the block setting the given values and restoring old values after

View File

@@ -1 +0,0 @@
Anonymous mailer body

View File

@@ -1 +0,0 @@
<% raise 'the template should not be rendered' %>

View File

@@ -1,5 +1,4 @@
require "abstract_unit"
require 'mailers/base_mailer'
require "active_support/log_subscriber/test_helper"
require "action_mailer/log_subscriber"
@@ -12,6 +11,13 @@ class AMLogSubscriberTest < ActionMailer::TestCase
end
class TestMailer < ActionMailer::Base
def basic
recipients "somewhere@example.com"
subject "basic"
from "basic@example.com"
body "Hello world"
end
def receive(mail)
# Do nothing
end
@@ -22,12 +28,12 @@ class AMLogSubscriberTest < ActionMailer::TestCase
end
def test_deliver_is_notified
BaseMailer.welcome.deliver
TestMailer.basic.deliver
wait
assert_equal(1, @logger.logged(:info).size)
assert_match(/Sent mail to system@test.lindsaar.net/, @logger.logged(:info).first)
assert_match(/Sent mail to somewhere@example.com/, @logger.logged(:info).first)
assert_equal(1, @logger.logged(:debug).size)
assert_match(/Welcome/, @logger.logged(:debug).first)
assert_match(/Hello world/, @logger.logged(:debug).first)
end
def test_receive_is_notified

View File

@@ -38,7 +38,7 @@ class BaseMailer < ActionMailer::Base
end
def attachment_with_hash
attachments['invoice.jpg'] = { :data => ::Base64.encode64("\312\213\254\232)b"),
attachments['invoice.jpg'] = { :data => "\312\213\254\232)b",
:mime_type => "image/x-jpg",
:transfer_encoding => "base64" }
mail
@@ -113,14 +113,6 @@ class BaseMailer < ActionMailer::Base
end
def email_with_translations
mail :body => render("email_with_translations", :formats => [:html])
end
def without_mail_call
end
def with_nil_as_return_value(hash = {})
mail(:template_name => "welcome")
nil
mail :body => render("email_with_translations.html")
end
end

View File

@@ -0,0 +1,41 @@
require 'abstract_unit'
require 'action_mailer/adv_attr_accessor'
class AdvAttrTest < ActiveSupport::TestCase
class Person
cattr_reader :protected_instance_variables
@@protected_instance_variables = []
extend ActionMailer::AdvAttrAccessor
adv_attr_accessor :name
end
def setup
ActiveSupport::Deprecation.silenced = true
@person = Person.new
end
def teardown
ActiveSupport::Deprecation.silenced = false
end
def test_adv_attr
assert_nil @person.name
@person.name 'Bob'
assert_equal 'Bob', @person.name
end
def test_adv_attr_writer
assert_nil @person.name
@person.name = 'Bob'
assert_equal 'Bob', @person.name
end
def test_raise_an_error_with_multiple_args
assert_raise(ArgumentError) { @person.name('x', 'y') }
end
def test_ivar_is_added_to_protected_instnace_variables
assert Person.protected_instance_variables.include?('@name')
end
end

View File

@@ -0,0 +1,134 @@
require 'abstract_unit'
class RenderMailer < ActionMailer::Base
def inline_template
recipients 'test@localhost'
subject "using helpers"
from "tester@example.com"
@world = "Earth"
body render(:inline => "Hello, <%= @world %>")
end
def file_template
recipients 'test@localhost'
subject "using helpers"
from "tester@example.com"
@recipient = 'test@localhost'
body render(:file => "templates/signed_up")
end
def no_instance_variable
recipients 'test@localhost'
subject "No Instance Variable"
from "tester@example.com"
silence_warnings do
body render(:inline => "Look, subject.nil? is <%= @subject.nil? %>!")
end
end
def multipart_alternative
recipients 'test@localhost'
subject 'multipart/alternative'
from 'tester@example.com'
build_multipart_message(:foo => "bar")
end
private
def build_multipart_message(assigns = {})
content_type "multipart/alternative"
part "text/plain" do |p|
p.body = build_body_part('plain', assigns, :layout => false)
end
part "text/html" do |p|
p.body = build_body_part('html', assigns)
end
end
def build_body_part(content_type, assigns, options = {})
ActiveSupport::Deprecation.silence do
render "#{template}.#{content_type}", :body => assigns
end
end
end
class FirstMailer < ActionMailer::Base
def share
recipients 'test@localhost'
subject "using helpers"
from "tester@example.com"
end
end
class SecondMailer < ActionMailer::Base
def share
recipients 'test@localhost'
subject "using helpers"
from "tester@example.com"
end
end
# CHANGED: Those tests were changed because body returns an object now
# Instead of mail.body.strip, we should mail.body.to_s.strip
class RenderHelperTest < Test::Unit::TestCase
def setup
set_delivery_method :test
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.deliveries.clear
ActiveSupport::Deprecation.silenced = true
@recipient = 'test@localhost'
end
def teardown
ActiveSupport::Deprecation.silenced = false
restore_delivery_method
end
def test_inline_template
mail = RenderMailer.inline_template
assert_equal "Hello, Earth", mail.body.to_s.strip
end
def test_file_template
mail = RenderMailer.file_template
assert_equal "Hello there,\n\nMr. test@localhost", mail.body.to_s.strip
end
def test_no_instance_variable
mail = RenderMailer.no_instance_variable.deliver
assert_equal "Look, subject.nil? is true!", mail.body.to_s.strip
end
end
class FirstSecondHelperTest < Test::Unit::TestCase
def setup
set_delivery_method :test
ActiveSupport::Deprecation.silenced = true
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.deliveries.clear
@recipient = 'test@localhost'
end
def teardown
ActiveSupport::Deprecation.silenced = false
restore_delivery_method
end
def test_ordering
mail = FirstMailer.share
assert_equal "first mail", mail.body.to_s.strip
mail = SecondMailer.share
assert_equal "second mail", mail.body.to_s.strip
mail = FirstMailer.share
assert_equal "first mail", mail.body.to_s.strip
mail = SecondMailer.share
assert_equal "second mail", mail.body.to_s.strip
end
end

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,42 @@
require 'abstract_unit'
class TmailCompatTest < ActiveSupport::TestCase
def setup
@silence = ActiveSupport::Deprecation.silenced
ActiveSupport::Deprecation.silenced = false
end
def teardown
ActiveSupport::Deprecation.silenced = @silence
end
def test_set_content_type_raises_deprecation_warning
mail = Mail.new
assert_deprecated do
assert_nothing_raised do
mail.set_content_type "text/plain"
end
end
assert_equal mail.mime_type, "text/plain"
end
def test_transfer_encoding_raises_deprecation_warning
mail = Mail.new
assert_deprecated do
assert_nothing_raised do
mail.transfer_encoding "base64"
end
end
assert_equal mail.content_transfer_encoding, "base64"
end
def test_transfer_encoding_setter_raises_deprecation_warning
mail = Mail.new
assert_deprecated do
assert_nothing_raised do
mail.transfer_encoding = "base64"
end
end
assert_equal mail.content_transfer_encoding, "base64"
end
end

View File

@@ -1,28 +0,0 @@
require 'abstract_unit'
class TestTestMailer < ActionMailer::Base
end
class CrazyNameMailerTest < ActionMailer::TestCase
tests TestTestMailer
def test_set_mailer_class_manual
assert_equal TestTestMailer, self.class.mailer_class
end
end
class CrazySymbolNameMailerTest < ActionMailer::TestCase
tests :test_test_mailer
def test_set_mailer_class_manual_using_symbol
assert_equal TestTestMailer, self.class.mailer_class
end
end
class CrazyStringNameMailerTest < ActionMailer::TestCase
tests 'test_test_mailer'
def test_set_mailer_class_manual_using_string
assert_equal TestTestMailer, self.class.mailer_class
end
end

File diff suppressed because it is too large Load Diff

View File

@@ -218,7 +218,7 @@ A short rundown of some of the major features:
def show
# the output of the method will be cached as
# ActionController::Base.page_cache_directory + "/weblog/show.html"
# ActionController::Base.page_cache_directory + "/weblog/show/n.html"
# and the web server will pick it up without even hitting Rails
end
@@ -283,7 +283,7 @@ methods:
The last two lines are responsible for telling ActionController where the
template files are located and actually running the controller on a new
request from the web-server (e.g., Apache).
request from the web-server (like to be Apache).
And the templates look like this:
@@ -316,13 +316,13 @@ an URL such as /weblog/5 (where 5 is the id of the post).
== Download and installation
The latest version of Action Pack can be installed with RubyGems:
The latest version of Action Pack can be installed with Rubygems:
% [sudo] gem install actionpack
Source code can be downloaded as part of the Rails project on GitHub
* https://github.com/rails/rails/tree/3-2-stable/actionpack
* https://github.com/rails/rails/tree/master/actionpack
== License
@@ -334,7 +334,7 @@ Action Pack is released under the MIT license.
API documentation is at
* http://api.rubyonrails.org
* http://api.rubyonrails.com
Bug reports and feature requests can be filed with the rest for the Ruby on Rails project here:

View File

@@ -18,7 +18,7 @@ which can be further narrowed down to one test:
== Dependency on Active Record and database setup
Test cases in the test/active_record/ directory depend on having
Test cases in the test/controller/active_record/ directory depend on having
activerecord and sqlite installed. If Active Record is not in
actionpack/../activerecord directory, or the sqlite rubygem is not installed,
these tests are skipped.

View File

@@ -26,11 +26,6 @@ namespace :test do
Rake::TestTask.new(:isolated) do |t|
t.pattern = 'test/ts_isolated.rb'
end
Rake::TestTask.new(:template) do |t|
t.libs << 'test'
t.pattern = 'test/template/**/*.rb'
end
end
desc 'ActiveRecord Integration Tests'

View File

@@ -6,9 +6,6 @@ Gem::Specification.new do |s|
s.version = version
s.summary = 'Web-flow and rendering framework putting the VC in MVC (part of Rails).'
s.description = 'Web apps on Rails. Simple, battle-tested conventions for building and testing MVC web applications. Works with any Rack-compatible server.'
s.license = 'MIT'
s.required_ruby_version = '>= 1.8.7'
s.author = 'David Heinemeier Hansson'
@@ -23,9 +20,11 @@ Gem::Specification.new do |s|
s.add_dependency('activemodel', version)
s.add_dependency('rack-cache', '~> 1.2')
s.add_dependency('builder', '~> 3.2')
s.add_dependency('rack', '~> 1.4.5')
s.add_dependency('i18n', '~> 0.6')
s.add_dependency('rack', '~> 1.4.1')
s.add_dependency('rack-test', '~> 0.6.1')
s.add_dependency('journey', '~> 1.0.4')
s.add_dependency('rack-mount', '~> 0.8.2')
s.add_dependency('sprockets', '~> 2.10')
s.add_dependency('erubis', '~> 2.7.0')
s.add_development_dependency('tzinfo', '~> 0.3.29')

View File

@@ -1,185 +0,0 @@
ENV['RAILS_ENV'] ||= 'production'
require File.expand_path('../../../load_paths', __FILE__)
require 'action_pack'
require 'action_controller'
require 'action_view'
require 'active_model'
require 'benchmark'
MyHash = Class.new(Hash)
Hash.class_eval do
extend ActiveModel::Naming
include ActiveModel::Conversion
end
class Runner
def initialize(app, output)
@app, @output = app, output
end
def puts(*)
super if @output
end
def call(env)
env['n'].to_i.times { @app.call(env) }
@app.call(env).tap { |response| report(env, response) }
end
def report(env, response)
return unless ENV["DEBUG"]
out = env['rack.errors']
out.puts response[0], response[1].to_yaml, '---'
response[2].each { |part| out.puts part }
out.puts '---'
end
def self.puts(*)
super if @output
end
def self.print(*)
super if @output
end
def self.app_and_env_for(action, n)
env = Rack::MockRequest.env_for("/")
env.merge!('n' => n, 'rack.input' => StringIO.new(''), 'rack.errors' => $stdout)
app = lambda { |env| BasePostController.action(action).call(env) }
return app, env
end
$ran = []
def self.run(action, n, output = true)
print "."
STDOUT.flush
@output = output
label = action.to_s
app, env = app_and_env_for(action, n)
t = Benchmark.realtime { new(app, output).call(env) }
$ran << [label, (t * 1000).to_i.to_s] if output
end
def self.done
puts
header, content = "", ""
$ran.each do |k,v|
size = [k.size, v.size].max + 1
header << format("%#{size}s", k)
content << format("%#{size}s", v)
end
puts header
puts content
end
end
ActionController::Base.logger = nil
ActionController::Base.config.compile_methods!
ActionView::Resolver.caching = ENV["RAILS_ENV"] == "production"
class BasePostController < ActionController::Base
append_view_path "#{File.dirname(__FILE__)}/views"
def overhead
self.response_body = ''
end
def index
render :text => ''
end
$OBJECT = {:name => "Hello my name is omg", :address => "333 omg"}
def partial
render :partial => "/collection", :object => $OBJECT
end
def partial_10
render :partial => "/ten_partials"
end
def partial_100
render :partial => "/hundred_partials"
end
$COLLECTION1 = []
10.times do |i|
$COLLECTION1 << { :name => "Hello my name is omg", :address => "333 omg" }
end
def coll_10
render :partial => "/collection", :collection => $COLLECTION1
end
$COLLECTION2 = []
100.times do |i|
$COLLECTION2 << { :name => "Hello my name is omg", :address => "333 omg" }
end
def coll_100
render :partial => "/collection", :collection => $COLLECTION2
end
def uniq_100
render :partial => $COLLECTION2
end
$COLLECTION3 = []
50.times do |i|
$COLLECTION3 << {:name => "Hello my name is omg", :address => "333 omg"}
$COLLECTION3 << MyHash.new(:name => "Hello my name is omg", :address => "333 omg")
end
def diff_100
render :partial => $COLLECTION3
end
def template_1
render :template => "template"
end
module Foo
def omg
"omg"
end
end
helper Foo
end
N = (ENV['N'] || 1000).to_i
# ActionController::Base.use_accept_header = false
def run_all!(times, verbose)
Runner.run(:overhead, times, verbose)
Runner.run(:index, times, verbose)
Runner.run(:template_1, times, verbose)
Runner.run(:partial, times, verbose)
Runner.run(:partial_10, times, verbose)
Runner.run(:coll_10, times, verbose)
Runner.run(:partial_100, times, verbose)
Runner.run(:coll_100, times, verbose)
Runner.run(:uniq_100, times, verbose)
Runner.run(:diff_100, times, verbose)
end
unless ENV["PROFILE"]
run_all!(1, false)
(ENV["M"] || 1).to_i.times do
$ran = []
run_all!(N, true)
Runner.done
end
else
Runner.run(ENV["PROFILE"].to_sym, 1, false)
require "ruby-prof"
RubyProf.start
Runner.run(ENV["PROFILE"].to_sym, N, true)
result = RubyProf.stop
printer = RubyProf::CallStackPrinter.new(result)
printer.print(File.open("output.html", "w"))
end

View File

@@ -1,3 +0,0 @@
<%= collection[:name] %>
<%= collection[:address] %>
<%= omg %>

View File

@@ -1 +0,0 @@
Hello

View File

@@ -1,3 +0,0 @@
<% 100.times do %>
<%= render :partial => "/collection", :object => $OBJECT %>
<% end %>

View File

@@ -1,10 +0,0 @@
<%= "Hello" %>
<%= "Hello" %>
<%= "Hello" %>
<%= "Hello" %>
<%= "Hello" %>
<%= "Hello" %>
<%= "Hello" %>
<%= "Hello" %>
<%= "Hello" %>
<%= "Hello" %>

View File

@@ -1,10 +0,0 @@
<%= render :partial => '/collection', :object => $OBJECT %>
<%= render :partial => '/collection', :object => $OBJECT %>
<%= render :partial => '/collection', :object => $OBJECT %>
<%= render :partial => '/collection', :object => $OBJECT %>
<%= render :partial => '/collection', :object => $OBJECT %>
<%= render :partial => '/collection', :object => $OBJECT %>
<%= render :partial => '/collection', :object => $OBJECT %>
<%= render :partial => '/collection', :object => $OBJECT %>
<%= render :partial => '/collection', :object => $OBJECT %>
<%= render :partial => '/collection', :object => $OBJECT %>

View File

@@ -1,3 +0,0 @@
<%= hash[:name] %>
<%= hash[:address] %>
<%= omg %>

View File

@@ -1,3 +0,0 @@
<%= my_hash[:name] %>
<%= my_hash[:address] %>
<%= omg %>

View File

@@ -1 +0,0 @@
Hello

View File

@@ -4,7 +4,7 @@ module AbstractController
included do
config_accessor :asset_host, :asset_path, :assets_dir, :javascripts_dir,
:stylesheets_dir, :default_asset_host_protocol, :relative_url_root
:stylesheets_dir, :default_asset_host_protocol
end
end
end

View File

@@ -10,7 +10,7 @@ module AbstractController
# <tt>AbstractController::Base</tt> is a low-level API. Nobody should be
# using it directly, and subclasses (like ActionController::Base) are
# expected to provide their own +render+ method, since rendering means
# different things depending on the context.
# different things depending on the context.
class Base
attr_internal :response_body
attr_internal :action_name
@@ -112,7 +112,7 @@ module AbstractController
def process(action, *args)
@_action_name = action_name = action.to_s
unless action_name = _find_action_name(action_name)
unless action_name = method_for_action(action_name)
raise ActionNotFound, "The action '#{action}' could not be found for #{self.class.name}"
end
@@ -138,7 +138,7 @@ module AbstractController
# available action consider actions that are also available
# through other means, for example, implicit render ones.
def available_action?(action_name)
_find_action_name(action_name).present?
method_for_action(action_name).present?
end
private
@@ -181,23 +181,6 @@ module AbstractController
action_missing(@_action_name, *args)
end
# Takes an action name and returns the name of the method that will
# handle the action.
#
# It checks if the action name is valid and returns false otherwise.
#
# See method_for_action for more information.
#
# ==== Parameters
# * <tt>action_name</tt> - An action name to find a method name for
#
# ==== Returns
# * <tt>string</tt> - The name of the method that handles the action
# * false - No valid method name could be found. Raise ActionNotFound.
def _find_action_name(action_name)
_valid_action_name?(action_name) && method_for_action(action_name)
end
# Takes an action name and returns the name of the method that will
# handle the action. In normal cases, this method returns the same
# name as it receives. By default, if #method_for_action receives
@@ -220,16 +203,11 @@ module AbstractController
#
# ==== Returns
# * <tt>string</tt> - The name of the method that handles the action
# * <tt>nil</tt> - No method name could be found.
# * <tt>nil</tt> - No method name could be found. Raise ActionNotFound.
def method_for_action(action_name)
if action_method?(action_name) then action_name
elsif respond_to?(:action_missing, true) then "_handle_action_missing"
end
end
# Checks if the action name is valid and returns false otherwise.
def _valid_action_name?(action_name)
action_name.to_s !~ Regexp.new(File::SEPARATOR)
end
end
end

View File

@@ -75,122 +75,38 @@ module AbstractController
end
end
##
# :method: before_filter
#
# :call-seq: before_filter(names, block)
#
# Append a before filter. See _insert_callbacks for parameter details.
##
# :method: prepend_before_filter
#
# :call-seq: prepend_before_filter(names, block)
#
# Prepend a before filter. See _insert_callbacks for parameter details.
##
# :method: skip_before_filter
#
# :call-seq: skip_before_filter(names, block)
#
# Skip a before filter. See _insert_callbacks for parameter details.
##
# :method: append_before_filter
#
# :call-seq: append_before_filter(names, block)
#
# Append a before filter. See _insert_callbacks for parameter details.
##
# :method: after_filter
#
# :call-seq: after_filter(names, block)
#
# Append an after filter. See _insert_callbacks for parameter details.
##
# :method: prepend_after_filter
#
# :call-seq: prepend_after_filter(names, block)
#
# Prepend an after filter. See _insert_callbacks for parameter details.
##
# :method: skip_after_filter
#
# :call-seq: skip_after_filter(names, block)
#
# Skip an after filter. See _insert_callbacks for parameter details.
##
# :method: append_after_filter
#
# :call-seq: append_after_filter(names, block)
#
# Append an after filter. See _insert_callbacks for parameter details.
##
# :method: around_filter
#
# :call-seq: around_filter(names, block)
#
# Append an around filter. See _insert_callbacks for parameter details.
##
# :method: prepend_around_filter
#
# :call-seq: prepend_around_filter(names, block)
#
# Prepend an around filter. See _insert_callbacks for parameter details.
##
# :method: skip_around_filter
#
# :call-seq: skip_around_filter(names, block)
#
# Skip an around filter. See _insert_callbacks for parameter details.
##
# :method: append_around_filter
#
# :call-seq: append_around_filter(names, block)
#
# Append an around filter. See _insert_callbacks for parameter details.
# set up before_filter, prepend_before_filter, skip_before_filter, etc.
# for each of before, after, and around.
[:before, :after, :around].each do |filter|
class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
# Append a before, after or around filter. See _insert_callbacks
# for details on the allowed parameters.
def #{filter}_filter(*names, &blk) # def before_filter(*names, &blk)
_insert_callbacks(names, blk) do |name, options| # _insert_callbacks(names, blk) do |name, options|
options[:if] = (Array.wrap(options[:if]) << "!halted") if #{filter == :after} # options[:if] = (Array.wrap(options[:if]) << "!halted") if false
set_callback(:process_action, :#{filter}, name, options) # set_callback(:process_action, :before, name, options)
end # end
end # end
def #{filter}_filter(*names, &blk)
_insert_callbacks(names, blk) do |name, options|
options[:if] = (Array.wrap(options[:if]) << "!halted") if #{filter == :after}
set_callback(:process_action, :#{filter}, name, options)
end
end
# Prepend a before, after or around filter. See _insert_callbacks
# for details on the allowed parameters.
def prepend_#{filter}_filter(*names, &blk) # def prepend_before_filter(*names, &blk)
_insert_callbacks(names, blk) do |name, options| # _insert_callbacks(names, blk) do |name, options|
options[:if] = (Array.wrap(options[:if]) << "!halted") if #{filter == :after} # options[:if] = (Array.wrap(options[:if]) << "!halted") if false
set_callback(:process_action, :#{filter}, name, options.merge(:prepend => true)) # set_callback(:process_action, :before, name, options.merge(:prepend => true))
end # end
end # end
def prepend_#{filter}_filter(*names, &blk)
_insert_callbacks(names, blk) do |name, options|
options[:if] = (Array.wrap(options[:if]) << "!halted") if #{filter == :after}
set_callback(:process_action, :#{filter}, name, options.merge(:prepend => true))
end
end
# Skip a before, after or around filter. See _insert_callbacks
# for details on the allowed parameters.
def skip_#{filter}_filter(*names, &blk) # def skip_before_filter(*names, &blk)
_insert_callbacks(names, blk) do |name, options| # _insert_callbacks(names, blk) do |name, options|
skip_callback(:process_action, :#{filter}, name, options) # skip_callback(:process_action, :before, name, options)
end # end
end # end
def skip_#{filter}_filter(*names, &blk)
_insert_callbacks(names, blk) do |name, options|
skip_callback(:process_action, :#{filter}, name, options)
end
end
# *_filter is the same as append_*_filter
alias_method :append_#{filter}_filter, :#{filter}_filter # alias_method :append_before_filter, :before_filter
alias_method :append_#{filter}_filter, :#{filter}_filter
RUBY_EVAL
end
end

View File

@@ -67,7 +67,7 @@ module AbstractController
# helper FooHelper # => includes FooHelper
#
# When the argument is a string or symbol, the method will provide the "_helper" suffix, require the file
# and include the module in the template class. The second form illustrates how to include custom helpers
# and include the module in the template class. The second form illustrates how to include custom helpers
# when working with namespaced controllers, or other cases where the file containing the helper definition is not
# in one of Rails' standard load paths:
# helper :foo # => requires 'foo_helper' and includes FooHelper

View File

@@ -66,40 +66,27 @@ module AbstractController
# == Inheritance Examples
#
# class BankController < ActionController::Base
# # bank.html.erb exists
#
# class ExchangeController < BankController
# # exchange.html.erb exists
#
# class CurrencyController < BankController
# layout "bank_standard"
#
# class InformationController < BankController
# layout "information"
#
# class TellerController < InformationController
# class TellerController < BankController
# # teller.html.erb exists
#
# class EmployeeController < InformationController
# # employee.html.erb exists
# layout nil
# class TillController < TellerController
#
# class VaultController < BankController
# layout :access_level_layout
#
# class TillController < BankController
# layout false
# class EmployeeController < BankController
# layout nil
#
# In these examples, we have three implicit lookup scenrios:
# * The BankController uses the "bank" layout.
# * The ExchangeController uses the "exchange" layout.
# * The CurrencyController inherits the layout from BankController.
#
# However, when a layout is explicitly set, the explicitly set layout wins:
# * The InformationController uses the "information" layout, explicitly set.
# * The TellerController also uses the "information" layout, because the parent explicitly set it.
# * The EmployeeController uses the "employee" layout, because it set the layout to nil, resetting the parent configuration.
# In these examples:
# * The InformationController uses the "bank_standard" layout, inherited from BankController.
# * The TellerController follows convention and uses +app/views/layouts/teller.html.erb+.
# * The TillController inherits the layout from TellerController and uses +teller.html.erb+ as well.
# * The VaultController chooses a layout dynamically by calling the <tt>access_level_layout</tt> method.
# * The TillController does not use a layout at all.
# * The EmployeeController does not use a layout at all.
#
# == Types of layouts
#
@@ -139,22 +126,6 @@ module AbstractController
# If no directory is specified for the template name, the template will by default be looked for in <tt>app/views/layouts/</tt>.
# Otherwise, it will be looked up relative to the template root.
#
# Setting the layout to nil forces it to be looked up in the filesystem and fallbacks to the parent behavior if none exists.
# Setting it to nil is useful to re-enable template lookup overriding a previous configuration set in the parent:
#
# class ApplicationController < ActionController::Base
# layout "application"
# end
#
# class PostsController < ApplicationController
# # Will use "application" layout
# end
#
# class CommentsController < ApplicationController
# # Will search for "comments" layout and fallback "application" layout
# layout nil
# end
#
# == Conditional layouts
#
# If you have a layout that by default is applied to all the actions of a controller, you still have the option of rendering
@@ -197,12 +168,11 @@ module AbstractController
included do
class_attribute :_layout_conditions
remove_possible_method :_layout_conditions
delegate :_layout_conditions, :to => :'self.class'
self._layout_conditions = {}
_write_layout_method
end
delegate :_layout_conditions, :to => "self.class"
module ClassMethods
def inherited(klass)
super
@@ -218,7 +188,7 @@ module AbstractController
#
# ==== Returns
# * <tt> Boolean</tt> - True if the action has a layout, false otherwise.
def conditional_layout?
def action_has_layout?
return unless super
conditions = _layout_conditions
@@ -237,10 +207,10 @@ module AbstractController
#
# If the specified layout is a:
# String:: the String is the template name
# Symbol:: call the method specified by the symbol, which will return the template name
# Symbol:: call the method specified by the symbol, which will return
# the template name
# false:: There is no layout
# true:: raise an ArgumentError
# nil:: Force default layout behavior with inheritance
#
# ==== Parameters
# * <tt>layout</tt> - The layout to use.
@@ -254,7 +224,7 @@ module AbstractController
conditions.each {|k, v| conditions[k] = Array(v).map {|a| a.to_s} }
self._layout_conditions = conditions
@_layout = layout
@_layout = layout || false # Converts nil to false
_write_layout_method
end
@@ -274,71 +244,43 @@ module AbstractController
def _write_layout_method
remove_possible_method(:_layout)
prefixes = _implied_layout_name =~ /\blayouts/ ? [] : ["layouts"]
name_clause = if name
<<-RUBY
lookup_context.find_all("#{_implied_layout_name}", #{prefixes.inspect}).first || super
RUBY
end
if defined?(@_layout)
layout_definition = case @_layout
when String
@_layout.inspect
when Symbol
<<-RUBY
#{@_layout}.tap do |layout|
unless layout.is_a?(String) || !layout
raise ArgumentError, "Your layout method :#{@_layout} returned \#{layout}. It " \
"should have returned a String, false, or nil"
end
case defined?(@_layout) ? @_layout : nil
when String
self.class_eval %{def _layout; #{@_layout.inspect} end}, __FILE__, __LINE__
when Symbol
self.class_eval <<-ruby_eval, __FILE__, __LINE__ + 1
def _layout
#{@_layout}.tap do |layout|
unless layout.is_a?(String) || !layout
raise ArgumentError, "Your layout method :#{@_layout} returned \#{layout}. It " \
"should have returned a String, false, or nil"
end
RUBY
when Proc
define_method :_layout_from_proc, &@_layout
"_layout_from_proc(self)"
when false
nil
when true
raise ArgumentError, "Layouts must be specified as a String, Symbol, false, or nil"
when nil
name_clause
end
end
else
# Add a deprecation if the parent layout was explicitly set and the child
# still does a dynamic lookup. In next Rails release, we should @_layout
# to be inheritable so we can skip the child lookup if the parent explicitly
# set the layout.
parent = self.superclass.instance_eval { @_layout if defined?(@_layout) }
@_layout = nil
inspect = parent.is_a?(Proc) ? parent.inspect : parent
ruby_eval
when Proc
define_method :_layout_from_proc, &@_layout
self.class_eval %{def _layout; _layout_from_proc(self) end}, __FILE__, __LINE__
when false
self.class_eval %{def _layout; end}, __FILE__, __LINE__
when true
raise ArgumentError, "Layouts must be specified as a String, Symbol, false, or nil"
when nil
if name
_prefixes = _implied_layout_name =~ /\blayouts/ ? [] : ["layouts"]
layout_definition = if parent.nil?
name_clause
elsif name
<<-RUBY
if template = lookup_context.find_all("#{_implied_layout_name}", #{prefixes.inspect}).first
ActiveSupport::Deprecation.warn 'Layout found at "#{_implied_layout_name}" for #{name} but parent controller ' \
'set layout to #{inspect.inspect}. Please explicitly set your layout to "#{_implied_layout_name}" ' \
'or set it to nil to force a dynamic lookup.'
template
self.class_eval <<-RUBY, __FILE__, __LINE__ + 1
def _layout
if template_exists?("#{_implied_layout_name}", #{_prefixes.inspect})
"#{_implied_layout_name}"
else
super
end
RUBY
end
end
self.class_eval <<-RUBY, __FILE__, __LINE__ + 1
def _layout
if conditional_layout?
#{layout_definition}
else
#{name_clause}
end
end
RUBY
end
private :_layout
RUBY
end
self.class_eval { private :_layout }
end
end
@@ -347,7 +289,8 @@ module AbstractController
if _include_layout?(options)
layout = options.key?(:layout) ? options.delete(:layout) : :default
options[:layout] = _layout_for_option(layout)
value = _layout_for_option(layout)
options[:layout] = (value =~ /\blayouts/ ? value : "layouts/#{value}") if value
end
end
@@ -362,10 +305,6 @@ module AbstractController
@_action_has_layout
end
def conditional_layout?
true
end
private
# This will be overwritten by _write_layout_method
@@ -377,10 +316,9 @@ module AbstractController
# * <tt>name</tt> - The name of the template
def _layout_for_option(name)
case name
when String then _normalize_layout(name)
when Proc then name
when true then Proc.new { _default_layout(true) }
when :default then Proc.new { _default_layout(false) }
when String then name
when true then _default_layout(true)
when :default then _default_layout(false)
when false, nil then nil
else
raise ArgumentError,
@@ -388,10 +326,6 @@ module AbstractController
end
end
def _normalize_layout(value)
value.is_a?(String) && value !~ /\blayouts/ ? "layouts/#{value}" : value
end
# Returns the default layout for this controller.
# Optionally raises an exception if the layout could not be found.
#
@@ -403,17 +337,17 @@ module AbstractController
# * <tt>template</tt> - The template object for the default layout (or nil)
def _default_layout(require_layout = false)
begin
value = _layout if action_has_layout?
layout_name = _layout if action_has_layout?
rescue NameError => e
raise e, "Could not render layout: #{e.message}"
end
if require_layout && action_has_layout? && !value
if require_layout && action_has_layout? && !layout_name
raise ArgumentError,
"There was no default layout for #{self.class} in #{view_paths.inspect}"
end
_normalize_layout(value)
layout_name
end
def _include_layout?(options)

View File

@@ -7,7 +7,7 @@ module AbstractController
included do
config_accessor :logger
include ActiveSupport::Benchmarkable
extend ActiveSupport::Benchmarkable
end
end
end

View File

@@ -5,8 +5,8 @@ module AbstractController
Module.new do
define_method(:inherited) do |klass|
super(klass)
if namespace = klass.parents.detect { |m| m.respond_to?(:railtie_routes_url_helpers) }
klass.send(:include, namespace.railtie_routes_url_helpers)
if namespace = klass.parents.detect {|m| m.respond_to?(:_railtie) }
klass.send(:include, namespace._railtie.routes.url_helpers)
else
klass.send(:include, routes.url_helpers)
end

View File

@@ -35,7 +35,7 @@ module AbstractController
include AbstractController::ViewPaths
included do
class_attribute :protected_instance_variables
config_accessor :protected_instance_variables, :instance_reader => false
self.protected_instance_variables = []
end
@@ -59,8 +59,19 @@ module AbstractController
attr_internal_writer :view_context_class
# Explicitly define protected_instance_variables so it can be
# inherited and overwritten by other modules if needed.
def protected_instance_variables
config.protected_instance_variables
end
def view_context_class
@_view_context_class ||= self.class.view_context_class
@_view_context_class || self.class.view_context_class
end
def initialize(*)
@_view_context_class = nil
super
end
# An instance of a view class. The default view class is ActionView::Base
@@ -106,7 +117,6 @@ module AbstractController
# Find and renders a template based on the options given.
# :api: private
def _render_template(options) #:nodoc:
lookup_context.rendered_format = nil if options[:formats]
view_renderer.render(view_context, options)
end

View File

@@ -1,5 +1,3 @@
require 'action_view/base'
module AbstractController
module ViewPaths
extend ActiveSupport::Concern
@@ -10,7 +8,7 @@ module AbstractController
self._view_paths.freeze
end
delegate :template_exists?, :view_paths, :formats, :formats=,
delegate :find_template, :template_exists?, :view_paths, :formats, :formats=,
:locale, :locale=, :to => :lookup_context
module ClassMethods
@@ -65,7 +63,7 @@ module AbstractController
# the default view path. You may also provide a custom view path
# (see ActionView::PathSet for more information)
def append_view_path(path)
self._view_paths = view_paths + Array(path)
self.view_paths = view_paths.dup + Array(path)
end
# Prepend a path to the list of view paths for this controller.
@@ -75,7 +73,7 @@ module AbstractController
# the default view path. You may also provide a custom view path
# (see ActionView::PathSet for more information)
def prepend_view_path(path)
self._view_paths = ActionView::PathSet.new(Array(path) + view_paths)
self.view_paths = Array(path) + view_paths.dup
end
# A list of all of the default view paths for this controller.
@@ -89,7 +87,8 @@ module AbstractController
# * <tt>paths</tt> - If a PathSet is provided, use that;
# otherwise, process the parameter into a PathSet.
def view_paths=(paths)
self._view_paths = ActionView::PathSet.new(Array.wrap(paths))
self._view_paths = ActionView::Base.process_view_paths(paths)
self._view_paths.freeze
end
end
end

View File

@@ -47,6 +47,21 @@ module ActionController
eager_autoload do
autoload :RecordIdentifier
# TODO: Don't autoload exceptions, setup explicit
# requires for files that need them
autoload_at "action_controller/metal/exceptions" do
autoload :ActionControllerError
autoload :RenderError
autoload :RoutingError
autoload :MethodNotAllowed
autoload :NotImplemented
autoload :UnknownController
autoload :MissingFile
autoload :RenderError
autoload :SessionOverflowError
autoload :UnknownHttpMethod
end
end
end

View File

@@ -121,7 +121,7 @@ module ActionController
#
# def search
# @results = Search.find(params[:query])
# case @results.count
# case @results
# when 0 then render :action => "no_results"
# when 1 then render :action => "show"
# when 2..10 then render :action => "show_many"
@@ -192,6 +192,7 @@ module ActionController
Renderers::All,
ConditionalGet,
RackDelegation,
SessionManagement,
Caching,
MimeResponds,
ImplicitRender,

View File

@@ -24,6 +24,7 @@ module ActionController #:nodoc:
#
# config.action_controller.cache_store = :memory_store
# config.action_controller.cache_store = :file_store, "/path/to/cache/directory"
# config.action_controller.cache_store = :drb_store, "druby://localhost:9192"
# config.action_controller.cache_store = :mem_cache_store, "localhost"
# config.action_controller.cache_store = :mem_cache_store, Memcached::Rails.new("localhost:11211")
# config.action_controller.cache_store = MyOwnStore.new("parameter")
@@ -55,9 +56,6 @@ module ActionController #:nodoc:
end
end
include RackDelegation
include AbstractController::Callbacks
include ConfigMethods
include Pages, Actions, Fragments
include Sweeping if defined?(ActiveRecord)

View File

@@ -38,9 +38,9 @@ module ActionController #:nodoc:
# <tt>:action => 'lists'</tt> is not the same as
# <tt>:action => 'list', :format => :xml</tt>.
#
# You can modify the default action cache path by passing a
# <tt>:cache_path</tt> option. This will be passed directly to
# <tt>ActionCachePath.path_for</tt>. This is handy for actions with
# You can set modify the default action cache path by passing a
# <tt>:cache_path</tt> option. This will be passed directly to
# <tt>ActionCachePath.path_for</tt>. This is handy for actions with
# multiple possible routes that should be cached differently. If a
# block is given, it is called with the current controller instance.
#
@@ -102,10 +102,8 @@ module ActionController #:nodoc:
end
def _save_fragment(name, options)
content = ""
response_body.each do |parts|
content << parts
end
content = response_body
content = content.join if content.is_a?(Array)
if caching_allowed?
write_fragment(name, content, options)
@@ -118,8 +116,9 @@ module ActionController #:nodoc:
def expire_action(options = {})
return unless cache_configured?
if options.is_a?(Hash) && options[:action].is_a?(Array)
options[:action].each {|action| expire_action(options.merge(:action => action)) }
actions = options[:action]
if actions.is_a?(Array)
actions.each {|action| expire_action(options.merge(:action => action)) }
else
expire_fragment(ActionCachePath.new(self, options, false).path)
end

View File

@@ -12,13 +12,13 @@ module ActionController #:nodoc:
#
# <% cache do %>
# All the topics in the system:
# <%= render :partial => "topic", :collection => Topic.all %>
# <%= render :partial => "topic", :collection => Topic.find(:all) %>
# <% end %>
#
# This cache will bind the name of the action that called it, so if
# this code was part of the view for the topics/list action, you
# would be able to invalidate it using:
#
#
# expire_fragment(:controller => "topics", :action => "list")
#
# This default behavior is limited if you need to cache multiple
@@ -109,6 +109,7 @@ module ActionController #:nodoc:
def expire_fragment(key, options = nil)
return unless cache_configured?
key = fragment_cache_key(key) unless key.is_a?(Regexp)
message = nil
instrument_fragment_cache :expire_fragment, key do
if key.is_a?(Regexp)

View File

@@ -16,10 +16,9 @@ module ActionController #:nodoc:
# caches_page :show, :new
# end
#
# This will generate cache files such as <tt>weblog/show/5.html</tt> and <tt>weblog/new.html</tt>, which match the URLs used
# that would normally trigger dynamic page generation. Page caching works by configuring a web server to first check for the
# existence of files on disk, and to serve them directly when found, without passing the request through to Action Pack.
# This is much faster than handling the full dynamic request in the usual way.
# This will generate cache files such as <tt>weblog/show/5.html</tt> and <tt>weblog/new.html</tt>,
# which match the URLs used to trigger the dynamic generation. This is how the web server is able
# pick up a cache file when it exists and otherwise let the request pass on to Action Pack to generate it.
#
# Expiration of the cache is handled by deleting the cached file, which results in a lazy regeneration approach where the cache
# is not restored before another hit is made against it. The API for doing so mimics the options from +url_for+ and friends:
@@ -38,25 +37,23 @@ module ActionController #:nodoc:
extend ActiveSupport::Concern
included do
##
# :singleton-method:
# The cache directory should be the document root for the web server and is set using <tt>Base.page_cache_directory = "/document/root"</tt>.
# For Rails, this directory has already been set to Rails.public_path (which is usually set to <tt>Rails.root + "/public"</tt>). Changing
# this setting can be useful to avoid naming conflicts with files in <tt>public/</tt>, but doing so will likely require configuring your
# web server to look in the new location for cached files.
class_attribute :page_cache_directory
config_accessor :page_cache_directory
self.page_cache_directory ||= ''
##
# :singleton-method:
# Most Rails requests do not have an extension, such as <tt>/weblog/new</tt>. In these cases, the page caching mechanism will add one in
# order to make it easy for the cached files to be picked up properly by the web server. By default, this cache extension is <tt>.html</tt>.
# If you want something else, like <tt>.php</tt> or <tt>.shtml</tt>, just set Base.page_cache_extension. In cases where a request already has an
# extension, such as <tt>.xml</tt> or <tt>.rss</tt>, page caching will not add an extension. This allows it to work well with RESTful apps.
class_attribute :page_cache_extension
config_accessor :page_cache_extension
self.page_cache_extension ||= '.html'
# The compression used for gzip. If false (default), the page is not compressed.
# If can be a symbol showing the ZLib compression method, for example, :best_compression
# or :best_speed or an integer configuring the compression level.
class_attribute :page_cache_compression
self.page_cache_compression ||= false
end
module ClassMethods
@@ -68,31 +65,24 @@ module ActionController #:nodoc:
instrument_page_cache :expire_page, path do
File.delete(path) if File.exist?(path)
File.delete(path + '.gz') if File.exist?(path + '.gz')
end
end
# Manually cache the +content+ in the key determined by +path+. Example:
# cache_page "I'm the cached content", "/lists/show"
def cache_page(content, path, extension = nil, gzip = Zlib::BEST_COMPRESSION)
def cache_page(content, path, extension = nil)
return unless perform_caching
path = page_cache_path(path, extension)
instrument_page_cache :write_page, path do
FileUtils.makedirs(File.dirname(path))
File.open(path, "wb+") { |f| f.write(content) }
if gzip
Zlib::GzipWriter.open(path + '.gz', gzip) { |f| f.write(content) }
end
end
end
# Caches the +actions+ using the page-caching approach that'll store
# the cache in a path within the page_cache_directory that
# Caches the +actions+ using the page-caching approach that'll store the cache in a path within the page_cache_directory that
# matches the triggering url.
#
# You can also pass a :gzip option to override the class configuration one.
#
# Usage:
#
# # cache the index action
@@ -100,28 +90,10 @@ module ActionController #:nodoc:
#
# # cache the index action except for JSON requests
# caches_page :index, :if => Proc.new { |c| !c.request.format.json? }
#
# # don't gzip images
# caches_page :image, :gzip => false
def caches_page(*actions)
return unless perform_caching
options = actions.extract_options!
gzip_level = options.fetch(:gzip, page_cache_compression)
gzip_level = case gzip_level
when Symbol
Zlib.const_get(gzip_level.to_s.upcase)
when Fixnum
gzip_level
when false
nil
else
Zlib::BEST_COMPRESSION
end
after_filter({:only => actions}.merge(options)) do |c|
c.cache_page(nil, nil, gzip_level)
end
after_filter({:only => actions}.merge(options)) { |c| c.cache_page }
end
private
@@ -149,7 +121,7 @@ module ActionController #:nodoc:
if options.is_a?(Hash)
if options[:action].is_a?(Array)
options[:action].each do |action|
options[:action].dup.each do |action|
self.class.expire_page(url_for(options.merge(:only_path => true, :action => action)))
end
else
@@ -160,10 +132,10 @@ module ActionController #:nodoc:
end
end
# Manually cache the +content+ in the key determined by +options+. If no content is provided, the contents of response.body is used.
# If no options are provided, the url of the current request being handled is used. Example:
# Manually cache the +content+ in the key determined by +options+. If no content is provided, the contents of response.body is used
# If no options are provided, the requested url is used. Example:
# cache_page "I'm the cached content", :controller => "lists", :action => "show"
def cache_page(content = nil, options = nil, gzip = Zlib::BEST_COMPRESSION)
def cache_page(content = nil, options = nil)
return unless self.class.perform_caching && caching_allowed?
path = case options
@@ -179,7 +151,7 @@ module ActionController #:nodoc:
extension = ".#{type_symbol}"
end
self.class.cache_page(content || response.body, path, extension, gzip)
self.class.cache_page(content || response.body, path, extension)
end
end

View File

@@ -88,7 +88,7 @@ module ActionController #:nodoc:
end
def method_missing(method, *arguments, &block)
return unless @controller
return if @controller.nil?
@controller.__send__(method, *arguments, &block)
end
end

View File

@@ -10,7 +10,7 @@ module ActionController
format = payload[:format]
format = format.to_s.upcase if format.is_a?(Symbol)
info "Processing by #{payload[:controller]}##{payload[:action]} as #{format}"
info " Processing by #{payload[:controller]}##{payload[:action]} as #{format}"
info " Parameters: #{params.inspect}" unless params.empty?
end
@@ -20,21 +20,18 @@ module ActionController
status = payload[:status]
if status.nil? && payload[:exception].present?
exception_class_name = payload[:exception].first
status = ActionDispatch::ExceptionWrapper.status_code_for_exception(exception_class_name)
end
message = "Completed #{status} #{Rack::Utils::HTTP_STATUS_CODES[status]} in #{format_duration(event.duration)}"
status = Rack::Utils.status_code(ActionDispatch::ShowExceptions.rescue_responses[payload[:exception].first]) rescue nil
end
message = "Completed #{status} #{Rack::Utils::HTTP_STATUS_CODES[status]} in %.0fms" % event.duration
message << " (#{additions.join(" | ")})" unless additions.blank?
info(message)
end
def halted_callback(event)
info "Filter chain halted as #{event.payload[:filter]} rendered or redirected"
end
def send_file(event)
info("Sent file #{event.payload[:path]} (#{format_duration(event.duration)})")
message = "Sent file %s"
message << " (%.1fms)"
info(message % [event.payload[:path], event.duration])
end
def redirect_to(event)
@@ -42,7 +39,7 @@ module ActionController
end
def send_data(event)
info("Sent data #{event.payload[:filename]} (#{format_duration(event.duration)})")
info("Sent data %s (%.1fms)" % [event.payload[:filename], event.duration])
end
%w(write_fragment read_fragment exist_fragment?
@@ -51,8 +48,7 @@ module ActionController
def #{method}(event)
key_or_path = event.payload[:key] || event.payload[:path]
human_name = #{method.to_s.humanize.inspect}
duration = format_duration(event.duration)
info("\#{human_name} \#{key_or_path} \#{duration}")
info("\#{human_name} \#{key_or_path} \#{"(%.1fms)" % event.duration}")
end
METHOD
end
@@ -63,4 +59,4 @@ module ActionController
end
end
ActionController::LogSubscriber.attach_to :action_controller
ActionController::LogSubscriber.attach_to :action_controller

View File

@@ -182,20 +182,10 @@ module ActionController
end
def response_body=(val)
body = if val.is_a?(String)
[val]
elsif val.nil? || val.respond_to?(:each)
val
else
[val]
end
body = val.nil? ? nil : (val.respond_to?(:each) ? val : [val])
super body
end
def performed?
response_body
end
def dispatch(name, request) #:nodoc:
@_request = request
@_env = request.env

View File

@@ -1,22 +1,21 @@
require 'active_support/deprecation'
module ActionController
module Compatibility
extend ActiveSupport::Concern
class ::ActionController::ActionControllerError < StandardError #:nodoc:
end
# Temporary hax
included do
::ActionController::UnknownAction = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('ActionController::UnknownAction', '::AbstractController::ActionNotFound')
::ActionController::DoubleRenderError = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('ActionController::DoubleRenderError', '::AbstractController::DoubleRenderError')
::ActionController::UnknownAction = ::AbstractController::ActionNotFound
::ActionController::DoubleRenderError = ::AbstractController::DoubleRenderError
# ROUTES TODO: This should be handled by a middleware and route generation
# should be able to handle SCRIPT_NAME
self.config.relative_url_root = ENV['RAILS_RELATIVE_URL_ROOT']
def self.default_charset=(new_charset)
ActiveSupport::Deprecation.warn "Setting default charset at controller level" \
" is deprecated, please use `config.action_dispatch.default_charset` instead", caller
ActionDispatch::Response.default_charset = new_charset
class << self
delegate :default_charset=, :to => "ActionDispatch::Response"
end
self.protected_instance_variables = %w(
@@ -25,19 +24,13 @@ module ActionController
)
def rescue_action(env)
ActiveSupport::Deprecation.warn "Calling `rescue_action` is deprecated and will be removed in Rails 4.0.", caller
raise env["action_dispatch.rescue.exception"]
end
end
# For old tests
def initialize_template_class(*)
ActiveSupport::Deprecation.warn "Calling `initialize_template_class` is deprecated and has no effect anymore.", caller
end
def assign_shortcuts(*)
ActiveSupport::Deprecation.warn "Calling `assign_shortcuts` is deprecated and has no effect anymore.", caller
end
def initialize_template_class(*) end
def assign_shortcuts(*) end
def _normalize_options(options)
options[:text] = nil if options.delete(:nothing) == true
@@ -51,15 +44,15 @@ module ActionController
end
def _handle_method_missing
ActiveSupport::Deprecation.warn "Using `method_missing` to handle non" \
" existing actions is deprecated and will be removed in Rails 4.0, " \
" please use `action_missing` instead.", caller
method_missing(@_action_name.to_sym)
end
def method_for_action(action_name)
super || ((self.class.public_method_defined?(:method_missing) ||
self.class.protected_method_defined?(:method_missing)) && "_handle_method_missing")
super || (respond_to?(:method_missing) && "_handle_method_missing")
end
def performed?
response_body
end
end
end

View File

@@ -23,27 +23,8 @@ module ActionController
# This will render the show template if the request isn't sending a matching etag or
# If-Modified-Since header and just a <tt>304 Not Modified</tt> response if there's a match.
#
# You can also just pass a record where last_modified will be set by calling updated_at and the etag by passing the object itself. Example:
#
# def show
# @article = Article.find(params[:id])
# fresh_when(@article)
# end
#
# When passing a record, you can still set whether the public header:
#
# def show
# @article = Article.find(params[:id])
# fresh_when(@article, :public => true)
# end
def fresh_when(record_or_options, additional_options = {})
if record_or_options.is_a? Hash
options = record_or_options
options.assert_valid_keys(:etag, :last_modified, :public)
else
record = record_or_options
options = { :etag => record, :last_modified => record.try(:updated_at) }.merge(additional_options)
end
def fresh_when(options)
options.assert_valid_keys(:etag, :last_modified, :public)
response.etag = options[:etag] if options[:etag]
response.last_modified = options[:last_modified] if options[:last_modified]
@@ -74,34 +55,8 @@ module ActionController
# end
# end
# end
#
# You can also just pass a record where last_modified will be set by calling updated_at and the etag by passing the object itself. Example:
#
# def show
# @article = Article.find(params[:id])
#
# if stale?(@article)
# @statistics = @article.really_expensive_call
# respond_to do |format|
# # all the supported formats
# end
# end
# end
#
# When passing a record, you can still set whether the public header:
#
# def show
# @article = Article.find(params[:id])
#
# if stale?(@article, :public => true)
# @statistics = @article.really_expensive_call
# respond_to do |format|
# # all the supported formats
# end
# end
# end
def stale?(record_or_options, additional_options = {})
fresh_when(record_or_options, additional_options)
def stale?(options)
fresh_when(options)
!request.fresh?(response)
end

View File

@@ -1,5 +1,4 @@
require 'active_support/core_ext/file/path'
require 'action_controller/metal/exceptions'
module ActionController #:nodoc:
# Methods for sending arbitrary data and for streaming files to the browser,
@@ -27,11 +26,8 @@ module ActionController #:nodoc:
# Options:
# * <tt>:filename</tt> - suggests a filename for the browser to use.
# Defaults to <tt>File.basename(path)</tt>.
# * <tt>:type</tt> - specifies an HTTP content type.
# You can specify either a string or a symbol for a registered type register with
# <tt>Mime::Type.register</tt>, for example :json
# If omitted, type will be guessed from the file extension specified in <tt>:filename</tt>.
# If no content type is registered for the extension, default type 'application/octet-stream' will be used.
# * <tt>:type</tt> - specifies an HTTP content type. Defaults to 'application/octet-stream'. You can specify
# either a string or a symbol for a registered type register with <tt>Mime::Type.register</tt>, for example :json
# * <tt>:disposition</tt> - specifies whether the file will be shown inline or downloaded.
# Valid values are 'inline' and 'attachment' (default).
# * <tt>:status</tt> - specifies the status code to send with the response. Defaults to 200.
@@ -41,7 +37,7 @@ module ActionController #:nodoc:
#
# The default Content-Type and Content-Disposition headers are
# set to download arbitrary binary files in as many browsers as
# possible. IE versions 4, 5, 5.5, and 6 are all known to have
# possible. IE versions 4, 5, 5.5, and 6 are all known to have
# a variety of quirks (especially when downloading over SSL).
#
# Simple download:
@@ -62,8 +58,8 @@ module ActionController #:nodoc:
#
# Also be aware that the document may be cached by proxies and browsers.
# The Pragma and Cache-Control headers declare how the file may be cached
# by intermediaries. They default to require clients to validate with
# the server before releasing cached responses. See
# by intermediaries. They default to require clients to validate with
# the server before releasing cached responses. See
# http://www.mnot.net/cache_docs/ for an overview of web caching and
# http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9
# for the Cache-Control header spec.
@@ -75,27 +71,7 @@ module ActionController #:nodoc:
self.status = options[:status] || 200
self.content_type = options[:content_type] if options.key?(:content_type)
self.response_body = FileBody.new(path)
end
# Avoid having to pass an open file handle as the response body.
# Rack::Sendfile will usually intercept the response and uses
# the path directly, so there is no reason to open the file.
class FileBody #:nodoc:
attr_reader :to_path
def initialize(path)
@to_path = path
end
# Stream the file's contents if Rack::Sendfile isn't present.
def each
File.open(to_path, 'rb') do |file|
while chunk = file.read(16384)
yield chunk
end
end
end
self.response_body = File.open(path, "rb")
end
# Sends the given binary data to the browser. This method is similar to
@@ -108,8 +84,6 @@ module ActionController #:nodoc:
# * <tt>:filename</tt> - suggests a filename for the browser to use.
# * <tt>:type</tt> - specifies an HTTP content type. Defaults to 'application/octet-stream'. You can specify
# either a string or a symbol for a registered type register with <tt>Mime::Type.register</tt>, for example :json
# If omitted, type will be guessed from the file extension specified in <tt>:filename</tt>.
# If no content type is registered for the extension, default type 'application/octet-stream' will be used.
# * <tt>:disposition</tt> - specifies whether the file will be shown inline or downloaded.
# Valid values are 'inline' and 'attachment' (default).
# * <tt>:status</tt> - specifies the status code to send with the response. Defaults to 200.
@@ -134,14 +108,12 @@ module ActionController #:nodoc:
private
def send_file_headers!(options)
type_provided = options.has_key?(:type)
options.update(DEFAULT_SEND_FILE_OPTIONS.merge(options))
[:type, :disposition].each do |arg|
raise ArgumentError, ":#{arg} option required" if options[arg].nil?
end
disposition = options[:disposition].to_s
disposition = options[:disposition]
disposition += %(; filename="#{options[:filename]}") if options[:filename]
content_type = options[:type]
@@ -151,10 +123,6 @@ module ActionController #:nodoc:
raise ArgumentError, "Unknown MIME type #{options[:type]}" unless extension
self.content_type = extension
else
if !type_provided && options[:filename]
# If type wasn't provided, try guessing from file extension.
content_type = Mime::Type.lookup_by_extension(File.extname(options[:filename]).downcase.tr('.','')) || content_type
end
self.content_type = content_type
end

View File

@@ -1,12 +1,12 @@
module ActionController
# This module provides a method which will redirect browser to use HTTPS
# This module provides a method which will redirects browser to use HTTPS
# protocol. This will ensure that user's sensitive information will be
# transferred safely over the internet. You _should_ always force browser
# to use HTTPS when you're transferring sensitive information such as
# user authentication, account information, or credit card information.
#
# Note that if you are really concerned about your application security,
# you might consider using +config.force_ssl+ in your config file instead.
# Note that if you really concern about your application safety, you might
# consider using +config.force_ssl+ in your configuration config file instead.
# That will ensure all the data transferred via HTTPS protocol and prevent
# user from getting session hijacked when accessing the site under unsecured
# HTTP protocol.
@@ -22,18 +22,14 @@ module ActionController
#
# ==== Options
# * <tt>only</tt> - The callback should be run only for this action
# * <tt>except</tt> - The callback should be run for all actions except this action
# * <tt>except<tt> - The callback should be run for all actions except this action
def force_ssl(options = {})
host = options.delete(:host)
before_filter(options) do
if !request.ssl? && !Rails.env.development?
redirect_options = {:protocol => 'https://', :status => :moved_permanently}
redirect_options.merge!(:host => host) if host
redirect_options.merge!(:params => request.query_parameters)
redirect_to redirect_options
redirect_to :protocol => 'https://', :status => :moved_permanently
end
end
end
end
end
end
end

View File

@@ -20,7 +20,6 @@ module ActionController
options, status = status, nil if status.is_a?(Hash)
status ||= options.delete(:status) || :ok
location = options.delete(:location)
content_type = options.delete(:content_type)
options.each do |key, value|
headers[key.to_s.dasherize.split('-').each { |v| v[0] = v[0].chr.upcase }.join('-')] = value.to_s
@@ -28,7 +27,7 @@ module ActionController
self.status = status
self.location = url_for(location) if location
self.content_type = content_type || (Mime[formats.first] if formats)
self.content_type = Mime[formats.first] if formats
self.response_body = " "
end
end

View File

@@ -7,12 +7,9 @@ module ActionController
# by default.
#
# In addition to using the standard template helpers provided, creating custom helpers to
# extract complicated logic or reusable functionality is strongly encouraged. By default, each controller
# will include all helpers.
#
# In previous versions of \Rails the controller will include a helper whose
# name matches that of the controller, e.g., <tt>MyController</tt> will automatically
# include <tt>MyHelper</tt>. To return old behavior set +config.action_controller.include_all_helpers+ to +false+.
# extract complicated logic or reusable functionality is strongly encouraged. By default, the controller will
# include a helper whose name matches that of the controller, e.g., <tt>MyController</tt> will automatically
# include <tt>MyHelper</tt>.
#
# Additional helpers can be specified using the +helper+ class method in ActionController::Base or any
# controller which inherits from it.
@@ -32,7 +29,7 @@ module ActionController
# class EventsController < ActionController::Base
# helper FormattedTimeHelper
# def index
# @events = Event.all
# @events = Event.find(:all)
# end
# end
#
@@ -56,7 +53,7 @@ module ActionController
include AbstractController::Helpers
included do
class_attribute :helpers_path, :include_all_helpers
config_accessor :helpers_path, :include_all_helpers
self.helpers_path ||= []
self.include_all_helpers = true
end

View File

@@ -27,14 +27,20 @@ module ActionController
self.hidden_actions = hidden_actions.dup.merge(args.map(&:to_s)).freeze
end
def inherited(klass)
klass.class_eval { @visible_actions = {} }
super
end
def visible_action?(action_name)
not hidden_actions.include?(action_name)
return @visible_actions[action_name] if @visible_actions.key?(action_name)
@visible_actions[action_name] = !hidden_actions.include?(action_name)
end
# Overrides AbstractController::Base#action_methods to remove any methods
# that are listed as hidden methods.
def action_methods
@action_methods ||= Set.new(super.reject { |name| hidden_actions.include?(name) }).freeze
@action_methods ||= Set.new(super.reject { |name| hidden_actions.include?(name) })
end
end
end

View File

@@ -67,7 +67,7 @@ module ActionController
# class PostsController < ApplicationController
# REALM = "SuperSecret"
# USERS = {"dhh" => "secret", #plain text password
# "dap" => Digest::MD5.hexdigest(["dap",REALM,"secret"].join(":"))} #ha1 digest password
# "dap" => Digest::MD5.hexdigest(["dap",REALM,"secret"].join(":")) #ha1 digest password
#
# before_filter :authenticate, :except => [:index]
#
@@ -141,11 +141,11 @@ module ActionController
end
def decode_credentials(request)
::Base64.decode64(request.authorization.split(' ', 2).last || '')
ActiveSupport::Base64.decode64(request.authorization.split(' ', 2).last || '')
end
def encode_credentials(user_name, password)
"Basic #{::Base64.strict_encode64("#{user_name}:#{password}")}"
"Basic #{ActiveSupport::Base64.encode64s("#{user_name}:#{password}")}"
end
def authentication_request(controller, realm)
@@ -289,7 +289,7 @@ module ActionController
t = time.to_i
hashed = [t, secret_key]
digest = ::Digest::MD5.hexdigest(hashed.join(":"))
::Base64.encode64("#{t}:#{digest}").gsub("\n", '')
ActiveSupport::Base64.encode64("#{t}:#{digest}").gsub("\n", '')
end
# Might want a shorter timeout depending on whether the request
@@ -298,7 +298,7 @@ module ActionController
# allow a user to use new nonce without prompting user again for their
# username and password.
def validate_nonce(secret_key, request, value, seconds_to_timeout=5*60)
t = ::Base64.decode64(value).split(":").first.to_i
t = ActiveSupport::Base64.decode64(value).split(":").first.to_i
nonce(secret_key, t) == value && (t - Time.now.to_i).abs <= seconds_to_timeout
end
@@ -403,7 +403,7 @@ module ActionController
# the present token and options.
#
# controller - ActionController::Base instance for the current request.
# login_procedure - Proc to call if a token is present. The Proc should
# login_procedure - Proc to call if a token is present. The Proc should
# take 2 arguments:
# authenticate(controller) { |token, options| ... }
#
@@ -416,7 +416,7 @@ module ActionController
end
end
# Parses the token and options out of the token authorization header. If
# Parses the token and options out of the token authorization header. If
# the header looks like this:
# Authorization: Token token="abc", nonce="def"
# Then the returned token is "abc", and the options is {:nonce => "def"}
@@ -426,7 +426,7 @@ module ActionController
# Returns an Array of [String, Hash] if a token is present.
# Returns nil if no token is found.
def token_and_options(request)
if request.authorization.to_s[/^Token (.*)/]
if header = request.authorization.to_s[/^Token (.*)/]
values = Hash[$1.split(',').map do |value|
value.strip! # remove any spaces between commas and values
key, value = value.split(/\=\"?/) # split key=value pairs

View File

@@ -58,18 +58,13 @@ module ActionController
def redirect_to(*args)
ActiveSupport::Notifications.instrument("redirect_to.action_controller") do |payload|
result = super
payload[:status] = response.status
payload[:location] = response.location
payload[:status] = self.status
payload[:location] = self.location
result
end
end
private
# A hook invoked everytime a before callback is halted.
def halted_callback_hook(filter)
ActiveSupport::Notifications.instrument("halted_callback.action_controller", :filter => filter)
end
protected
# A hook which allows you to clean up any time taken into account in
# views wrongly, like database querying time.
@@ -102,4 +97,4 @@ module ActionController
end
end
end
end
end

View File

@@ -42,8 +42,8 @@ module ActionController #:nodoc:
def respond_to(*mimes)
options = mimes.extract_options!
only_actions = Array(options.delete(:only)).map(&:to_s)
except_actions = Array(options.delete(:except)).map(&:to_s)
only_actions = Array(options.delete(:only))
except_actions = Array(options.delete(:except))
new = mimes_for_respond_to.dup
mimes.each do |mime|
@@ -182,7 +182,7 @@ module ActionController #:nodoc:
#
# def index
# @people = Person.all
# respond_with(@people)
# respond_with(@person)
# end
# end
#
@@ -191,9 +191,8 @@ module ActionController #:nodoc:
def respond_to(*mimes, &block)
raise ArgumentError, "respond_to takes either types or a block, never both" if mimes.any? && block_given?
if collector = retrieve_collector_from_mimes(mimes, &block)
response = collector.response
response ? response.call : default_render({})
if response = retrieve_response_from_mimes(mimes, &block)
response.call(nil)
end
end
@@ -233,9 +232,9 @@ module ActionController #:nodoc:
raise "In order to use respond_with, first you need to declare the formats your " <<
"controller responds to in the class level" if self.class.mimes_for_respond_to.empty?
if collector = retrieve_collector_from_mimes(&block)
if response = retrieve_response_from_mimes(&block)
options = resources.size == 1 ? {} : resources.extract_options!
options[:default_response] = collector.response
options.merge!(:default_response => response)
(options.delete(:responder) || self.class.responder).call(self, resources, options)
end
end
@@ -246,7 +245,7 @@ module ActionController #:nodoc:
# current action.
#
def collect_mimes_from_class_level #:nodoc:
action = action_name.to_s
action = action_name.to_sym
self.class.mimes_for_respond_to.keys.select do |mime|
config = self.class.mimes_for_respond_to[mime]
@@ -264,17 +263,15 @@ module ActionController #:nodoc:
# Collects mimes and return the response for the negotiated format. Returns
# nil if :not_acceptable was sent to the client.
#
def retrieve_collector_from_mimes(mimes=nil, &block) #:nodoc:
def retrieve_response_from_mimes(mimes=nil, &block) #:nodoc:
mimes ||= collect_mimes_from_class_level
collector = Collector.new(mimes)
collector = Collector.new(mimes) { |options| default_render(options || {}) }
block.call(collector) if block_given?
format = collector.negotiate_format(request)
if format
if format = request.negotiate_mime(collector.order)
self.content_type ||= format.to_s
lookup_context.formats = [format.to_sym]
lookup_context.rendered_format = lookup_context.formats.first
collector
lookup_context.freeze_formats([format.to_sym])
collector.response_for(format)
else
head :not_acceptable
nil
@@ -283,10 +280,10 @@ module ActionController #:nodoc:
class Collector #:nodoc:
include AbstractController::Collector
attr_accessor :order, :format
attr_accessor :order
def initialize(mimes)
@order, @responses = [], {}
def initialize(mimes, &block)
@order, @responses, @default_response = [], {}, block
mimes.each { |mime| send(mime) }
end
@@ -305,12 +302,8 @@ module ActionController #:nodoc:
@responses[mime_type] ||= block
end
def response
@responses[format] || @responses[Mime::ALL]
end
def negotiate_format(request)
@format = request.negotiate_mime(order)
def response_for(mime)
@responses[mime] || @responses[Mime::ALL] || @default_response
end
end
end

View File

@@ -43,11 +43,6 @@ module ActionController
# wrap_parameters :person, :include => [:username, :password]
# end
#
# On ActiveRecord models with no +:include+ or +:exclude+ option set,
# if attr_accessible is set on that model, it will only wrap the accessible
# parameters, else it will only wrap the parameters returned by the class
# method attribute_names.
#
# If you're going to pass the parameters to an +ActiveModel+ object (such as
# +User.new(params[:user])+), you might consider passing the model class to
# the method instead. The +ParamsWrapper+ will actually try to determine the
@@ -146,16 +141,19 @@ module ActionController
# try to find Foo::Bar::User, Foo::User and finally User.
def _default_wrap_model #:nodoc:
return nil if self.anonymous?
model_name = self.name.sub(/Controller$/, '').classify
model_name = self.name.sub(/Controller$/, '').singularize
begin
if model_klass = model_name.safe_constantize
model_klass
else
model_klass = model_name.constantize
rescue NameError, ArgumentError => e
if e.message =~ /is not missing constant|uninitialized constant #{model_name}/
namespaces = model_name.split("::")
namespaces.delete_at(-2)
break if namespaces.last == model_name
model_name = namespaces.join("::")
else
raise
end
end until model_klass
@@ -167,10 +165,7 @@ module ActionController
unless options[:include] || options[:exclude]
model ||= _default_wrap_model
role = options.has_key?(:as) ? options[:as] : :default
if model.respond_to?(:accessible_attributes) && model.accessible_attributes(role).present?
options[:include] = model.accessible_attributes(role).to_a
elsif model.respond_to?(:attribute_names) && model.attribute_names.present?
if model.respond_to?(:attribute_names) && model.attribute_names.present?
options[:include] = model.attribute_names
end
end
@@ -194,8 +189,7 @@ module ActionController
def process_action(*args)
if _wrapper_enabled?
wrapped_hash = _wrap_parameters request.request_parameters
wrapped_keys = request.request_parameters.keys
wrapped_filtered_hash = _wrap_parameters request.filtered_parameters.slice(*wrapped_keys)
wrapped_filtered_hash = _wrap_parameters request.filtered_parameters
# This will make the wrapped hash accessible from controller and view
request.parameters.merge! wrapped_hash

View File

@@ -18,7 +18,7 @@ module ActionController
#
# * <tt>Hash</tt> - The URL will be generated by calling url_for with the +options+.
# * <tt>Record</tt> - The URL will be generated by calling url_for with the +options+, which will reference a named URL for that record.
# * <tt>String</tt> starting with <tt>protocol://</tt> (like <tt>http://</tt>) or a protocol relative reference (like <tt>//</tt>) - Is passed straight through as the target for redirection.
# * <tt>String</tt> starting with <tt>protocol://</tt> (like <tt>http://</tt>) - Is passed straight through as the target for redirection.
# * <tt>String</tt> not containing a protocol - The current protocol and host is prepended to the string.
# * <tt>Proc</tt> - A block that will be executed in the controller's context. Should return any option accepted by +redirect_to+.
# * <tt>:back</tt> - Back to the page that issued the request. Useful for forms that are triggered from multiple places.
@@ -45,16 +45,6 @@ module ActionController
# integer, or a symbol representing the downcased, underscored and symbolized description.
# Note that the status code must be a 3xx HTTP code, or redirection will not occur.
#
# If you are using XHR requests other than GET or POST and redirecting after the
# request then some browsers will follow the redirect using the original request
# method. This may lead to undesirable behavior such as a double DELETE. To work
# around this you can return a <tt>303 See Other</tt> status code which will be
# followed using a GET request.
#
# Examples:
# redirect_to posts_url, :status => :see_other
# redirect_to :action => 'index', :status => 303
#
# It is also possible to assign a flash message as part of the redirection. There are two special accessors for the commonly used flash names
# +alert+ and +notice+ as well as a general purpose +flash+ bucket.
#
@@ -64,10 +54,10 @@ module ActionController
# redirect_to post_url(@post), :status => 301, :flash => { :updated_post_id => @post.id }
# redirect_to { :action=>'atom' }, :alert => "Something serious happened"
#
# When using <tt>redirect_to :back</tt>, if there is no referrer, ActionController::RedirectBackError will be raised. You may specify some fallback
# behavior for this case by rescuing ActionController::RedirectBackError.
# When using <tt>redirect_to :back</tt>, if there is no referrer, RedirectBackError will be raised. You may specify some fallback
# behavior for this case by rescuing RedirectBackError.
def redirect_to(options = {}, response_status = {}) #:doc:
raise ActionControllerError.new("Cannot redirect to nil!") unless options
raise ActionControllerError.new("Cannot redirect to nil!") if options.nil?
raise AbstractController::DoubleRenderError if response_body
self.status = _extract_redirect_to_status(options, response_status)
@@ -77,7 +67,7 @@ module ActionController
private
def _extract_redirect_to_status(options, response_status)
if options.is_a?(Hash) && options.key?(:status)
status = if options.is_a?(Hash) && options.key?(:status)
Rack::Utils.status_code(options.delete(:status))
elsif response_status.key?(:status)
Rack::Utils.status_code(response_status[:status])
@@ -91,8 +81,7 @@ module ActionController
# The scheme name consist of a letter followed by any combination of
# letters, digits, and the plus ("+"), period ("."), or hyphen ("-")
# characters; and is terminated by a colon (":").
# The protocol relative scheme starts with a double slash "//"
when %r{^(\w[\w+.-]*:|//).*}
when %r{^\w[\w+.-]*:.*}
options
when String
request.protocol + request.host_with_port + options

View File

@@ -1,6 +1,5 @@
require 'active_support/core_ext/class/attribute'
require 'active_support/core_ext/object/blank'
require 'set'
module ActionController
# See <tt>Renderers.add</tt>
@@ -13,13 +12,16 @@ module ActionController
included do
class_attribute :_renderers
self._renderers = Set.new.freeze
self._renderers = {}.freeze
end
module ClassMethods
def use_renderers(*args)
renderers = _renderers + args
self._renderers = renderers.freeze
new = _renderers.dup
args.each do |key|
new[key] = RENDERERS[key]
end
self._renderers = new.freeze
end
alias use_renderer use_renderers
end
@@ -29,10 +31,10 @@ module ActionController
end
def _handle_render_options(options)
_renderers.each do |name|
if options.key?(name)
_renderers.each do |name, value|
if options.key?(name.to_sym)
_process_options(options)
return send("_render_option_#{name}", options.delete(name), options)
return send("_render_option_#{name}", options.delete(name.to_sym), options)
end
end
nil
@@ -40,7 +42,7 @@ module ActionController
# Hash of available renderers, mapping a renderer name to its proc.
# Default keys are :json, :js, :xml.
RENDERERS = Set.new
RENDERERS = {}
# Adds a new renderer to call within controller actions.
# A renderer is invoked by passing its name as an option to
@@ -77,7 +79,7 @@ module ActionController
# <tt>ActionController::MimeResponds#respond_with</tt>
def self.add(key, &block)
define_method("_render_option_#{key}", &block)
RENDERERS << key.to_sym
RENDERERS[key] = block
end
module All

View File

@@ -14,7 +14,7 @@ module ActionController
def render(*args) #:nodoc:
raise ::AbstractController::DoubleRenderError if response_body
super
self.content_type ||= Mime[lookup_context.rendered_format].to_s
self.content_type ||= Mime[formats.first].to_s
response_body
end

View File

@@ -1,5 +1,4 @@
require 'active_support/core_ext/class/attribute'
require 'action_controller/metal/exceptions'
module ActionController #:nodoc:
class InvalidAuthenticityToken < ActionControllerError #:nodoc:
@@ -74,7 +73,7 @@ module ActionController #:nodoc:
# The actual before_filter that is used. Modify this to change how you handle unverified requests.
def verify_authenticity_token
unless verified_request?
logger.warn "WARNING: Can't verify CSRF token authenticity" if logger
logger.debug "WARNING: Can't verify CSRF token authenticity" if logger
handle_unverified_request
end
end

View File

@@ -1,7 +1,4 @@
module ActionController #:nodoc:
# This module is responsible to provide `rescue_from` helpers
# to controllers and configure when detailed exceptions must be
# shown.
module Rescue
extend ActiveSupport::Concern
include ActiveSupport::Rescuable
@@ -15,20 +12,10 @@ module ActionController #:nodoc:
super(exception)
end
# Override this method if you want to customize when detailed
# exceptions must be shown. This method is only called when
# consider_all_requests_local is false. By default, it returns
# false, but someone may set it to `request.local?` so local
# requests in production still shows the detailed exception pages.
def show_detailed_exceptions?
false
end
private
def process_action(*args)
super
rescue Exception => exception
request.env['action_dispatch.show_detailed_exceptions'] ||= show_detailed_exceptions?
rescue_with_handler(exception) || raise(exception)
end
end

View File

@@ -9,7 +9,7 @@ module ActionController #:nodoc:
# respond_to :html, :xml, :json
#
# def index
# @people = Person.all
# @people = Person.find(:all)
# respond_with(@people)
# end
# end
@@ -84,8 +84,8 @@ module ActionController #:nodoc:
#
# === Custom options
#
# <code>respond_with</code> also allows you to pass options that are forwarded
# to the underlying render call. Those options are only applied for success
# <code>respond_with</code> also allow you to pass options that are forwarded
# to the underlying render call. Those options are only applied success
# scenarios. For instance, you can do the following in the create method above:
#
# def create
@@ -95,7 +95,7 @@ module ActionController #:nodoc:
# respond_with(@project, @task, :status => 201)
# end
#
# This will return status 201 if the task was saved successfully. If not,
# This will return status 201 if the task was saved with success. If not,
# it will simply ignore the given options and return status 422 and the
# resource errors. To customize the failure scenario, you can pass a
# a block to <code>respond_with</code>:
@@ -172,7 +172,7 @@ module ActionController #:nodoc:
# responds to :to_format and display it.
#
def to_format
if get? || !has_errors? || response_overridden?
if get? || !has_errors?
default_render
else
display_errors
@@ -202,8 +202,10 @@ module ActionController #:nodoc:
display resource
elsif post?
display resource, :status => :created, :location => api_location
elsif has_empty_resource_definition?
display empty_resource, :status => :ok
else
head :no_content
head :ok
end
end
@@ -222,15 +224,11 @@ module ActionController #:nodoc:
alias :navigation_location :resource_location
alias :api_location :resource_location
# If a response block was given, use it, otherwise call render on
# If a given response block was given, use it, otherwise call render on
# controller.
#
def default_render
if @default_response
@default_response.call(options)
else
controller.default_render(options)
end
@default_response.call(options)
end
# Display is just a shortcut to render a resource with the current format.
@@ -255,7 +253,7 @@ module ActionController #:nodoc:
end
def display_errors
controller.render format => resource_errors, :status => :unprocessable_entity
controller.render format => resource.errors, :status => :unprocessable_entity
end
# Check whether the resource has errors.
@@ -271,16 +269,22 @@ module ActionController #:nodoc:
@action ||= ACTIONS_FOR_VERBS[request.request_method_symbol]
end
def resource_errors
respond_to?("#{format}_resource_errors", true) ? send("#{format}_resource_errors") : resource.errors
# Check whether resource needs a specific definition of empty resource to be valid
#
def has_empty_resource_definition?
respond_to?("empty_#{format}_resource", true)
end
def json_resource_errors
{:errors => resource.errors}
# Delegate to proper empty resource method
#
def empty_resource
send("empty_#{format}_resource")
end
def response_overridden?
@default_response.present?
# Return a valid empty JSON resource
#
def empty_json_resource
"{}"
end
end
end

View File

@@ -2,11 +2,6 @@ module ActionController #:nodoc:
module SessionManagement #:nodoc:
extend ActiveSupport::Concern
included do
ActiveSupport::Deprecation.warn "ActionController::SessionManagement " \
"is deprecated because it has no contents since Rails 3.1", caller
end
module ClassMethods
end

View File

@@ -200,9 +200,34 @@ module ActionController #:nodoc:
extend ActiveSupport::Concern
include AbstractController::Rendering
attr_internal :stream
module ClassMethods
# Render streaming templates. It accepts :only, :except, :if and :unless as options
# to specify when to stream, as in ActionController filters.
def stream(options={})
ActiveSupport::Deprecation.warn "stream class method is deprecated. Please give the :stream option to render instead"
if defined?(Fiber)
before_filter :_stream_filter, options
else
raise "You cannot use streaming if Fiber is not available."
end
end
end
protected
# Mark following render calls as streaming.
def _stream_filter #:nodoc:
self.stream = true
end
# Consider the stream option when normalazing options.
def _normalize_options(options) #:nodoc:
super
options[:stream] = self.stream unless options.key?(:stream)
end
# Set proper cache control and transfer encoding when streaming
def _process_options(options) #:nodoc:
super

View File

@@ -17,14 +17,11 @@ module ActionController
ActiveSupport.on_load(:action_controller) { self.cache_store ||= RAILS_CACHE }
end
initializer "action_controller.assets_config", :group => :all do |app|
app.config.action_controller.assets_dir ||= app.config.paths["public"].first
end
initializer "action_controller.set_configs" do |app|
paths = app.config.paths
options = app.config.action_controller
options.assets_dir ||= paths["public"].first
options.javascripts_dir ||= paths["public/javascripts"].first
options.stylesheets_dir ||= paths["public/stylesheets"].first
options.page_cache_directory ||= paths["public"].first
@@ -32,7 +29,6 @@ module ActionController
# make sure readers methods get compiled
options.asset_path ||= app.config.asset_path
options.asset_host ||= app.config.asset_host
options.relative_url_root ||= app.config.relative_url_root
ActiveSupport.on_load(:action_controller) do
include app.routes.mounted_helpers

View File

@@ -6,14 +6,13 @@ module ActionController
define_method(:inherited) do |klass|
super(klass)
if namespace = klass.parents.detect { |m| m.respond_to?(:railtie_helpers_paths) }
paths = namespace.railtie_helpers_paths
if namespace = klass.parents.detect {|m| m.respond_to?(:_railtie) }
paths = namespace._railtie.paths["app/helpers"].existent
else
paths = app.helpers_paths
paths = app.config.helpers_paths
end
klass.helpers_path = paths
if klass.superclass == ActionController::Base && ActionController::Base.include_all_helpers
klass.helper :all
end

View File

@@ -14,9 +14,9 @@ module ActionController
# <% end %> </div>
#
# # controller
# def update
# def destroy
# post = Post.find(params[:id])
# post.update_attributes(params[:post])
# post.destroy
#
# redirect_to(post) # Calls polymorphic_url(post) which in turn calls post_url(post)
# end
@@ -40,7 +40,7 @@ module ActionController
# dom_class(post, :edit) # => "edit_post"
# dom_class(Person, :edit) # => "edit_person"
def dom_class(record_or_class, prefix = nil)
singular = ActiveModel::Naming.param_key(record_or_class)
singular = ActiveModel::Naming.singular(record_or_class)
prefix ? "#{prefix}#{JOIN}#{singular}" : singular
end
@@ -67,7 +67,7 @@ module ActionController
# This can be overwritten to customize the default generated string representation if desired.
# If you need to read back a key from a dom_id in order to query for the underlying database record,
# you should write a helper like 'person_record_from_dom_id' that will extract the key either based
# on the default implementation (which just joins all key attributes with '_') or on your own
# on the default implementation (which just joins all key attributes with '-') or on your own
# overwritten version of the method. By default, this implementation passes the key string through a
# method that replaces all characters that are invalid inside DOM ids, with valid ones. You need to
# make sure yourself that your dom ids are valid, in case you overwrite this method.

View File

@@ -20,12 +20,7 @@ module ActionController
ActiveSupport::Notifications.subscribe("render_template.action_view") do |name, start, finish, id, payload|
path = payload[:layout]
if path
@layouts[path] += 1
if path =~ /^layouts\/(.*)/
@layouts[$1] += 1
end
end
@layouts[path] += 1
end
ActiveSupport::Notifications.subscribe("!render_template.action_view") do |name, start, finish, id, payload|
@@ -61,15 +56,6 @@ module ActionController
# # assert that the "new" view template was rendered
# assert_template "new"
#
# # assert that the layout 'admin' was rendered
# assert_template :layout => 'admin'
# assert_template :layout => 'layouts/admin'
# assert_template :layout => :admin
#
# # assert that no layout was rendered
# assert_template :layout => nil
# assert_template :layout => false
#
# # assert that the "_customer" partial was rendered twice
# assert_template :partial => '_customer', :count => 2
#
@@ -84,8 +70,6 @@ module ActionController
#
def assert_template(options = {}, message = nil)
validate_request!
# Force body to be read in case the template is being streamed
response.body
case options
when NilClass, String, Symbol
@@ -95,38 +79,18 @@ module ActionController
"expecting <?> but rendering with <?>",
options, rendered.keys.join(', '))
assert_block(msg) do
if options
rendered.any? { |t,num| t.match(options) }
else
if options.nil?
@templates.blank?
else
rendered.any? { |t,num| t.match(options) }
end
end
when Hash
if options.key?(:layout)
expected_layout = options[:layout]
msg = build_message(message,
"expecting layout <?> but action rendered <?>",
expected_layout, @layouts.keys)
case expected_layout
when String, Symbol
assert(@layouts.keys.include?(expected_layout.to_s), msg)
when Regexp
assert(@layouts.keys.any? {|l| l =~ expected_layout }, msg)
when nil, false
assert(@layouts.empty?, msg)
end
end
if expected_partial = options[:partial]
if expected_locals = options[:locals]
if defined?(@locals)
actual_locals = @locals[expected_partial.to_s.sub(/^_/,'')]
expected_locals.each_pair do |k,v|
assert_equal(v, actual_locals[k])
end
else
warn "the :locals option to #assert_template is only supported in a ActionView::TestCase"
actual_locals = @locals[expected_partial.to_s.sub(/^_/,'')]
expected_locals.each_pair do |k,v|
assert_equal(v, actual_locals[k])
end
elsif expected_count = options[:count]
actual_count = @partials[expected_partial]
@@ -134,13 +98,26 @@ module ActionController
"expecting ? to be rendered ? time(s) but rendered ? time(s)",
expected_partial, expected_count, actual_count)
assert(actual_count == expected_count.to_i, msg)
elsif options.key?(:layout)
msg = build_message(message,
"expecting layout <?> but action rendered <?>",
expected_layout, @layouts.keys)
case layout = options[:layout]
when String
assert(@layouts.include?(expected_layout), msg)
when Regexp
assert(@layouts.any? {|l| l =~ layout }, msg)
when nil
assert(@layouts.empty?, msg)
end
else
msg = build_message(message,
"expecting partial <?> but action rendered <?>",
options[:partial], @partials.keys)
assert(@partials.include?(expected_partial), msg)
end
elsif options.key?(:partial)
else
assert @partials.empty?,
"Expected no partials to be rendered"
end
@@ -204,6 +181,10 @@ module ActionController
end
def recycle!
write_cookies!
@env.delete('HTTP_COOKIE') if @cookies.blank?
@env.delete('action_dispatch.cookies')
@cookies = nil
@formats = nil
@env.delete_if { |k, v| k =~ /^(action_dispatch|rack)\.request/ }
@env.delete_if { |k, v| k =~ /^action_dispatch\.rescue/ }
@@ -211,14 +192,6 @@ module ActionController
@method = @request_method = nil
@fullpath = @ip = @remote_ip = @protocol = nil
@env['action_dispatch.request.query_parameters'] = {}
@set_cookies ||= {}
@set_cookies.update(Hash[cookie_jar.instance_variable_get("@set_cookies").map{ |k,o| [k,o[:value]] }])
deleted_cookies = cookie_jar.instance_variable_get("@delete_cookies")
@set_cookies.reject!{ |k,v| deleted_cookies.include?(k) }
cookie_jar.update(rack_cookies)
cookie_jar.update(cookies)
cookie_jar.update(@set_cookies)
cookie_jar.recycle!
end
end
@@ -239,7 +212,7 @@ module ActionController
DEFAULT_OPTIONS = Rack::Session::Abstract::ID::DEFAULT_OPTIONS
def initialize(session = {})
super(nil, nil)
@env, @by = nil, nil
replace(session.stringify_keys)
@loaded = true
end
@@ -325,26 +298,27 @@ module ActionController
# assert_equal "Dave", cookies[:name] # makes sure that a cookie called :name was set as "Dave"
# assert flash.empty? # makes sure that there's nothing in the flash
#
# For historic reasons, the assigns hash uses string-based keys. So <tt>assigns[:person]</tt> won't work, but <tt>assigns["person"]</tt> will. To
# For historic reasons, the assigns hash uses string-based keys. So assigns[:person] won't work, but assigns["person"] will. To
# appease our yearning for symbols, though, an alternative accessor has been devised using a method call instead of index referencing.
# So <tt>assigns(:person)</tt> will work just like <tt>assigns["person"]</tt>, but again, <tt>assigns[:person]</tt> will not work.
# So assigns(:person) will work just like assigns["person"], but again, assigns[:person] will not work.
#
# On top of the collections, you have the complete url that a given action redirected to available in <tt>redirect_to_url</tt>.
# On top of the collections, you have the complete url that a given action redirected to available in redirect_to_url.
#
# For redirects within the same controller, you can even call follow_redirect and the redirect will be followed, triggering another
# action call which can then be asserted against.
#
# == Manipulating session and cookie variables
# == Manipulating the request collections
#
# Sometimes you need to set up the session and cookie variables for a test.
# To do this just assign a value to the session or cookie collection:
# The collections described above link to the response, so you can test if what the actions were expected to do happened. But
# sometimes you also want to manipulate these collections in the incoming request. This is really only relevant for sessions
# and cookies, though. For sessions, you just do:
#
# session[:key] = "value"
# cookies[:key] = "value"
# @request.session[:key] = "value"
# @request.cookies[:key] = "value"
#
# To clear the cookies for a test just clear the cookie collection:
# To clear the cookies for a test just clear the request's cookies hash:
#
# cookies.clear
# @request.cookies.clear
#
# == \Testing named routes
#
@@ -362,21 +336,9 @@ module ActionController
module ClassMethods
# Sets the controller class name. Useful if the name can't be inferred from test class.
# Normalizes +controller_class+ before using. Examples:
#
# tests WidgetController
# tests :widget
# tests 'widget'
#
# Expects +controller_class+ as a constant. Example: <tt>tests WidgetController</tt>.
def tests(controller_class)
case controller_class
when String, Symbol
self.controller_class = "#{controller_class.to_s.underscore}_controller".camelize.constantize
when Class
self.controller_class = controller_class
else
raise ArgumentError, "controller class must be a String, Symbol, or Class"
end
self.controller_class = controller_class
end
def controller_class=(new_class)
@@ -393,7 +355,9 @@ module ActionController
end
def determine_default_controller_class(name)
name.sub(/Test$/, '').safe_constantize
name.sub(/Test$/, '').constantize
rescue NameError
nil
end
def prepare_controller_class(new_class)
@@ -443,7 +407,7 @@ module ActionController
Hash[hash_or_array_or_value.map{|key, value| [key, paramify_values(value)] }]
when Array
hash_or_array_or_value.map {|i| paramify_values(i)}
when Rack::Test::UploadedFile, ActionDispatch::Http::UploadedFile
when Rack::Test::UploadedFile
hash_or_array_or_value
else
hash_or_array_or_value.to_param
@@ -475,13 +439,12 @@ module ActionController
parameters ||= {}
controller_class_name = @controller.class.anonymous? ?
"anonymous_controller" :
@controller.class.controller_path
@controller.class.name.underscore.sub(/_controller$/, '')
@request.assign_parameters(@routes, controller_class_name, action.to_s, parameters)
@request.session = ActionController::TestSession.new(session) if session
@request.session["flash"] = @request.flash.update(flash || {})
@request.session["flash"].sweep
@controller.request = @request
build_request_uri(action, parameters)
@@ -490,6 +453,7 @@ module ActionController
@controller.process_with_new_base_test(@request, @response)
@assigns = @controller.respond_to?(:view_assigns) ? @controller.view_assigns : {}
@request.session.delete('flash') if @request.session['flash'].blank?
@request.cookies.merge!(@response.cookies)
@response
end
@@ -509,6 +473,11 @@ module ActionController
end
end
# Cause the action to be rescued according to the regular rules for rescue_action when the visitor is not local
def rescue_action_in_public!
@request.remote_addr = '208.77.188.166' # example.com
end
included do
include ActionController::TemplateAssertions
include ActionDispatch::Assertions

View File

@@ -66,7 +66,7 @@ module HTML
# A regular expression of the valid characters used to separate protocols like
# the ':' in 'http://foo.com'
self.protocol_separator = /:|(&#0*58)|(&#x70)|(&#x0*3a)|(%|&#37;)3A/i
self.protocol_separator = /:|(&#0*58)|(&#x70)|(%|&#37;)3A/
# Specifies a Set of HTML attributes that can have URIs.
self.uri_attributes = Set.new(%w(href src cite action longdesc xlink:href lowsrc))
@@ -104,14 +104,14 @@ module HTML
# Specifies the default Set of allowed shorthand css properties for the #sanitize and #sanitize_css helpers.
self.shorthand_css_properties = Set.new(%w(background border margin padding))
# Sanitizes a block of css code. Used by #sanitize when it comes across a style attribute
# Sanitizes a block of css code. Used by #sanitize when it comes across a style attribute
def sanitize_css(style)
# disallow urls
style = style.to_s.gsub(/url\s*\(\s*[^\s)]+?\s*\)\s*/, ' ')
# gauntlet
if style !~ /\A([:,;#%.\sa-zA-Z0-9!]|\w-\w|\'[\s\w]+\'|\"[\s\w]+\"|\([\d,\s]+\))*\z/ ||
style !~ /\A(\s*[-\w]+\s*:\s*[^:;]*(;|$)\s*)*\z/
if style !~ /^([:,;#%.\sa-zA-Z0-9!]|\w-\w|\'[\s\w]+\'|\"[\s\w]+\"|\([\d,\s]+\))*$/ ||
style !~ /^(\s*[-\w]+\s*:\s*[^:;]*(;|$)\s*)*$/
return ''
end
@@ -122,7 +122,7 @@ module HTML
elsif shorthand_css_properties.include?(prop.split('-')[0].downcase)
unless val.split().any? do |keyword|
!allowed_css_keywords.include?(keyword) &&
keyword !~ /\A(#[0-9a-f]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)\z/
keyword !~ /^(#[0-9a-f]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)$/
end
clean << prop + ': ' + val + ';'
end
@@ -171,7 +171,7 @@ module HTML
def contains_bad_protocols?(attr_name, value)
uri_attributes.include?(attr_name) &&
(value =~ /(^[^\/:]*):|(&#0*58)|(&#x70)|(&#x0*3a)|(%|&#37;)3A/i && !allowed_protocols.include?(value.split(protocol_separator).first.downcase.strip))
(value =~ /(^[^\/:]*):|(&#0*58)|(&#x70)|(%|&#37;)3A/ && !allowed_protocols.include?(value.split(protocol_separator).first.downcase))
end
end
end

View File

@@ -47,16 +47,12 @@ module ActionDispatch
end
autoload_under 'middleware' do
autoload :RequestId
autoload :BestStandardsSupport
autoload :Callbacks
autoload :Cookies
autoload :DebugExceptions
autoload :ExceptionWrapper
autoload :Flash
autoload :Head
autoload :ParamsParser
autoload :PublicExceptions
autoload :Reloader
autoload :RemoteIp
autoload :Rescue
@@ -64,6 +60,7 @@ module ActionDispatch
autoload :Static
end
autoload :ClosedError, 'action_dispatch/middleware/closed_error'
autoload :MiddlewareStack, 'action_dispatch/middleware/stack'
autoload :Routing
@@ -85,7 +82,6 @@ module ActionDispatch
autoload :AbstractStore, 'action_dispatch/middleware/session/abstract_store'
autoload :CookieStore, 'action_dispatch/middleware/session/cookie_store'
autoload :MemCacheStore, 'action_dispatch/middleware/session/mem_cache_store'
autoload :CacheStore, 'action_dispatch/middleware/session/cache_store'
end
autoload_under 'testing' do

View File

@@ -4,18 +4,14 @@ module ActionDispatch
module Http
module Cache
module Request
HTTP_IF_MODIFIED_SINCE = 'HTTP_IF_MODIFIED_SINCE'.freeze
HTTP_IF_NONE_MATCH = 'HTTP_IF_NONE_MATCH'.freeze
def if_modified_since
if since = env[HTTP_IF_MODIFIED_SINCE]
if since = env['HTTP_IF_MODIFIED_SINCE']
Time.rfc2822(since) rescue nil
end
end
def if_none_match
env[HTTP_IF_NONE_MATCH]
env['HTTP_IF_NONE_MATCH']
end
def not_modified?(modified_at)
@@ -47,35 +43,31 @@ module ActionDispatch
alias :etag? :etag
def last_modified
if last = headers[LAST_MODIFIED]
if last = headers['Last-Modified']
Time.httpdate(last)
end
end
def last_modified?
headers.include?(LAST_MODIFIED)
headers.include?('Last-Modified')
end
def last_modified=(utc_time)
headers[LAST_MODIFIED] = utc_time.httpdate
headers['Last-Modified'] = utc_time.httpdate
end
def etag=(etag)
key = ActiveSupport::Cache.expand_cache_key(etag)
@etag = self[ETAG] = %("#{Digest::MD5.hexdigest(key)}")
@etag = self["ETag"] = %("#{Digest::MD5.hexdigest(key)}")
end
private
LAST_MODIFIED = "Last-Modified".freeze
ETAG = "ETag".freeze
CACHE_CONTROL = "Cache-Control".freeze
def prepare_cache_control!
@cache_control = {}
@etag = self[ETAG]
@etag = self["ETag"]
if cache_control = self[CACHE_CONTROL]
if cache_control = self["Cache-Control"]
cache_control.split(/,\s*/).each do |segment|
first, last = segment.split("=")
@cache_control[first.to_sym] = last || true
@@ -89,32 +81,28 @@ module ActionDispatch
end
end
DEFAULT_CACHE_CONTROL = "max-age=0, private, must-revalidate".freeze
NO_CACHE = "no-cache".freeze
PUBLIC = "public".freeze
PRIVATE = "private".freeze
MUST_REVALIDATE = "must-revalidate".freeze
DEFAULT_CACHE_CONTROL = "max-age=0, private, must-revalidate"
def set_conditional_cache_control!
return if self[CACHE_CONTROL].present?
return if self["Cache-Control"].present?
control = @cache_control
if control.empty?
headers[CACHE_CONTROL] = DEFAULT_CACHE_CONTROL
headers["Cache-Control"] = DEFAULT_CACHE_CONTROL
elsif control[:no_cache]
headers[CACHE_CONTROL] = NO_CACHE
headers["Cache-Control"] = "no-cache"
else
extras = control[:extras]
max_age = control[:max_age]
options = []
options << "max-age=#{max_age.to_i}" if max_age
options << (control[:public] ? PUBLIC : PRIVATE)
options << MUST_REVALIDATE if control[:must_revalidate]
options << (control[:public] ? "public" : "private")
options << "must-revalidate" if control[:must_revalidate]
options.concat(extras) if extras
headers[CACHE_CONTROL] = options.join(", ")
headers["Cache-Control"] = options.join(", ")
end
end
end

View File

@@ -26,6 +26,8 @@ module ActionDispatch
module FilterParameters
extend ActiveSupport::Concern
@@parameter_filter_for = {}
# Return a hash of parameters with all sensitive data replaced.
def filtered_parameters
@filtered_parameters ||= parameter_filter.filter(parameters)
@@ -52,7 +54,7 @@ module ActionDispatch
end
def parameter_filter_for(filters)
ParameterFilter.new(filters)
@@parameter_filter_for[filters] ||= ParameterFilter.new(filters)
end
KV_RE = '[^&;=]+'

View File

@@ -1,10 +1,11 @@
require 'active_support/memoizable'
module ActionDispatch
module Http
class Headers < ::Hash
@@env_cache = Hash.new { |h,k| h[k] = "HTTP_#{k.upcase.gsub(/-/, '_')}" }
extend ActiveSupport::Memoizable
def initialize(*args)
if args.size == 1 && args[0].is_a?(Hash)
super()
update(args[0])
@@ -24,8 +25,9 @@ module ActionDispatch
private
# Converts a HTTP header name to an environment variable name.
def env_name(header_name)
@@env_cache[header_name]
"HTTP_#{header_name.upcase.gsub(/-/, '_')}"
end
memoize :env_name
end
end
end

View File

@@ -98,8 +98,7 @@ module ActionDispatch
BROWSER_LIKE_ACCEPTS = /,\s*\*\/\*|\*\/\*\s*,/
def valid_accept_header
(xhr? && (accept.present? || content_mime_type)) ||
(accept.present? && accept !~ BROWSER_LIKE_ACCEPTS)
xhr? || (accept && accept !~ BROWSER_LIKE_ACCEPTS)
end
def use_accept_header

View File

@@ -47,7 +47,7 @@ module Mime
cattr_reader :html_types
# These are the content types which browsers can generate without using ajax, flash, etc
# i.e. following a link, getting an image or posting a form. CSRF protection
# i.e. following a link, getting an image or posting a form. CSRF protection
# only needs to protect against these types.
@@browser_generated_types = Set.new [:html, :url_encoded_form, :multipart_form, :text]
cattr_reader :browser_generated_types
@@ -82,7 +82,6 @@ module Mime
class << self
TRAILING_STAR_REGEXP = /(text|application)\/\*/
Q_SEPARATOR_REGEXP = /;\s*q=/
def lookup(string)
LOOKUP[string]
@@ -104,12 +103,11 @@ module Mime
SET << Mime.const_get(symbol.to_s.upcase)
([string] + mime_type_synonyms).each { |str| LOOKUP[str] = SET.last } unless skip_lookup
([symbol] + extension_synonyms).each { |ext| EXTENSION_LOOKUP[ext.to_s] = SET.last }
([symbol.to_s] + extension_synonyms).each { |ext| EXTENSION_LOOKUP[ext] = SET.last }
end
def parse(accept_header)
if accept_header !~ /,/
accept_header = accept_header.split(Q_SEPARATOR_REGEXP).first
if accept_header =~ TRAILING_STAR_REGEXP
parse_data_with_trailing_star($1)
else
@@ -119,7 +117,7 @@ module Mime
# keep track of creation order to keep the subsequent sort stable
list, index = [], 0
accept_header.split(/,/).each do |header|
params, q = header.split(Q_SEPARATOR_REGEXP)
params, q = header.split(/;\s*q=/)
if params.present?
params.strip!
@@ -248,7 +246,7 @@ module Mime
end
end
# Returns true if Action Pack should check requests using this Mime Type for possible request forgery. See
# Returns true if Action Pack should check requests using this Mime Type for possible request forgery. See
# ActionController::RequestForgeryProtection.
def verify_request?
@@browser_generated_types.include?(to_sym)
@@ -258,10 +256,6 @@ module Mime
@@html_types.include?(to_sym) || @string =~ /html/
end
def respond_to?(method, include_private = false) #:nodoc:
super || method.to_s =~ /(\w+)\?$/
end
private
def method_missing(method, *args)
if method.to_s =~ /(\w+)\?$/

View File

@@ -7,15 +7,6 @@ Mime::Type.register "text/javascript", :js, %w( application/javascript applicati
Mime::Type.register "text/css", :css
Mime::Type.register "text/calendar", :ics
Mime::Type.register "text/csv", :csv
Mime::Type.register "image/png", :png, [], %w(png)
Mime::Type.register "image/jpeg", :jpeg, [], %w(jpg jpeg jpe)
Mime::Type.register "image/gif", :gif, [], %w(gif)
Mime::Type.register "image/bmp", :bmp, [], %w(bmp)
Mime::Type.register "image/tiff", :tiff, [], %w(tif tiff)
Mime::Type.register "video/mpeg", :mpeg, [], %w(mpg mpeg mpe)
Mime::Type.register "application/xml", :xml, %w( text/xml application/x-xml )
Mime::Type.register "application/rss+xml", :rss
Mime::Type.register "application/atom+xml", :atom
@@ -28,8 +19,5 @@ Mime::Type.register "application/x-www-form-urlencoded", :url_encoded_form
# http://www.json.org/JSONRequest.html
Mime::Type.register "application/json", :json, %w( text/x-json application/jsonrequest )
Mime::Type.register "application/pdf", :pdf, [], %w(pdf)
Mime::Type.register "application/zip", :zip, [], %w(zip)
# Create Mime::ALL but do not add it to the SET.
Mime::ALL = Mime::Type.new("*/*", :all, [])

View File

@@ -20,8 +20,6 @@ module ActionDispatch
@filters.present?
end
FILTERED = '[FILTERED]'.freeze
def compiled_filter
@compiled_filter ||= begin
regexps, blocks = compile_filter
@@ -31,7 +29,7 @@ module ActionDispatch
original_params.each do |key, value|
if regexps.find { |r| key =~ r }
value = FILTERED
value = '[FILTERED]'
elsif value.is_a?(Hash)
value = filter(value)
elsif value.is_a?(Array)

View File

@@ -2,11 +2,11 @@ require 'tempfile'
require 'stringio'
require 'strscan'
require 'active_support/core_ext/module/deprecation'
require 'active_support/core_ext/hash/indifferent_access'
require 'active_support/core_ext/string/access'
require 'active_support/inflector'
require 'action_dispatch/http/headers'
require 'action_controller/metal/exceptions'
module ActionDispatch
class Request < Rack::Request
@@ -26,7 +26,7 @@ module ActionDispatch
HTTP_ACCEPT HTTP_ACCEPT_CHARSET HTTP_ACCEPT_ENCODING
HTTP_ACCEPT_LANGUAGE HTTP_CACHE_CONTROL HTTP_FROM
HTTP_NEGOTIATE HTTP_PRAGMA ].freeze
ENV_METHODS.each do |env|
class_eval <<-METHOD, __FILE__, __LINE__ + 1
def #{env.sub(/^HTTP_/n, '').downcase} # def accept_charset
@@ -35,6 +35,14 @@ module ActionDispatch
METHOD
end
def self.new(env)
if request = env["action_dispatch.request"] && request.instance_of?(self)
return request
end
super
end
def key?(key)
@env.key?(key)
end
@@ -56,12 +64,7 @@ module ActionDispatch
RFC5789 = %w(PATCH)
HTTP_METHODS = RFC2616 + RFC2518 + RFC3253 + RFC3648 + RFC3744 + RFC5323 + RFC5789
HTTP_METHOD_LOOKUP = {}
# Populate the HTTP method lookup cache
HTTP_METHODS.each do |method|
HTTP_METHOD_LOOKUP[method] = method.underscore.to_sym
end
HTTP_METHOD_LOOKUP = Hash.new { |h, m| h[m] = m.underscore.to_sym if HTTP_METHODS.include?(m) }
# Returns the HTTP \method that the application should see.
# In the case where the \method was overridden by a middleware
@@ -91,31 +94,31 @@ module ActionDispatch
end
# Is this a GET (or HEAD) request?
# Equivalent to <tt>request.request_method_symbol == :get</tt>.
# Equivalent to <tt>request.request_method == :get</tt>.
def get?
HTTP_METHOD_LOOKUP[request_method] == :get
end
# Is this a POST request?
# Equivalent to <tt>request.request_method_symbol == :post</tt>.
# Equivalent to <tt>request.request_method == :post</tt>.
def post?
HTTP_METHOD_LOOKUP[request_method] == :post
end
# Is this a PUT request?
# Equivalent to <tt>request.request_method_symbol == :put</tt>.
# Equivalent to <tt>request.request_method == :put</tt>.
def put?
HTTP_METHOD_LOOKUP[request_method] == :put
end
# Is this a DELETE request?
# Equivalent to <tt>request.request_method_symbol == :delete</tt>.
# Equivalent to <tt>request.request_method == :delete</tt>.
def delete?
HTTP_METHOD_LOOKUP[request_method] == :delete
end
# Is this a HEAD request?
# Equivalent to <tt>request.method_symbol == :head</tt>.
# Equivalent to <tt>request.method == :head</tt>.
def head?
HTTP_METHOD_LOOKUP[method] == :head
end
@@ -139,6 +142,11 @@ module ActionDispatch
base_url + original_fullpath
end
def forgery_whitelisted?
get?
end
deprecate :forgery_whitelisted? => "it is just an alias for 'get?' now, update your code"
def media_type
content_mime_type.to_s
end
@@ -160,21 +168,28 @@ module ActionDispatch
@ip ||= super
end
# Originating IP address, usually set by the RemoteIp middleware.
# Which IP addresses are "trusted proxies" that can be stripped from
# the right-hand-side of X-Forwarded-For.
#
# http://en.wikipedia.org/wiki/Private_network#Private_IPv4_address_spaces.
TRUSTED_PROXIES = %r{
^127\.0\.0\.1$ | # localhost
^(10 | # private IP 10.x.x.x
172\.(1[6-9]|2[0-9]|3[0-1]) | # private IP in the range 172.16.0.0 .. 172.31.255.255
192\.168 # private IP 192.168.x.x
)\.
}x
# Determines originating IP address. REMOTE_ADDR is the standard
# but will fail if the user is behind a proxy. HTTP_CLIENT_IP and/or
# HTTP_X_FORWARDED_FOR are set by proxies so check for these if
# REMOTE_ADDR is a proxy. HTTP_X_FORWARDED_FOR may be a comma-
# delimited list in the case of multiple chained proxies; the last
# address which is not trusted is the originating IP.
def remote_ip
@remote_ip ||= (@env["action_dispatch.remote_ip"] || ip).to_s
end
# Returns the unique request id, which is based off either the X-Request-Id header that can
# be generated by a firewall, load balancer, or web server or by the RequestId middleware
# (which sets the action_dispatch.request_id environment variable).
#
# This unique ID is useful for tracing a request from end-to-end as part of logging or debugging.
# This relies on the rack variable set by the ActionDispatch::RequestId middleware.
def uuid
@uuid ||= env["action_dispatch.request_id"]
end
# Returns the lowercase name of the HTTP server software.
def server_software
(@env['SERVER_SOFTWARE'] && /^([a-zA-Z]+)/ =~ @env['SERVER_SOFTWARE']) ? $1.downcase : nil
@@ -184,9 +199,8 @@ module ActionDispatch
# work with raw requests directly.
def raw_post
unless @env.include? 'RAW_POST_DATA'
raw_post_body = body
@env['RAW_POST_DATA'] = raw_post_body.read(@env['CONTENT_LENGTH'].to_i)
raw_post_body.rewind if raw_post_body.respond_to?(:rewind)
@env['RAW_POST_DATA'] = body.read(@env['CONTENT_LENGTH'].to_i)
body.rewind if body.respond_to?(:rewind)
end
@env['RAW_POST_DATA']
end
@@ -228,13 +242,13 @@ module ActionDispatch
# Override Rack's GET method to support indifferent access
def GET
@env["action_dispatch.request.query_parameters"] ||= deep_munge(normalize_parameters(super) || {})
@env["action_dispatch.request.query_parameters"] ||= (normalize_parameters(super) || {})
end
alias :query_parameters :GET
# Override Rack's POST method to support indifferent access
def POST
@env["action_dispatch.request.request_parameters"] ||= deep_munge(normalize_parameters(super) || {})
@env["action_dispatch.request.request_parameters"] ||= (normalize_parameters(super) || {})
end
alias :request_parameters :POST
@@ -253,14 +267,18 @@ module ActionDispatch
LOCALHOST.any? { |local_ip| local_ip === remote_addr && local_ip === remote_ip }
end
protected
# Remove nils from the params hash
def deep_munge(hash)
hash.each do |k, v|
keys = hash.keys.find_all { |k| hash[k] == [nil] }
keys.each { |k| hash[k] = nil }
hash.each_value do |v|
case v
when Array
v.grep(Hash) { |x| deep_munge(x) }
v.compact!
hash[k] = nil if v.empty?
when Hash
deep_munge(v)
end
@@ -269,8 +287,6 @@ module ActionDispatch
hash
end
protected
def parse_query(qs)
deep_munge(super)
end

View File

@@ -33,8 +33,7 @@ module ActionDispatch # :nodoc:
# end
# end
class Response
attr_accessor :request, :header
attr_reader :status
attr_accessor :request, :header, :status
attr_writer :sending_file
alias_method :headers=, :header=
@@ -53,10 +52,8 @@ module ActionDispatch # :nodoc:
# information.
attr_accessor :charset, :content_type
CONTENT_TYPE = "Content-Type".freeze
SET_COOKIE = "Set-Cookie".freeze
LOCATION = "Location".freeze
CONTENT_TYPE = "Content-Type"
cattr_accessor(:default_charset) { "utf-8" }
include Rack::Response::Helpers
@@ -68,10 +65,10 @@ module ActionDispatch # :nodoc:
@sending_file = false
@blank = false
if content_type = self[CONTENT_TYPE]
if content_type = self["Content-Type"]
type, charset = content_type.split(/;\s*charset=/)
@content_type = Mime::Type.lookup(type)
@charset = charset || self.class.default_charset
@charset = charset || "UTF-8"
end
prepare_cache_control!
@@ -118,9 +115,32 @@ module ActionDispatch # :nodoc:
EMPTY = " "
class BodyBuster #:nodoc:
def initialize(response)
@response = response
@body = ""
end
def bust(body)
body.call(@response, self)
body.close if body.respond_to?(:close)
@body
end
def write(string)
@body << string.to_s
end
end
def body=(body)
@blank = true if body == EMPTY
if body.respond_to?(:call)
ActiveSupport::Deprecation.warn "Setting a Proc or an object that responds to call " \
"in response_body is no longer supported", caller
body = BodyBuster.new(self).bust(body)
end
# Explicitly check for strings. This is *wrong* theoretically
# but if we don't check this, the performance on string bodies
# is bad on Ruby 1.8 (because strings responds to each then).
@@ -144,12 +164,12 @@ module ActionDispatch # :nodoc:
end
def location
headers[LOCATION]
headers['Location']
end
alias_method :redirect_url, :location
def location=(url)
headers[LOCATION] = url
headers['Location'] = url
end
def close
@@ -160,10 +180,10 @@ module ActionDispatch # :nodoc:
assign_default_content_type_and_charset!
handle_conditional_get!
@header[SET_COOKIE] = @header[SET_COOKIE].join("\n") if @header[SET_COOKIE].respond_to?(:join)
@header["Set-Cookie"] = @header["Set-Cookie"].join("\n") if @header["Set-Cookie"].respond_to?(:join)
if [204, 304].include?(@status)
@header.delete CONTENT_TYPE
@header.delete "Content-Type"
[@status, @header, []]
else
[@status, @header, self]
@@ -177,7 +197,7 @@ module ActionDispatch # :nodoc:
# assert_equal 'AuthorOfNewPage', r.cookies['author']
def cookies
cookies = {}
if header = self[SET_COOKIE]
if header = self["Set-Cookie"]
header = header.split("\n") if header.respond_to?(:to_str)
header.each do |cookie|
if pair = cookie.split(';').first

View File

@@ -11,15 +11,26 @@ module ActionDispatch
raise(ArgumentError, ':tempfile is required') unless @tempfile
end
def open
@tempfile.open
end
def path
@tempfile.path
end
def read(*args)
@tempfile.read(*args)
end
# Delegate these methods to the tempfile.
[:open, :path, :rewind, :size].each do |method|
class_eval "def #{method}; @tempfile.#{method}; end"
def rewind
@tempfile.rewind
end
def size
@tempfile.size
end
private
def encode_filename(filename)
# Encode the filename in the utf8 encoding, unless it is nil or we're in 1.8

View File

@@ -43,13 +43,9 @@ module ActionDispatch
params = options[:params] || {}
params.reject! {|k,v| v.to_param.nil? }
if options[:trailing_slash] && !path.ends_with?('/')
rewritten_url << path.sub(/(\?|\z)/) { "/" + $& }
else
rewritten_url << path
end
rewritten_url << (options[:trailing_slash] ? path.sub(/\?|\z/) { "/" + $& } : path)
rewritten_url << "?#{params.to_query}" unless params.empty?
rewritten_url << "##{Journey::Router::Utils.escape_fragment(options[:anchor].to_param.to_s)}" if options[:anchor]
rewritten_url << "##{Rack::Mount::Utils.escape_uri(options[:anchor].to_param.to_s)}" if options[:anchor]
rewritten_url
end

View File

@@ -15,15 +15,7 @@ module ActionDispatch
def call(env)
status, headers, body = @app.call(env)
if headers["X-UA-Compatible"] && @header
unless headers["X-UA-Compatible"][@header]
headers["X-UA-Compatible"] << "," << @header.to_s
end
else
headers["X-UA-Compatible"] = @header
end
headers["X-UA-Compatible"] = @header
[status, headers, body]
end
end

Some files were not shown because too many files have changed in this diff Show More