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
645 changed files with 15240 additions and 22489 deletions

6
.gitignore vendored
View File

@@ -1,12 +1,13 @@
*.gem
pkg
.bundle
Gemfile.lock
.Gemfile
debug.log
doc/rdoc
activemodel/doc
activeresource/doc
activerecord/doc
activerecord/sqlnet.log
actionpack/doc
actionmailer/doc
activesupport/doc
@@ -22,4 +23,5 @@ railties/doc
railties/guides/output
railties/tmp
.rvmrc
RDOC_MAIN.rdoc
.rbenv-version
RDOC_MAIN.rdoc

25
.travis.yml Normal file
View File

@@ -0,0 +1,25 @@
script: 'ci/travis.rb'
rvm:
- 1.8.7
- 1.9.2
- 1.9.3
env:
- "GEM=railties"
- "GEM=ap,am,amo,ares,as"
- "GEM=ar:mysql"
- "GEM=ar:mysql2"
- "GEM=ar:sqlite3"
- "GEM=ar:postgresql"
notifications:
email: false
irc:
on_success: change
on_failure: always
channels:
- "irc.freenode.org#rails-contrib"
campfire:
on_success: change
on_failure: always
rooms:
- secure: "CGWvthGkBKNnTnk9YSmf9AXKoiRI33fCl5D3jU4nx3cOPu6kv2R9nMjt9EAo\nOuS4Q85qNSf4VNQ2cUPNiNYSWQ+XiTfivKvDUw/QW9r1FejYyeWarMsSBWA+\n0fADjF1M2dkDIVLgYPfwoXEv7l+j654F1KLKB69F0F/netwP9CQ="
bundler_args: --path vendor/bundle

61
Gemfile
View File

@@ -1,24 +1,28 @@
source 'http://rubygems.org'
source "http://rubygems.org"
gemspec
if ENV['AREL']
gem "arel", :path => ENV['AREL']
else
gem "arel", '~> 2.1.0'
end
gem "coffee-script"
gem "sass"
gem "uglifier", :git => "git://github.com/lautis/uglifier.git"
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 "rake", ">= 0.8.7"
gem "mocha", ">= 0.9.8"
gem "rake", ">= 0.8.7"
gem "mocha", "0.10.5"
group :doc do
gem "rdoc", "~> 3.4"
gem "horo", "= 1.0.3"
# 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" if RUBY_VERSION < "1.9.3"
gem "w3c_validators"
end
# AS
@@ -26,40 +30,39 @@ gem "memcache-client", ">= 1.8.5"
platforms :mri_18 do
gem "system_timer"
gem "ruby-debug", ">= 0.10.3"
gem "json"
end
platforms :mri_19 do
# TODO: Remove the conditional when ruby-debug19 supports Ruby >= 1.9.3
gem "ruby-debug19", :require => 'ruby-debug' if RUBY_VERSION < "1.9.3"
# Add your own local bundler stuff
instance_eval File.read ".Gemfile" if File.exists? ".Gemfile"
platforms :mri do
group :test do
gem 'ruby-prof', '~> 0.11.2'
end
end
platforms :ruby do
if ENV["RB_FSEVENT"]
gem 'rb-fsevent'
gem "rb-fsevent"
end
gem 'json'
gem 'yajl-ruby'
gem "json"
gem "yajl-ruby"
gem "nokogiri", ">= 1.4.4"
group :test do
gem 'ruby-prof'
end
# AR
gem "sqlite3", "~> 1.3.3"
gem "sqlite3", "~> 1.3.4"
group :db do
gem "pg", ">= 0.11.0"
gem "mysql", ">= 2.8.1"
gem "mysql2", ">= 0.3.0"
gem "mysql2", ">= 0.3.10"
end
end
platforms :jruby do
gem "ruby-debug", ">= 0.10.3"
gem "json"
gem "activerecord-jdbcsqlite3-adapter"
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
@@ -67,19 +70,21 @@ platforms :jruby do
gem "jruby-openssl"
group :db do
gem "activerecord-jdbcmysql-adapter"
gem "activerecord-jdbcpostgresql-adapter"
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"
gem "ruby-oci8", ">= 2.0.4"
end
if ENV['ORACLE_ENHANCED_PATH']
gem 'activerecord-oracle_enhanced-adapter', :path => 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
gem 'benchmark-ips'

View File

@@ -1 +1 @@
3.1.0.rc1
3.1.8

View File

@@ -1,30 +1,35 @@
== Welcome to Rails
Rails is a web-application framework that includes everything needed to create
database-backed web applications according to the Model-View-Control pattern.
database-backed web applications according to the {Model-View-Controller (MVC)}[http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller] pattern.
This pattern splits the view (also called the presentation) into "dumb"
templates that are primarily responsible for inserting pre-built data in between
HTML tags. The model contains the "smart" domain objects (such as Account,
Product, Person, Post) that holds all the business logic and knows how to
persist themselves to a database. The controller handles the incoming requests
(such as Save New Account, Update Product, Show Post) by manipulating the model
and directing data to the view.
Understanding the MVC pattern is key to understanding Rails. MVC divides your application
into three layers, each with a specific responsibility.
In Rails, the model is handled by what's called an object-relational mapping
layer entitled Active Record. This layer allows you to present the data from
database rows as objects and embellish these data objects with business logic
methods. You can read more about Active Record in its
The View layer is composed of "templates" that are responsible for providing
appropriate representations of your application's resources. Templates
can come in a variety of formats, but most view templates are \HTML with embedded Ruby
code (.erb files).
The Model layer represents your domain model (such as Account, Product, Person, Post)
and encapsulates the business logic that is specific to your application. In Rails,
database-backed model classes are derived from ActiveRecord::Base. Active Record allows
you to present the data from database rows as objects and embellish these data objects
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:files/activerecord/README_rdoc.html].
The controller and view are handled by the Action Pack, which handles both
layers by its two parts: Action View and Action Controller. These two layers
are bundled in a single package due to their heavy interdependence. This is
unlike the relationship between the Active Record and Action Pack that is much
more separate. Each of these packages can be used independently outside of
Rails. You can read more about Action Pack in its
{README}[link:files/actionpack/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
generate XML, JSON, PDFs, mobile-specific views, and more. Controllers manipulate models
and render view templates in order to generate the appropriate HTTP response.
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:files/actionpack/README_rdoc.html].
== Getting Started
@@ -44,7 +49,7 @@ Rails. You can read more about Action Pack in its
Run with <tt>--help</tt> for options.
4. Go to http://localhost:3000/ and you'll see:
4. Go to http://localhost:3000 and you'll see:
"Welcome aboard: You're riding Ruby on Rails!"
@@ -60,7 +65,7 @@ Rails. You can read more about Action Pack in its
== Contributing
We encourage you to contribute to Ruby on Rails! Please check out the {Contributing to Rails
guide}[http://edgeguides.rubyonrails.org/contributing_to_rails.html] for guidelines about how
guide}[http://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html] for guidelines about how
to proceed. {Join us}[http://contributors.rubyonrails.org]!
== License

View File

@@ -1,6 +1,7 @@
#!/usr/bin/env rake
require 'rdoc/task'
require 'sdoc'
require 'net/http'
$:.unshift File.expand_path('..', __FILE__)
@@ -51,9 +52,31 @@ desc "Generate documentation for the Rails framework"
RDoc::Task.new do |rdoc|
RDOC_MAIN = 'RDOC_MAIN.rdoc'
# This is a hack.
#
# Backslashes are needed to prevent RDoc from autolinking "Rails" to the
# documentation of the Rails module. On the other hand, as of this
# writing README.rdoc is displayed in the front page of the project in
# GitHub, where backslashes are shown and look weird.
#
# The temporary solution is to have a README.rdoc without backslashes for
# GitHub, and gsub it to generate the main page of the API.
#
# Also, relative links in GitHub have to point to blobs, whereas in the API
# they need to point to files.
#
# The idea for the future is to have totally different files, since the
# API is no longer a generic entry point to Rails and deserves a
# dedicated main page specifically thought as an API entry point.
rdoc.before_running_rdoc do
rdoc_main = File.read('README.rdoc')
rdoc_main.gsub!(/\b(?=Rails)\b/) { '\\' }
# The ^(?=\S) assertion prevents code blocks from being processed,
# since no autolinking happens there and RDoc displays the backslash
# otherwise.
rdoc_main.gsub!(/^(?=\S).*?\b(?=Rails)\b/) { "#$&\\" }
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)
end
@@ -64,28 +87,30 @@ RDoc::Task.new do |rdoc|
rdoc.rdoc_dir = 'doc/rdoc'
rdoc.title = "Ruby on Rails Documentation"
rdoc.options << '-f' << 'horo'
rdoc.options << '-f' << 'sdoc'
rdoc.options << '-T' << 'rails'
rdoc.options << '-c' << 'utf-8'
rdoc.options << '-g' # SDoc flag, link methods to GitHub
rdoc.options << '-m' << RDOC_MAIN
rdoc.rdoc_files.include('railties/CHANGELOG')
rdoc.rdoc_files.include('railties/CHANGELOG.md')
rdoc.rdoc_files.include('railties/MIT-LICENSE')
rdoc.rdoc_files.include('railties/README.rdoc')
rdoc.rdoc_files.include('railties/lib/**/*.rb')
rdoc.rdoc_files.exclude('railties/lib/rails/generators/**/templates/*')
rdoc.rdoc_files.exclude('railties/lib/rails/generators/**/templates/**/*.rb')
rdoc.rdoc_files.include('activerecord/README.rdoc')
rdoc.rdoc_files.include('activerecord/CHANGELOG')
rdoc.rdoc_files.include('activerecord/CHANGELOG.md')
rdoc.rdoc_files.include('activerecord/lib/active_record/**/*.rb')
rdoc.rdoc_files.exclude('activerecord/lib/active_record/vendor/*')
rdoc.rdoc_files.include('activeresource/README.rdoc')
rdoc.rdoc_files.include('activeresource/CHANGELOG')
rdoc.rdoc_files.include('activeresource/CHANGELOG.md')
rdoc.rdoc_files.include('activeresource/lib/active_resource.rb')
rdoc.rdoc_files.include('activeresource/lib/active_resource/*')
rdoc.rdoc_files.include('actionpack/README.rdoc')
rdoc.rdoc_files.include('actionpack/CHANGELOG')
rdoc.rdoc_files.include('actionpack/CHANGELOG.md')
rdoc.rdoc_files.include('actionpack/lib/abstract_controller/**/*.rb')
rdoc.rdoc_files.include('actionpack/lib/action_controller/**/*.rb')
rdoc.rdoc_files.include('actionpack/lib/action_dispatch/**/*.rb')
@@ -93,18 +118,18 @@ RDoc::Task.new do |rdoc|
rdoc.rdoc_files.exclude('actionpack/lib/action_controller/vendor/*')
rdoc.rdoc_files.include('actionmailer/README.rdoc')
rdoc.rdoc_files.include('actionmailer/CHANGELOG')
rdoc.rdoc_files.include('actionmailer/CHANGELOG.md')
rdoc.rdoc_files.include('actionmailer/lib/action_mailer/base.rb')
rdoc.rdoc_files.include('actionmailer/lib/action_mailer/mail_helper.rb')
rdoc.rdoc_files.exclude('actionmailer/lib/action_mailer/vendor/*')
rdoc.rdoc_files.include('activesupport/README.rdoc')
rdoc.rdoc_files.include('activesupport/CHANGELOG')
rdoc.rdoc_files.include('activesupport/CHANGELOG.md')
rdoc.rdoc_files.include('activesupport/lib/active_support/**/*.rb')
rdoc.rdoc_files.exclude('activesupport/lib/active_support/vendor/*')
rdoc.rdoc_files.include('activemodel/README.rdoc')
rdoc.rdoc_files.include('activemodel/CHANGELOG')
rdoc.rdoc_files.include('activemodel/CHANGELOG.md')
rdoc.rdoc_files.include('activemodel/lib/active_model/**/*.rb')
end

View File

@@ -1,449 +0,0 @@
*Rails 3.1.0 (unreleased)*
* No changes
*Rails 3.0.7 (April 18, 2011)*
* remove AM delegating register_observer and register_interceptor to Mail [Josh Kalderimis]
*Rails 3.0.6 (April 5, 2011)
* Don't allow i18n to change the minor version, version now set to ~> 0.5.0 [Santiago Pastorino]
*Rails 3.0.5 (February 26, 2011)*
* No changes.
*Rails 3.0.4 (February 8, 2011)*
* No changes.
*Rails 3.0.3 (November 16, 2010)*
* No changes.
*Rails 3.0.2 (November 15, 2010)*
* No changes
*Rails 3.0.1 (October 15, 2010)*
* No Changes, just a version bump.
*Rails 3.0.0 (August 29, 2010)*
* subject is automatically looked up on I18n using mailer_name and action_name as scope as in t(".subject") [JK]
* Changed encoding behaviour of mail, so updated tests in actionmailer and bumped mail version to 2.2.1 [ML]
* Added ability to pass Proc objects to the defaults hash [ML]
* Removed all quoting.rb type files from ActionMailer and put Mail 2.2.0 in instead [ML]
* Lot of updates to various test cases that now work better with the new Mail and so have different expectations
* Added interceptors and observers from Mail [ML]
ActionMailer::Base.register_interceptor calls Mail.register_interceptor
ActionMailer::Base.register_observer calls Mail.register_observer
* Mail::Part now no longer has nil as a default charset, it is always set to something, and defaults to UTF-8
* Added explict setting of charset in set_fields! method to make sure Mail has the user defined default
* Removed quoting.rb and refactored for Mail to take responsibility of all quoting and auto encoding requirements for the header.
* Fixed several tests which had incorrect encoding.
* Changed all utf-8 to UTF-8 for consistency
* Whole new API added with tests. See base.rb for full details. Old API is deprecated.
* The Mail::Message class has helped methods for all the field types that return 'common' defaults for the common use case, so to get the subject, mail.subject will give you a string, mail.date will give you a DateTime object, mail.from will give you an array of address specs (mikel@test.lindsaar.net) etc. If you want to access the field object itself, call mail[:field_name] which will return the field object you want, which you can then chain, like mail[:from].formatted
* Mail#content_type now returns the content_type field as a string. If you want the mime type of a mail, then you call Mail#mime_type (eg, text/plain), if you want the parameters of the content type field, you call Mail#content_type_parameters which gives you a hash, eg {'format' => 'flowed', 'charset' => 'utf-8'}
* ActionMailer::Base :default_implicit_parts_order now is in the sequence of the order you want, no reversing of ordering takes place. The default order now is text/plain, then text/enriched, then text/html and then any other part that is not one of these three.
* Mail does not have "quoted_body", "quoted_subject" etc. All of these are accessed via body.encoded, subject.encoded etc
* Every object in a Mail object returns an object, never a string. So Mail.body returns a Mail::Body class object, need to call #encoded or #decoded to get the string you want.
* Mail::Message#set_content_type does not exist, it is simply Mail::Message#content_type
* Every mail message gets a unique message_id unless you specify one, had to change all the tests that check for equality with expected.encoded == actual.encoded to first replace their message_ids with control values
* Mail now has a proper concept of parts, remove the ActionMailer::Part and ActionMailer::PartContainer classes
* Calling #encoded on any object returns it as a string ready to go into the output stream of an email, this means it includes the \r\n at the end of the lines and the object is pre-wrapped with \r\n\t if it is a header field. Also, the "encoded" value includes the field name if it is a header field.
* Attachments are only the actual attachment, with filename etc. A part contains an attachment. The part has the content_type etc. So attachments.last.content_type is invalid. But parts.last.content_type
* There is no idea of a "sub_head" in Mail. A part is just a Message with some extra functionality, so it just has a "header" like a normal mail message
*2.3.2 [Final] (March 15, 2009)*
* Fixed that ActionMailer should send correctly formatted Return-Path in MAIL FROM for SMTP #1842 [Matt Jones]
* Fixed RFC-2045 quoted-printable bug #1421 [squadette]
* Fixed that no body charset would be set when there are attachments present #740 [Paweł Kondzior]
*2.2.1 [RC2] (November 14th, 2008)*
* Turn on STARTTLS if it is available in Net::SMTP (added in Ruby 1.8.7) and the SMTP server supports it (This is required for Gmail's SMTP server) #1336 [Grant Hollingworth]
*2.2.0 [RC1] (October 24th, 2008)*
* Add layout functionality to mailers [Pratik Naik]
Mailer layouts behaves just like controller layouts, except layout names need to
have '_mailer' postfix for them to be automatically picked up.
*2.1.0 (May 31st, 2008)*
* Fixed that a return-path header would be ignored #7572 [joost]
* Less verbose mail logging: just recipients for :info log level; the whole email for :debug only. #8000 [iaddict, Tarmo Tänav]
* Updated TMail to version 1.2.1 [Mikel Lindsaar]
* Fixed that you don't have to call super in ActionMailer::TestCase#setup #10406 [jamesgolick]
*2.0.2* (December 16th, 2007)
* Included in Rails 2.0.2
*2.0.1* (December 7th, 2007)
* Update ActionMailer so it treats ActionView the same way that ActionController does. Closes #10244 [Rick Olson]
* Pass the template_root as an array as ActionView's view_path
* Request templates with the "#{mailer_name}/#{action}" as opposed to just "#{action}"
* Fixed that partials would be broken when using text.plain.erb as the extension #10130 [java]
* Update README to use new smtp settings configuration API. Closes #10060 [psq]
* Allow ActionMailer subclasses to individually set their delivery method (so two subclasses can have different delivery methods) #10033 [Zach Dennis]
* Update TMail to v1.1.0. Use an updated version of TMail if available. [Mikel Lindsaar]
* Introduce a new base test class for testing Mailers. ActionMailer::TestCase [Michael Koziarski]
* Fix silent failure of rxml templates. #9879 [jstewart]
* Fix attachment decoding when using the TMail C extension. #7861 [orangechicken]
* Increase mail delivery test coverage. #8692 [Kamal Fariz Mahyuddin]
* Register alternative template engines using ActionMailer::Base.register_template_extension('haml'). #7534 [cwd, Josh Peek]
* Only load ActionController::UrlWriter if ActionController is present [Rick Olson]
* Make sure parsed emails recognized attachments nested inside multipart parts. #6714 [Jamis Buck]
* Allow mailer actions named send by using __send__ internally. #6467 [iGEL]
* Add assert_emails and assert_no_emails to test the number of emails delivered. #6479 [Jonathan Viney]
# Assert total number of emails delivered:
assert_emails 0
ContactMailer.deliver_contact
assert_emails 1
# Assert number of emails delivered within a block:
assert_emails 1 do
post :signup, :name => 'Jonathan'
end
*1.3.3* (March 12th, 2007)
* Depend on Action Pack 1.13.3
*1.3.2* (February 5th, 2007)
* Deprecate server_settings renaming it to smtp_settings, add sendmail_settings to allow you to override the arguments to and location of the sendmail executable. [Michael Koziarski]
*1.3.1* (January 16th, 2007)
* Depend on Action Pack 1.13.1
*1.3.0* (January 16th, 2007)
* Make mime version default to 1.0. closes #2323 [ror@andreas-s.net]
* Make sure quoted-printable text is decoded correctly when only portions of the text are encoded. closes #3154. [jon@siliconcircus.com]
* Make sure DOS newlines in quoted-printable text are normalized to unix newlines before unquoting. closes #4166 and #4452. [Jamis Buck]
* Fixed that iconv decoding should catch InvalidEncoding #3153 [jon@siliconcircus.com]
* Tighten rescue clauses. #5985 [james@grayproductions.net]
* Automatically included ActionController::UrlWriter, such that URL generation can happen within ActionMailer controllers. [David Heinemeier Hansson]
* Replace Reloadable with Reloadable::Deprecated. [Nicholas Seckar]
* Mailer template root applies to a class and its subclasses rather than acting globally. #5555 [somekool@gmail.com]
* Resolve action naming collision. #5520 [ssinghi@kreeti.com]
* ActionMailer::Base documentation rewrite. Closes #4991 [Kevin Clark, Marcel Molina Jr.]
* Replace alias method chaining with Module#alias_method_chain. [Marcel Molina Jr.]
* Replace Ruby's deprecated append_features in favor of included. [Marcel Molina Jr.]
* Correct spurious documentation example code which results in a SyntaxError. [Marcel Molina Jr.]
*1.2.1* (April 6th, 2006)
* Be part of Rails 1.1.1
*1.2.0* (March 27th, 2006)
* Nil charset caused subject line to be improperly quoted in implicitly multipart messages #2662 [ehalvorsen+rails@runbox.com]
* Parse content-type apart before using it so that sub-parts of the header can be set correctly #2918 [Jamis Buck]
* Make custom headers work in subparts #4034 [elan@bluemandrill.com]
* Template paths with dot chars in them no longer mess up implicit template selection for multipart messages #3332 [Chad Fowler]
* Make sure anything with content-disposition of "attachment" is passed to the attachment presenter when parsing an email body [Jamis Buck]
* Make sure TMail#attachments includes anything with content-disposition of "attachment", regardless of content-type [Jamis Buck]
*1.1.5* (December 13th, 2005)
* Become part of Rails 1.0
*1.1.4* (December 7th, 2005)
* Rename Version constant to VERSION. #2802 [Marcel Molina Jr.]
* Stricter matching for implicitly multipart filenames excludes files ending in unsupported extensions (such as foo.rhtml.bak) and without a two-part content type (such as foo.text.rhtml or foo.text.really.plain.rhtml). #2398 [Dave Burt <dave@burt.id.au>, Jeremy Kemper]
*1.1.3* (November 7th, 2005)
* Allow Mailers to have custom initialize methods that set default instance variables for all mail actions #2563 [mrj@bigpond.net.au]
*1.1.2* (October 26th, 2005)
* Upgraded to Action Pack 1.10.2
*1.1.1* (October 19th, 2005)
* Upgraded to Action Pack 1.10.1
*1.1.0* (October 16th, 2005)
* Update and extend documentation (rdoc)
* Minero Aoki made TMail available to Rails/ActionMailer under the MIT license (instead of LGPL) [RubyConf '05]
* Austin Ziegler made Text::Simple available to Rails/ActionMailer under a MIT-like licens [See rails ML, subject "Text::Format Licence Exception" on Oct 15, 2005]
* Fix vendor require paths to prevent files being required twice
* Don't add charset to content-type header for a part that contains subparts (for AOL compatibility) #2013 [John Long]
* Preserve underscores when unquoting message bodies #1930
* Encode multibyte characters correctly #1894
* Multipart messages specify a MIME-Version header automatically #2003 [John Long]
* Add a unified render method to ActionMailer (delegates to ActionView::Base#render)
* Move mailer initialization to a separate (overridable) method, so that subclasses may alter the various defaults #1727
* Look at content-location header (if available) to determine filename of attachments #1670
* ActionMailer::Base.deliver(email) had been accidentally removed, but was documented in the Rails book #1849
* Fix problem with sendmail delivery where headers should be delimited by \n characters instead of \r\n, which confuses some mail readers #1742 [Kent Sibilev]
*1.0.1* (11 July, 2005)
* Bind to Action Pack 1.9.1
*1.0.0* (6 July, 2005)
* Avoid adding nil header values #1392
* Better multipart support with implicit multipart/alternative and sorting of subparts [John Long]
* Allow for nested parts in multipart mails #1570 [Flurin Egger]
* Normalize line endings in outgoing mail bodies to "\n" #1536 [John Long]
* Allow template to be explicitly specified #1448 [tuxie@dekadance.se]
* Allow specific "multipart/xxx" content-type to be set on multipart messages #1412 [Flurin Egger]
* Unquoted @ characters in headers are now accepted in spite of RFC 822 #1206
* Helper support (borrowed from ActionPack)
* Silently ignore Errno::EINVAL errors when converting text.
* Don't cause an error when parsing an encoded attachment name #1340 [lon@speedymac.com]
* Nested multipart message parts are correctly processed in TMail::Mail#body
* BCC headers are removed when sending via SMTP #1402
* Added 'content_type' accessor, to allow content type to be set on a per-message basis. content_type defaults to "text/plain".
* Silently ignore Iconv::IllegalSequence errors when converting text #1341 [lon@speedymac.com]
* Support attachments and multipart messages.
* Added new accessors for the various mail properties.
* Fix to only perform the charset conversion if a 'from' and a 'to' charset are given (make no assumptions about what the charset was) #1276 [Jamis Buck]
* Fix attachments and content-type problems #1276 [Jamis Buck]
* Fixed the TMail#body method to look at the content-transfer-encoding header and unquote the body according to the rules it specifies #1265 [Jamis Buck]
* Added unquoting even if the iconv lib can't be loaded--in that case, only the charset conversion is skipped #1265 [Jamis Buck]
* Added automatic decoding of base64 bodies #1214 [Jamis Buck]
* Added that delivery errors are caught in a way so the mail is still returned whether the delivery was successful or not
* Fixed that email address like "Jamis Buck, M.D." <wild.medicine@example.net> would cause the quoter to generate emails resulting in "bad address" errors from the mail server #1220 [Jamis Buck]
*0.9.1* (20th April, 2005)
* Depend on Action Pack 1.8.1
*0.9.0* (19th April, 2005)
* Added that deliver_* will now return the email that was sent
* Added that quoting to UTF-8 only happens if the characters used are in that range #955 [Jamis Buck]
* Fixed quoting for all address headers, not just to #955 [Jamis Buck]
* Fixed unquoting of emails that doesn't have an explicit charset #1036 [wolfgang@stufenlos.net]
*0.8.1* (27th March, 2005)
* Fixed that if charset was found that the end of a mime part declaration TMail would throw an error #919 [lon@speedymac.com]
* Fixed that TMail::Unquoter would fail to recognize quoting method if it was in lowercase #919 [lon@speedymac.com]
* Fixed that TMail::Encoder would fail when it attempts to parse e-mail addresses which are encoded using something other than the messages encoding method #919 [lon@speedymac.com]
* Added rescue for missing iconv library and throws warnings if subject/body is called on a TMail object without it instead
*0.8.0* (22th March, 2005)
* Added framework support for processing incoming emails with an Action Mailer class. See example in README.
*0.7.1* (7th March, 2005)
* Bind to newest Action Pack (1.5.1)
*0.7.0* (24th February, 2005)
* Added support for charsets for both subject and body. The default charset is now UTF-8 #673 [Jamis Buck]. Examples:
def iso_charset(recipient)
@recipients = recipient
@subject = "testing iso charsets"
@from = "system@loudthinking.com"
@body = "Nothing to see here."
@charset = "iso-8859-1"
end
def unencoded_subject(recipient)
@recipients = recipient
@subject = "testing unencoded subject"
@from = "system@loudthinking.com"
@body = "Nothing to see here."
@encode_subject = false
@charset = "iso-8859-1"
end
*0.6.1* (January 18th, 2005)
* Fixed sending of emails to use Tmail#from not the deprecated Tmail#from_address
*0.6* (January 17th, 2005)
* Fixed that bcc and cc should be settable through @bcc and @cc -- not just @headers["Bcc"] and @headers["Cc"] #453 [Eric Hodel]
* Fixed Action Mailer to be "warnings safe" so you can run with ruby -w and not get framework warnings #453 [Eric Hodel]
*0.5*
* Added access to custom headers, like cc, bcc, and reply-to #268 [Andreas Schwarz]. Example:
def post_notification(recipients, post)
@recipients = recipients
@from = post.author.email_address_with_name
@headers["bcc"] = SYSTEM_ADMINISTRATOR_EMAIL
@headers["reply-to"] = "notifications@example.com"
@subject = "[#{post.account.name} #{post.title}]"
@body["post"] = post
end
*0.4* (5)
* Consolidated the server configuration options into Base#server_settings= and expanded that with controls for authentication and more [Marten]
NOTE: This is an API change that could potentially break your application if you used the old application form. Please do change!
* Added Base#deliveries as an accessor for an array of emails sent out through that ActionMailer class when using the :test delivery option. [Jeremy Kemper]
* Added Base#perform_deliveries= which can be set to false to turn off the actual delivery of the email through smtp or sendmail.
This is especially useful for functional testing that shouldn't send off real emails, but still trigger delivery_* methods.
* Added option to specify delivery method with Base#delivery_method=. Default is :smtp and :sendmail is currently the only other option.
Sendmail is assumed to be present at "/usr/sbin/sendmail" if that option is used. [Kent Sibilev]
* Dropped "include TMail" as it added to much baggage into the default namespace (like Version) [Chad Fowler]
*0.3*
* First release

26
actionmailer/CHANGELOG.md Normal file
View File

@@ -0,0 +1,26 @@
## Rails 3.1.8 (Aug 9, 2012)
* No changes.
## Rails 3.1.7 (Jul 26, 2012)
* No changes.
## Rails 3.1.6 (Jun 12, 2012)
* No changes.
## Rails 3.1.5 (May 31, 2012) ##
* Increase minimum version of mail.
## Rails 3.1.1 (October 7, 2011) ##
* No changes
## Rails 3.1.0 (August 30, 2011) ##
* No changes
Please check [3-0-stable](https://github.com/rails/rails/blob/3-0-stable/actionmailer/CHANGELOG) for previous changes.

View File

@@ -10,7 +10,7 @@ Mail gem. It provides a way to make emails using templates in the same
way that Action Controller renders views using templates.
Additionally, an Action Mailer class can be used to process incoming email,
such as allowing a weblog to accept new posts from an email (which could even
such as allowing a blog to accept new posts from an email (which could even
have been sent from a phone).
== Sending emails
@@ -59,6 +59,8 @@ generated would look like this:
Mr. david@loudthinking.com
Thank you for signing up!
In previous version of Rails you would call <tt>create_method_name</tt> and
<tt>deliver_method_name</tt>. Rails 3.0 has a much simpler interface, you
simply call the method and optionally call +deliver+ on the return value.
@@ -74,7 +76,7 @@ Or you can just chain the methods together like:
== Setting defaults
It is possible to set default values that will be used in every method in your Action Mailer class. To implement this functionality, you just call the public class method <tt>default</tt> which you get for free from ActionMailer::Base. This method accepts a Hash as the parameter. You can use any of the headers e-mail messages has, like <tt>:from</tt> as the key. You can also pass in a string as the key, like "Content-Type", but Action Mailer does this out of the box for you, so you wont need to worry about that. Finally it is also possible to pass in a Proc that will get evaluated when it is needed.
It is possible to set default values that will be used in every method in your Action Mailer class. To implement this functionality, you just call the public class method <tt>default</tt> which you get for free from ActionMailer::Base. This method accepts a Hash as the parameter. You can use any of the headers e-mail messages has, like <tt>:from</tt> as the key. You can also pass in a string as the key, like "Content-Type", but Action Mailer does this out of the box for you, so you won't need to worry about that. Finally it is also possible to pass in a Proc that will get evaluated when it is needed.
Note that every value you set with this method will get over written if you use the same key in your mailer method.
@@ -141,7 +143,7 @@ The latest version of Action Mailer can be installed with Rubygems:
Source code can be downloaded as part of the Rails project on GitHub
* https://github.com/rails/rails/tree/master/actionmailer/
* https://github.com/rails/rails/tree/master/actionmailer
== License

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env rake
require 'rake/testtask'
require 'rake/packagetask'
require 'rake/gempackagetask'
require 'rubygems/package_task'
desc "Default Task"
task :default => [ :test ]
@@ -24,7 +24,7 @@ end
spec = eval(File.read('actionmailer.gemspec'))
Rake::GemPackageTask.new(spec) do |p|
Gem::PackageTask.new(spec) do |p|
p.gem_spec = spec
end

View File

@@ -12,10 +12,10 @@ Gem::Specification.new do |s|
s.email = 'david@loudthinking.com'
s.homepage = 'http://www.rubyonrails.org'
s.files = Dir['CHANGELOG', 'README.rdoc', 'MIT-LICENSE', 'lib/**/*']
s.files = Dir['CHANGELOG.md', 'README.rdoc', 'MIT-LICENSE', 'lib/**/*']
s.require_path = 'lib'
s.requirements << 'none'
s.add_dependency('actionpack', version)
s.add_dependency('mail', '~> 2.3.0')
s.add_dependency('mail', '~> 2.5')
end

View File

@@ -58,7 +58,7 @@ module ActionMailer #:nodoc:
# will accept (any valid Email header including optional fields).
#
# The mail method, if not passed a block, will inspect your views and send all the views with
# the same name as the method, so the above action would send the +welcome.text.plain.erb+ view
# the same name as the method, so the above action would send the +welcome.text.erb+ view
# file as well as the +welcome.text.html.erb+ view file in a +multipart/alternative+ email.
#
# If you want to explicitly render only certain templates, pass a block:
@@ -89,7 +89,7 @@ module ActionMailer #:nodoc:
#
# To define a template to be used with a mailing, create an <tt>.erb</tt> file with the same
# name as the method in your mailer model. For example, in the mailer defined above, the template at
# <tt>app/views/notifier/signup_notification.text.plain.erb</tt> would be used to generate the email.
# <tt>app/views/notifier/welcome.text.erb</tt> would be used to generate the email.
#
# Variables defined in the model are accessible as instance variables in the view.
#
@@ -101,12 +101,12 @@ module ActionMailer #:nodoc:
# You can even use Action Pack helpers in these views. For example:
#
# You got a new note!
# <%= truncate(@note.body, 25) %>
# <%= truncate(@note.body, :length => 25) %>
#
# If you need to access the subject, from or the recipients in the view, you can do that through message object:
#
# You got a new note from <%= message.from %>!
# <%= truncate(@note.body, 25) %>
# <%= truncate(@note.body, :length => 25) %>
#
#
# = Generating URLs
@@ -123,8 +123,9 @@ module ActionMailer #:nodoc:
#
# <%= users_url(:host => "example.com") %>
#
# You want to avoid using the <tt>name_of_route_path</tt> form of named routes because it doesn't
# make sense to generate relative URLs in email messages.
# 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>
# option as a configuration option in <tt>config/application.rb</tt>:
@@ -152,12 +153,12 @@ 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 type. Each such detected template will be added as separate part to the message.
# 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:
# * signup_notification.text.plain.erb
# * signup_notification.text.erb
# * signup_notification.text.html.erb
# * signup_notification.text.xml.builder
# * signup_notification.text.yaml.erb
@@ -182,7 +183,7 @@ module ActionMailer #:nodoc:
# end
# end
#
# Which will (if it had both a <tt>welcome.text.plain.erb</tt> and <tt>welcome.text.html.erb</tt>
# Which will (if it had both a <tt>welcome.text.erb</tt> and <tt>welcome.text.html.erb</tt>
# template in the view directory), send a complete <tt>multipart/mixed</tt> email with two parts,
# the first part being a <tt>multipart/alternative</tt> with the text and HTML email parts inside,
# and the second being a <tt>application/pdf</tt> with a Base64 encoded copy of the file.pdf book
@@ -383,8 +384,8 @@ module ActionMailer #:nodoc:
Mail.register_observer(delivery_observer)
end
# Register an Inteceptor which will be called before mail is sent.
# Either a class or a string can be passed in as the Observer. If a string is passed in
# Register an Interceptor which will be called before mail is sent.
# Either a class or a string can be passed in as the Interceptor. If a string is passed in
# it will be <tt>constantize</tt>d.
def register_interceptor(interceptor)
delivery_interceptor = (interceptor.is_a?(String) ? interceptor.constantize : interceptor)

View File

@@ -1,7 +1,7 @@
require 'tmpdir'
module ActionMailer
# This modules handles everything related to the delivery, from registering new
# This module handles everything related to mail delivery, from registering new
# delivery methods to configuring the mail object to be sent.
module DeliveryMethods
extend ActiveSupport::Concern

View File

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

View File

@@ -514,7 +514,8 @@ class ActionMailerTest < Test::Unit::TestCase
assert_not_nil mail
mail, from, to = mail
assert_equal 'system@loudthinking.com', from.to_s
assert_equal ['root@loudthinking.com'], to
assert_equal 'system@loudthinking.com', from
end
def test_from_with_name_for_smtp
@@ -525,6 +526,7 @@ class ActionMailerTest < Test::Unit::TestCase
assert_not_nil mail
mail, from, to = mail
assert_equal ['root@loudthinking.com'], to
assert_equal 'system@loudthinking.com', from
end
@@ -979,7 +981,7 @@ EOF
TestMailer.delivery_method = :file
tmp_location = TestMailer.file_settings[:location]
result = TestMailer.cc_bcc(@recipient).deliver
TestMailer.cc_bcc(@recipient).deliver
assert File.exists?(tmp_location)
assert File.directory?(tmp_location)
assert File.exists?(File.join(tmp_location, @recipient))

File diff suppressed because it is too large Load Diff

390
actionpack/CHANGELOG.md Normal file
View File

@@ -0,0 +1,390 @@
## Rails 3.1.8 (Aug 9, 2012)
* There is an XSS vulnerability in the strip_tags helper in Ruby on Rails, the
helper doesn't correctly handle malformed html. As a result an attacker can
execute arbitrary javascript through the use of specially crafted malformed
html.
*Marek from Nethemba (www.nethemba.com) & Santiago Pastorino*
* When a "prompt" value is supplied to the `select_tag` helper, the "prompt" value is not escaped.
If untrusted data is not escaped, and is supplied as the prompt value, there is a potential for XSS attacks.
Vulnerable code will look something like this:
select_tag("name", options, :prompt => UNTRUSTED_INPUT)
*Santiago Pastorino*
## Rails 3.1.7 (Jul 26, 2012)
* Do not convert digest auth strings to symbols. CVE-2012-3424
## Rails 3.1.6 (Jun 12, 2012)
* nil is removed from array parameter values
CVE-2012-2694
## Rails 3.1.5 (May 31, 2012) ##
* Detect optional glob params when adding non-greedy regexp - closes #4817.
* Strip null bytes from Location header
* Return the same session data object when setting session id
* Avoid inspecting the whole route set, closes #1525
* Strip [nil] from parameters hash. Thanks to Ben Murphy for reporting this!
CVE-2012-2660
## Rails 3.1.4 (unreleased) ##
* :subdomain can now be specified with a value of false in url_for,
allowing for subdomain(s) removal from the host during link generation. GH #4083
*Arun Agrawal*
* Skip assets group in Gemfile and all assets configurations options
when the application is generated with --skip-sprockets option.
*Guillermo Iguaran*
* Use ProcessedAsset#pathname in Sprockets helpers when debugging is on. Closes #3333 #3348 #3361.
*Guillermo Iguaran*
* Allow to use asset_path on named_routes aliasing RailsHelper's
asset_path to path_to_asset *Adrian Pike*
* Assets should use the request protocol by default or default to relative if no request is available *Jonathan del Strother*
## Rails 3.1.3 (November 20, 2011) ##
* Downgrade sprockets to ~> 2.0.3. Using 2.1.0 caused regressions.
* Fix using `tranlate` helper with a html translation which uses the `:count` option for
pluralization.
*Jon Leighton*
## Rails 3.1.2 (November 18, 2011) ##
* Fix XSS security vulnerability in the `translate` helper method. When using interpolation
in combination with HTML-safe translations, the interpolated input would not get HTML
escaped. *GH 3664*
Before:
translate('foo_html', :something => '<script>') # => "...<script>..."
After:
translate('foo_html', :something => '<script>') # => "...&lt;script&gt;..."
*Sergey Nartimov*
* Upgrade sprockets dependency to ~> 2.1.0
* Ensure that the format isn't applied twice to the cache key, else it becomes impossible
to target with expire_action.
*Christopher Meiklejohn*
* Swallow error when can't unmarshall object from session.
*Bruno Zanchet*
* Implement a workaround for a bug in ruby-1.9.3p0 where 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 details of the bug.
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.
*Jon Leighton*
* Ensure users upgrading from 3.0.x to 3.1.x will properly upgrade their flash object in session (issues #3298 and #2509)
## Rails 3.1.1 (October 7, 2011) ##
* stylesheet_link_tag('/stylesheets/application') and similar helpers doesn't
throw Sprockets::FileOutsidePaths exception anymore *Santiago Pastorino*
* Ensure default_asset_host_protocol is respected, closes #2980. *José Valim*
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:
https://github.com/rails/rails/commit/5df72a238e9fcb18daf6ab6e6dc9051c9106d7bb#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".
*Ben Woosley*
* Update to 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
*Brendan Ribera*
* Ensure that enhancements to assets:precompile task are only run once *Sam Pohlenz*
* TestCase should respect the view_assigns API instead of pulling variables on
its own. *José Valim*
* javascript_path and stylesheet_path now refer to /assets if asset pipelining
is on. *Santiago Pastorino*
* button_to support form option. Now you're able to pass for example
'data-type' => 'json'. *ihower*
* image_path and image_tag should use /assets if asset pipelining is turned
on. Closes #3126 *Santiago Pastorino and christos*
* Avoid use of existing precompiled assets during rake assets:precompile run.
Closes #3119 *Guillermo Iguaran*
* Copy assets to nondigested filenames too *Santiago Pastorino*
* Give precedence to `config.digest = false` over the existence of
manifest.yml asset digests *christos*
* escape options for the stylesheet_link_tag method *Alexey Vakhov*
* Re-launch assets:precompile task using (Rake.)ruby instead of Kernel.exec so
it works on Windows *cablegram*
* env var passed to process shouldn't be modified in process method. [Santiago
Pastorino]
* `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. *José Valim*
* Sprockets uses config.assets.prefix for asset_path *asee*
* FileStore key_file_path properly limit filenames to 255 characters. *phuibonhoa*
* Fix Hash#to_query edge case with html_safe strings. *brainopia*
* Allow asset tag helper methods to accept :digest => false option in order to completely avoid the digest generation.
Useful for linking assets from static html files or from emails when the user
could probably look at an older html email with an older asset. *Santiago Pastorino*
* Don't mount Sprockets server at config.assets.prefix if config.assets.compile is false. *Mark J. Titorenko*
* Set relative url root in assets when controller isn't available for Sprockets (eg. Sass files using asset_path). Fixes #2435 *Guillermo Iguaran*
* Fix basic auth credential generation to not make newlines. GH #2882
* Fixed the behavior of asset pipeline when config.assets.digest and config.assets.compile are false and requested asset isn't precompiled.
Before the requested asset were compiled anyway ignoring that the config.assets.compile flag is false. *Guillermo Iguaran*
* CookieJar is now Enumerable. Fixes #2795
* Fixed AssetNotPrecompiled error raised when rake assets:precompile is compiling certain .erb files. See GH #2763 #2765 #2805 *Guillermo Iguaran*
* Manifest is correctly placed in assets path when default assets prefix is changed. Fixes #2776 *Guillermo Iguaran*
* Fixed stylesheet_link_tag and javascript_include_tag to respect additional options passed by the users when debug is on. *Guillermo Iguaran*
* Fix ActiveRecord#exists? when passsed a nil value
* Fix assert_select_email to work on multipart and non-multipart emails as the method stopped working correctly in Rails 3.x due to changes in the new mail gem.
## Rails 3.1.0 (August 30, 2011) ##
* Param values are `paramified` in controller tests. *David Chelimsky*
* x_sendfile_header now defaults to nil and config/environments/production.rb doesn't set a particular value for it. This allows servers to set it through X-Sendfile-Type. *Santiago Pastorino*
* The submit form helper does not generate an id "object_name_id" anymore. *fbrusatti*
* Make sure respond_with with :js tries to render a template in all cases *José Valim*
* json_escape will now return a SafeBuffer string if it receives SafeBuffer string *tenderlove*
* Make sure escape_js returns SafeBuffer string if it receives SafeBuffer string *Prem Sichanugrist*
* Fix escape_js to work correctly with the new SafeBuffer restriction *Paul Gallagher*
* Brought back alternative convention for namespaced models in i18n *thoefer*
Now the key can be either "namespace.model" or "namespace/model" until further deprecation.
* It is prohibited to perform a in-place SafeBuffer mutation *tenderlove*
The old behavior of SafeBuffer allowed you to mutate string in place via
method like `sub!`. These methods can add unsafe strings to a safe buffer,
and the safe buffer will continue to be marked as safe.
An example problem would be something like this:
<%= link_to('hello world', @user).sub!(/hello/, params[:xss]) %>
In the above example, an untrusted string (`params[:xss]`) is added to the
safe buffer returned by `link_to`, and the untrusted content is successfully
sent to the client without being escaped. To prevent this from happening
`sub!` and other similar methods will now raise an exception when they are called on a safe buffer.
In addition to the in-place versions, some of the versions of these methods which return a copy of the string will incorrectly mark strings as safe. For example:
<%= link_to('hello world', @user).sub(/hello/, params[:xss]) %>
The new versions will now ensure that *all* strings returned by these methods on safe buffers are marked unsafe.
You can read more about this change in http://groups.google.com/group/rubyonrails-security/browse_thread/thread/2e516e7acc96c4fb
* Warn if we cannot verify CSRF token authenticity *José Valim*
* Allow AM/PM format in datetime selectors *Aditya Sanghi*
* Only show dump of regular env methods on exception screen (not all the rack crap) *DHH*
* auto_link has been removed with no replacement. If you still use auto_link
please install the rails_autolink gem:
http://github.com/tenderlove/rails_autolink
*tenderlove*
* Added streaming support, you can enable it with: *José Valim*
class PostsController < ActionController::Base
stream :only => :index
end
Please read the docs at `ActionController::Streaming` for more information.
* Added `ActionDispatch::Request.ignore_accept_header` to ignore accept headers and only consider the format given as parameter *José Valim*
* Created `ActionView::Renderer` and specified an API for `ActionView::Context`, check those objects for more information *José Valim*
* Added `ActionController::ParamsWrapper` to wrap parameters into a nested hash, and will be turned on for JSON request in new applications by default *Prem Sichanugrist*
This can be customized by setting `ActionController::Base.wrap_parameters` in `config/initializer/wrap_parameters.rb`
* RJS has been extracted out to a gem. *fxn*
* Implicit actions named not_implemented can be rendered. *Santiago Pastorino*
* Wildcard route will always match the optional format segment by default. *Prem Sichanugrist*
For example if you have this route:
map '*pages' => 'pages#show'
by requesting '/foo/bar.json', your `params[:pages]` will be equals to "foo/bar" with the request format of JSON. If you want the old 3.0.x behavior back, you could supply `:format => false` like this:
map '*pages' => 'pages#show', :format => false
* Added Base.http_basic_authenticate_with to do simple http basic authentication with a single class method call *DHH*
class PostsController < ApplicationController
USER_NAME, PASSWORD = "dhh", "secret"
before_filter :authenticate, :except => [ :index ]
def index
render :text => "Everyone can see me!"
end
def edit
render :text => "I'm only accessible if you know the password"
end
private
def authenticate
authenticate_or_request_with_http_basic do |user_name, password|
user_name == USER_NAME && password == PASSWORD
end
end
end
..can now be written as
class PostsController < ApplicationController
http_basic_authenticate_with :name => "dhh", :password => "secret", :except => :index
def index
render :text => "Everyone can see me!"
end
def edit
render :text => "I'm only accessible if you know the password"
end
end
* Allow you to add `force_ssl` into controller to force browser to transfer data via HTTPS protocol on that particular controller. You can also specify `:only` or `:except` to specific it to particular action. *DHH and Prem Sichanugrist*
* Allow FormHelper#form_for to specify the :method as a direct option instead of through the :html hash *DHH*
form_for(@post, remote: true, method: :delete) instead of form_for(@post, remote: true, html: { method: :delete })
* Make JavaScriptHelper#j() an alias for JavaScriptHelper#escape_javascript() -- note this then supersedes the Object#j() method that the JSON gem adds within templates using the JavaScriptHelper *DHH*
* Sensitive query string parameters (specified in config.filter_parameters) will now be filtered out from the request paths in the log file. *Prem Sichanugrist, fxn*
* URL parameters which return false for to_param now appear in the query string (previously they were removed) *Andrew White*
* URL parameters which return nil for to_param are now removed from the query string *Andrew White*
* ActionDispatch::MiddlewareStack now uses composition over inheritance. It is
no longer an array which means there may be methods missing that were not
tested.
* Add an :authenticity_token option to form_tag for custom handling or to omit the token (pass :authenticity_token => false). *Jakub Kuźma, Igor Wiedler*
* HTML5 button_tag helper. *Rizwan Reza*
* Template lookup now searches further up in the inheritance chain. *Artemave*
* Brought back config.action_view.cache_template_loading, which allows to decide whether templates should be cached or not. *Piotr Sarnacki*
* url_for and named url helpers now accept :subdomain and :domain as options, *Josh Kalderimis*
* The redirect route method now also accepts a hash of options which will only change the parts of the url in question, or an object which responds to call, allowing for redirects to be reused (check the documentation for examples). *Josh Kalderimis*
* Added config.action_controller.include_all_helpers. By default 'helper :all' is done in ActionController::Base, which includes all the helpers by default. Setting include_all_helpers to false will result in including only application_helper and helper corresponding to controller (like foo_helper for foo_controller). *Piotr Sarnacki*
* Added a convenience idiom to generate HTML5 data-* attributes in tag helpers from a :data hash of options:
tag("div", :data => {:name => 'Stephen', :city_state => %w(Chicago IL)})
# => <div data-name="Stephen" data-city-state="[&quot;Chicago&quot;,&quot;IL&quot;]" />
Keys are dasherized. Values are JSON-encoded, except for strings and symbols. *Stephen Celis*
* Deprecate old template handler API. The new API simply requires a template handler to respond to call. *José Valim*
* :rhtml and :rxml were finally removed as template handlers. *José Valim*
* Moved etag responsibility from ActionDispatch::Response to the middleware stack. *José Valim*
* Rely on Rack::Session stores API for more compatibility across the Ruby world. This is backwards incompatible since Rack::Session expects #get_session to accept 4 arguments and requires #destroy_session instead of simply #destroy. *José Valim*
* file_field automatically adds :multipart => true to the enclosing form. *Santiago Pastorino*
* Renames csrf_meta_tag -> csrf_meta_tags, and aliases csrf_meta_tag for backwards compatibility. *fxn*
* Add Rack::Cache to the default stack. Create a Rails store that delegates to the Rails cache, so by default, whatever caching layer you are using will be used for HTTP caching. Note that Rack::Cache will be used if you use #expires_in, #fresh_when or #stale with :public => true. Otherwise, the caching rules will apply to the browser only. *Yehuda Katz, Carl Lerche*
Please check [3-0-stable](https://github.com/rails/rails/blob/3-0-stable/actionpack/CHANGELOG) for previous changes.

View File

@@ -322,7 +322,7 @@ The latest version of Action Pack can be installed with Rubygems:
Source code can be downloaded as part of the Rails project on GitHub
* https://github.com/rails/rails/tree/master/actionpack/
* https://github.com/rails/rails/tree/master/actionpack
== License

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env rake
require 'rake/testtask'
require 'rake/packagetask'
require 'rake/gempackagetask'
require 'rubygems/package_task'
desc "Default Task"
task :default => :test
@@ -36,7 +36,7 @@ end
spec = eval(File.read('actionpack.gemspec'))
Rake::GemPackageTask.new(spec) do |p|
Gem::PackageTask.new(spec) do |p|
p.gem_spec = spec
end

View File

@@ -12,19 +12,20 @@ Gem::Specification.new do |s|
s.email = 'david@loudthinking.com'
s.homepage = 'http://www.rubyonrails.org'
s.files = Dir['CHANGELOG', 'README.rdoc', 'MIT-LICENSE', 'lib/**/*']
s.files = Dir['CHANGELOG.md', 'README.rdoc', 'MIT-LICENSE', 'lib/**/*']
s.require_path = 'lib'
s.requirements << 'none'
s.add_dependency('activesupport', version)
s.add_dependency('activemodel', version)
s.add_dependency('rack-cache', '~> 1.0.1')
s.add_dependency('builder', '~> 3.0.0')
s.add_dependency('i18n', '~> 0.6')
s.add_dependency('rack', '~> 1.3.0.beta2')
s.add_dependency('rack-test', '~> 0.6.0')
s.add_dependency('rack-mount', '~> 0.8.1')
s.add_dependency('sprockets', '~> 2.0.0.beta.8')
s.add_dependency('tzinfo', '~> 0.3.27')
s.add_dependency('erubis', '~> 2.7.0')
s.add_dependency('activesupport', version)
s.add_dependency('activemodel', version)
s.add_dependency('rack-cache', '~> 1.2')
s.add_dependency('builder', '~> 3.2')
s.add_dependency('i18n', '~> 0.6')
s.add_dependency('rack', '~> 1.4.1')
s.add_dependency('rack-test', '~> 0.6.1')
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')
end

View File

@@ -3,7 +3,8 @@ module AbstractController
extend ActiveSupport::Concern
included do
config_accessor :asset_host, :asset_path, :assets_dir, :javascripts_dir, :stylesheets_dir, :use_sprockets
config_accessor :asset_host, :asset_path, :assets_dir, :javascripts_dir,
:stylesheets_dir, :default_asset_host_protocol
end
end
end

View File

@@ -81,11 +81,12 @@ module AbstractController
# class EmployeeController < BankController
# layout nil
#
# The InformationController uses "bank_standard" inherited from the BankController, the VaultController overwrites
# and picks the layout dynamically, and the EmployeeController doesn't want to use a layout at all.
#
# The TellerController uses +teller.html.erb+, and TillController inherits that layout and
# uses it as well.
# 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 EmployeeController does not use a layout at all.
#
# == Types of layouts
#
@@ -138,8 +139,8 @@ module AbstractController
#
# end
#
# This will assign "weblog_standard" as the WeblogController's layout except for the +rss+ action, which will not wrap a layout
# around the rendered view.
# This will assign "weblog_standard" as the WeblogController's layout for all actions except for the +rss+ action, which will
# be rendered directly, without wrapping a layout around the rendered view.
#
# Both the <tt>:only</tt> and <tt>:except</tt> condition can accept an arbitrary number of method references, so
# #<tt>:except => [ :rss, :text_only ]</tt> is valid, as is <tt>:except => :rss</tt>.
@@ -158,7 +159,7 @@ module AbstractController
# end
# end
#
# This will render the help action with the "help" layout instead of the controller-wide "weblog_standard" layout.
# This will override the controller-wide "weblog_standard" layout, and will render the help action with the "help" layout instead.
module Layouts
extend ActiveSupport::Concern
@@ -166,6 +167,7 @@ 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
@@ -211,7 +213,7 @@ module AbstractController
# true:: raise an ArgumentError
#
# ==== Parameters
# * <tt>String, Symbol, false</tt> - The layout to use.
# * <tt>layout</tt> - The layout to use.
#
# ==== Options (conditions)
# * :only - A list of actions to apply this layout to.
@@ -308,14 +310,10 @@ module AbstractController
# This will be overwritten by _write_layout_method
def _layout; end
# Determine the layout for a given name and details, taking into account
# the name type.
# Determine the layout for a given name, taking into account the name type.
#
# ==== Parameters
# * <tt>name</tt> - The name of the template
# * <tt>details</tt> - A list of details to restrict
# the lookup to. By default, layout lookup is limited to the
# formats specified for the current request.
def _layout_for_option(name)
case name
when String then name
@@ -328,15 +326,12 @@ module AbstractController
end
end
# Returns the default layout for this controller and a given set of details.
# Returns the default layout for this controller.
# Optionally raises an exception if the layout could not be found.
#
# ==== Parameters
# * <tt>details</tt> - A list of details to restrict the search by. This
# might include details like the format or locale of the template.
# * <tt>require_layout</tt> - If this is true, raise an ArgumentError
# with details about the fact that the exception could not be
# found (defaults to false)
# * <tt>require_layout</tt> - If set to true and layout is not found,
# an ArgumentError exception is raised (defaults to false)
#
# ==== Returns
# * <tt>template</tt> - The template object for the default layout (or nil)

View File

@@ -120,8 +120,6 @@ module AbstractController
view_renderer.render(view_context, options)
end
private
DEFAULT_PROTECTED_INSTANCE_VARIABLES = %w(
@_action_name @_response_body @_formats @_prefixes @_config
@_view_context_class @_view_renderer @_lookup_context
@@ -139,6 +137,8 @@ module AbstractController
hash
end
private
# Normalize args and options.
# :api: private
def _normalize_render(*args, &block)

View File

@@ -37,12 +37,13 @@ module ActionController
autoload :UrlFor
end
autoload :Integration, 'action_controller/deprecated/integration_test'
autoload :IntegrationTest, 'action_controller/deprecated/integration_test'
autoload :PerformanceTest, 'action_controller/deprecated/performance_test'
autoload :UrlWriter, 'action_controller/deprecated'
autoload :Routing, 'action_controller/deprecated'
autoload :TestCase, 'action_controller/test_case'
autoload :Integration, 'action_controller/deprecated/integration_test'
autoload :IntegrationTest, 'action_controller/deprecated/integration_test'
autoload :PerformanceTest, 'action_controller/deprecated/performance_test'
autoload :UrlWriter, 'action_controller/deprecated'
autoload :Routing, 'action_controller/deprecated'
autoload :TestCase, 'action_controller/test_case'
autoload :TemplateAssertions, 'action_controller/test_case'
eager_autoload do
autoload :RecordIdentifier

View File

@@ -31,7 +31,7 @@ module ActionController
# "302 Moved" HTTP response that takes the user to the index action.
#
# These two methods represent the two basic action archetypes used in Action Controllers. Get-and-show and do-and-redirect.
# Most actions are variations of these themes.
# Most actions are variations on these themes.
#
# == Requests
#
@@ -50,7 +50,7 @@ module ActionController
#
# All request parameters, whether they come from a GET or POST request, or from the URL, are available through the params method
# which returns a hash. For example, an action that was performed through <tt>/posts?category=All&limit=5</tt> will include
# <tt>{ "category" => "All", "limit" => 5 }</tt> in params.
# <tt>{ "category" => "All", "limit" => "5" }</tt> in params.
#
# It's also possible to construct multi-dimensional parameter hashes by specifying keys using brackets, such as:
#
@@ -63,7 +63,7 @@ module ActionController
#
# == Sessions
#
# Sessions allows you to store objects in between requests. This is useful for objects that are not yet ready to be persisted,
# Sessions allow you to store objects in between requests. This is useful for objects that are not yet ready to be persisted,
# such as a Signup object constructed in a multi-paged process, or objects that don't change much and are needed all the time, such
# as a User object for a system that requires login. The session should not be used, however, as a cache for objects where it's likely
# they could be changed unknowingly. It's usually too much work to keep it all synchronized -- something databases already excel at.
@@ -116,8 +116,8 @@ module ActionController
#
# Title: <%= @post.title %>
#
# You don't have to rely on the automated rendering. Especially actions that could result in the rendering of different templates will use
# the manual rendering methods:
# You don't have to rely on the automated rendering. For example, actions that could result in the rendering of different templates
# will use the manual rendering methods:
#
# def search
# @results = Search.find(params[:query])
@@ -132,9 +132,9 @@ module ActionController
#
# == Redirects
#
# Redirects are used to move from one action to another. For example, after a <tt>create</tt> action, which stores a blog entry to a database,
# we might like to show the user the new entry. Because we're following good DRY principles (Don't Repeat Yourself), we're going to reuse (and redirect to)
# a <tt>show</tt> action that we'll assume has already been created. The code might look like this:
# Redirects are used to move from one action to another. For example, after a <tt>create</tt> action, which stores a blog entry to the
# database, we might like to show the user the new entry. Because we're following good DRY principles (Don't Repeat Yourself), we're
# going to reuse (and redirect to) a <tt>show</tt> action that we'll assume has already been created. The code might look like this:
#
# def create
# @entry = Entry.new(params[:entry])
@@ -146,7 +146,9 @@ module ActionController
# end
# end
#
# In this case, after saving our new entry to the database, the user is redirected to the <tt>show</tt> method which is then executed.
# In this case, after saving our new entry to the database, the user is redirected to the <tt>show</tt> method, which is then executed.
# Note that this is an external HTTP-level redirection which will cause the browser to make a second request (a GET to the show action),
# and not some internal re-routing which calls both "create" and then "show" within one request.
#
# Learn more about <tt>redirect_to</tt> and what options you have in ActionController::Redirecting.
#
@@ -210,16 +212,16 @@ module ActionController
# also include them at the bottom.
AbstractController::Callbacks,
# Append rescue at the bottom to wrap as much as possible.
Rescue,
# Add instrumentations hooks at the bottom, to ensure they instrument
# all the methods properly.
Instrumentation,
# Params wrapper should come before instrumentation so they are
# properly showed in logs
ParamsWrapper,
# The same with rescue, append it at the end to wrap as much as possible.
Rescue
ParamsWrapper
]
MODULES.each do |mod|

View File

@@ -175,7 +175,7 @@ module ActionController #:nodoc:
private
def normalize!(path)
path << 'index' if path[-1] == ?/
path << ".#{extension}" if extension and !path.ends_with?(extension)
path << ".#{extension}" if extension and !path.split('?').first.ends_with?(".#{extension}")
URI.parser.unescape(path)
end
end

View File

@@ -61,6 +61,7 @@ module ActionController #:nodoc:
end
def after(controller)
self.controller = controller
callback(:after) if controller.perform_caching
# Clean up, so that the controller can be collected after this request
self.controller = nil

View File

@@ -16,7 +16,7 @@ module ActionController #:nodoc:
protected
# Sends the file. This uses a server-appropriate method (such as X-Sendfile)
# via the Rack::Sendfile middleware. The header to use is set via
# config.action_dispatch.x_sendfile_header, and defaults to "X-Sendfile".
# config.action_dispatch.x_sendfile_header.
# Your server can also configure this for you by setting the X-Sendfile-Type header.
#
# Be careful to sanitize the path parameter if it is coming from a web
@@ -30,7 +30,7 @@ module ActionController #:nodoc:
# 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 OK'.
# * <tt>:status</tt> - specifies the status code to send with the response. Defaults to 200.
# * <tt>:url_based_filename</tt> - set to +true+ if you want the browser guess the filename from
# the URL, which is necessary for i18n filenames on certain browsers
# (setting <tt>:filename</tt> overrides this option).
@@ -86,7 +86,7 @@ module ActionController #:nodoc:
# 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 OK'.
# * <tt>:status</tt> - specifies the status code to send with the response. Defaults to 200.
#
# Generic data download:
#

View File

@@ -9,6 +9,8 @@ module ActionController
#
# head :created, :location => person_path(@person)
#
# head :created, :location => @person
#
# It can also be used to return exceptional conditions:
#
# return head(:method_not_allowed) unless request.post?

View File

@@ -106,7 +106,7 @@ module ActionController
module ControllerMethods
extend ActiveSupport::Concern
module ClassMethods
def http_basic_authenticate_with(options = {})
before_filter(options.except(:name, :password, :realm)) do
@@ -116,7 +116,7 @@ module ActionController
end
end
end
def authenticate_or_request_with_http_basic(realm = "Application", &login_procedure)
authenticate_with_http_basic(&login_procedure) || request_http_basic_authentication(realm)
end
@@ -145,7 +145,7 @@ module ActionController
end
def encode_credentials(user_name, password)
"Basic #{ActiveSupport::Base64.encode64("#{user_name}:#{password}")}"
"Basic #{ActiveSupport::Base64.encode64s("#{user_name}:#{password}")}"
end
def authentication_request(controller, realm)
@@ -192,12 +192,15 @@ module ActionController
return false unless password
method = request.env['rack.methodoverride.original_method'] || request.env['REQUEST_METHOD']
uri = credentials[:uri][0,1] == '/' ? request.fullpath : request.url
uri = credentials[:uri][0,1] == '/' ? request.original_fullpath : request.original_url
[true, false].any? do |password_is_ha1|
expected = expected_response(method, uri, credentials, password, password_is_ha1)
expected == credentials[:response]
end
[true, false].any? do |trailing_question_mark|
[true, false].any? do |password_is_ha1|
_uri = trailing_question_mark ? uri + "?" : uri
expected = expected_response(method, _uri, credentials, password, password_is_ha1)
expected == credentials[:response]
end
end
end
end
@@ -224,9 +227,9 @@ module ActionController
end
def decode_credentials(header)
Hash[header.to_s.gsub(/^Digest\s+/,'').split(',').map do |pair|
HashWithIndifferentAccess[header.to_s.gsub(/^Digest\s+/,'').split(',').map do |pair|
key, value = pair.split('=', 2)
[key.strip.to_sym, value.to_s.gsub(/^"|"$/,'').gsub(/'/, '')]
[key.strip, value.to_s.gsub(/^"|"$/,'').delete('\'')]
end]
end

View File

@@ -19,7 +19,7 @@ module ActionController
:controller => self.class.name,
:action => self.action_name,
:params => request.filtered_parameters,
:format => request.format.ref,
:format => request.format.try(:ref),
:method => request.method,
:path => (request.fullpath rescue "unknown")
}

View File

@@ -6,31 +6,30 @@ require 'active_support/core_ext/module/anonymous'
require 'action_dispatch/http/mime_types'
module ActionController
# Wraps parameters hash into nested hash. This will allow client to submit
# POST request without having to specify a root element in it.
# Wraps the parameters hash into a nested hash. This will allow clients to submit
# POST requests without having to specify any root elements.
#
# By default this functionality won't be enabled. You can enable
# it globally by setting +ActionController::Base.wrap_parameters+:
#
# ActionController::Base.wrap_parameters = [:json]
# This functionality is enabled in +config/initializers/wrap_parameters.rb+
# and can be customized. If you are upgrading to \Rails 3.1, this file will
# need to be created for the functionality to be enabled.
#
# You could also turn it on per controller by setting the format array to
# non-empty array:
# a non-empty array:
#
# class UsersController < ApplicationController
# wrap_parameters :format => [:json, :xml]
# end
#
# If you enable +ParamsWrapper+ for +:json+ format. Instead of having to
# If you enable +ParamsWrapper+ for +:json+ format, instead of having to
# send JSON parameters like this:
#
# {"user": {"name": "Konata"}}
#
# You can now just send a parameters like this:
# You can send parameters like this:
#
# {"name": "Konata"}
#
# And it will be wrapped into a nested hash with the key name matching
# And it will be wrapped into a nested hash with the key name matching the
# controller's name. For example, if you're posting to +UsersController+,
# your new +params+ hash will look like this:
#
@@ -64,7 +63,7 @@ module ActionController
# end
#
# will try to check if +Admin::User+ or +User+ model exists, and use it to
# determine the wrapper key respectively. If both of the model doesn't exists,
# determine the wrapper key respectively. If both models don't exist,
# it will then fallback to use +user+ as the key.
module ParamsWrapper
extend ActiveSupport::Concern
@@ -82,20 +81,20 @@ module ActionController
#
# ==== Examples
# wrap_parameters :format => :xml
# # enables the parmeter wrapper for XML format
# # enables the parameter wrapper for XML format
#
# wrap_parameters :person
# # wraps parameters into +params[:person]+ hash
#
# wrap_parameters Person
# # wraps parameters by determine the wrapper key from Person class
# # wraps parameters by determining the wrapper key from Person class
# (+person+, in this case) and the list of attribute names
#
# wrap_parameters :include => [:username, :title]
# # wraps only +:username+ and +:title+ attributes from parameters.
#
# wrap_parameters false
# # disable parameters wrapping for this controller altogether.
# # disables parameters wrapping for this controller altogether.
#
# ==== Options
# * <tt>:format</tt> - The list of formats in which the parameters wrapper

View File

@@ -43,8 +43,9 @@ module ActionController
#
# The status code can either be a standard {HTTP Status code}[http://www.iana.org/assignments/http-status-codes] as an
# 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.
#
# It is also possible to assign a flash message as part of the redirection. There are two special accessors for commonly used the flash names
# 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.
#
# Examples:
@@ -91,7 +92,7 @@ module ActionController
_compute_redirect_to_location options.call
else
url_for(options)
end.gsub(/[\r\n]/, '')
end.gsub(/[\0\r\n]/, '')
end
end
end

View File

@@ -7,17 +7,16 @@ module ActionController #:nodoc:
# Controller actions are protected from Cross-Site Request Forgery (CSRF) attacks
# by including a token in the rendered html for your application. This token is
# stored as a random string in the session, to which an attacker does not have
# access. When a request reaches your application, \Rails then verifies the received
# token with the token in the session. Only HTML and javascript requests are checked,
# access. When a request reaches your application, \Rails verifies the received
# token with the token in the session. Only HTML and JavaScript requests are checked,
# so this will not protect your XML API (presumably you'll have a different
# authentication scheme there anyway). Also, GET requests are not protected as these
# should be idempotent.
#
# CSRF protection is turned on with the <tt>protect_from_forgery</tt> method,
# which will check the token and raise an ActionController::InvalidAuthenticityToken
# if it doesn't match what was expected. A call to this method is generated for new
# \Rails applications by default. You can customize the error message by editing
# public/422.html.
# which checks the token and resets the session if it doesn't match what was expected.
# A call to this method is generated for new \Rails applications by default.
# You can customize the error message by editing public/422.html.
#
# The token parameter is named <tt>authenticity_token</tt> by default. The name and
# value of this token must be added to every layout that renders forms by including
@@ -63,7 +62,7 @@ module ActionController #:nodoc:
#
# Valid Options:
#
# * <tt>:only/:except</tt> - Passed to the <tt>before_filter</tt> call. Set which actions are verified.
# * <tt>:only/:except</tt> - Passed to the <tt>before_filter</tt> call. Set which actions are verified.
def protect_from_forgery(options = {})
self.request_forgery_protection_token ||= :authenticity_token
prepend_before_filter :verify_authenticity_token, options
@@ -71,7 +70,7 @@ module ActionController #:nodoc:
end
protected
# The actual before_filter that is used. Modify this to change how you handle unverified requests.
# The actual before_filter that is used. Modify this to change how you handle unverified requests.
def verify_authenticity_token
unless verified_request?
logger.debug "WARNING: Can't verify CSRF token authenticity" if logger
@@ -79,11 +78,13 @@ module ActionController #:nodoc:
end
end
# This is the method that defines the application behavior when a request is found to be unverified.
# By default, \Rails resets the session when it finds an unverified request.
def handle_unverified_request
reset_session
end
# Returns true or false if a request is verified. Checks:
# Returns true or false if a request is verified. Checks:
#
# * is it a GET request? Gets should be safe and idempotent
# * Does the form_authenticity_token match the given token value from the params?
@@ -96,7 +97,7 @@ module ActionController #:nodoc:
# Sets the token value for the current session.
def form_authenticity_token
session[:_csrf_token] ||= ActiveSupport::SecureRandom.base64(32)
session[:_csrf_token] ||= SecureRandom.base64(32)
end
# The form's authenticity parameter. Override to provide your own.

View File

@@ -162,6 +162,11 @@ module ActionController #:nodoc:
navigation_behavior(e)
end
# to_js simply tries to render a template. If no template is found, raises the error.
def to_js
default_render
end
# All other formats follow the procedure below. First we try to render a
# template, if the template is not available, we verify if the resource
# responds to :to_format and display it.
@@ -267,7 +272,7 @@ module ActionController #:nodoc:
# Check whether resource needs a specific definition of empty resource to be valid
#
def has_empty_resource_definition?
respond_to?("empty_#{format}_resource")
respond_to?("empty_#{format}_resource", true)
end
# Delegate to proper empty resource method

View File

@@ -24,20 +24,8 @@ module ActionController #:nodoc:
#
# == Examples
#
# Streaming can be added to a controller easily, all you need to do is
# call +stream+ in the controller class:
#
# class PostsController
# stream
# end
#
# The +stream+ method accepts the same options as +before_filter+ and friends:
#
# class PostsController
# stream :only => :index
# end
#
# You can also selectively turn on streaming for specific actions:
# Streaming can be added to a given template easily, all you need to do is
# to pass the :stream option.
#
# class PostsController
# def index
@@ -72,6 +60,9 @@ module ActionController #:nodoc:
# render :stream => true
# end
#
# Notice that :stream only works with templates. Rendering :json
# or :xml with :stream won't work.
#
# == Communication between layout and template
#
# When streaming, rendering happens top-down instead of inside-out.
@@ -215,6 +206,7 @@ module ActionController #:nodoc:
# 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
@@ -260,4 +252,3 @@ module ActionController #:nodoc:
end
end
end

View File

@@ -4,6 +4,11 @@ module ActionController
include RackDelegation
def recycle!
@_url_options = nil
end
# TODO: Clean this up
def process_with_new_base_test(request, response)
@_request = request

View File

@@ -18,7 +18,7 @@
# @url = root_path # named route from the application.
# end
# end
# =>
#
module ActionController
module UrlFor
extend ActiveSupport::Concern

View File

@@ -4,7 +4,6 @@ require "action_dispatch/railtie"
require "action_view/railtie"
require "abstract_controller/railties/routes_helpers"
require "action_controller/railties/paths"
require "sprockets/railtie"
module ActionController
class Railtie < Rails::Railtie

View File

@@ -130,7 +130,7 @@ module ActionController
super
self.session = TestSession.new
self.session_options = TestSession::DEFAULT_OPTIONS.merge(:id => ActiveSupport::SecureRandom.hex(16))
self.session_options = TestSession::DEFAULT_OPTIONS.merge(:id => SecureRandom.hex(16))
end
class Result < ::Array #:nodoc:
@@ -145,17 +145,23 @@ module ActionController
extra_keys = routes.extra_keys(parameters)
non_path_parameters = get? ? query_parameters : request_parameters
parameters.each do |key, value|
if value.is_a? Fixnum
value = value.to_s
elsif value.is_a? Array
value = Result.new(value.map { |v| v.is_a?(String) ? v.dup : v })
elsif value.is_a? String
if value.is_a?(Array) && (value.frozen? || value.any?(&:frozen?))
value = value.map{ |v| v.duplicable? ? v.dup : v }
elsif value.is_a?(Hash) && (value.frozen? || value.any?{ |k,v| v.frozen? })
value = Hash[value.map{ |k,v| [k, v.duplicable? ? v.dup : v] }]
elsif value.frozen? && value.duplicable?
value = value.dup
end
if extra_keys.include?(key.to_sym)
non_path_parameters[key] = value
else
if value.is_a?(Array)
value = Result.new(value.map(&:to_param))
else
value = value.to_param
end
path_parameters[key.to_s] = value
end
end
@@ -184,7 +190,7 @@ module ActionController
@env.delete_if { |k, v| k =~ /^action_dispatch\.rescue/ }
@symbolized_path_params = nil
@method = @request_method = nil
@fullpath = @ip = @remote_ip = nil
@fullpath = @ip = @remote_ip = @protocol = nil
@env['action_dispatch.request.query_parameters'] = {}
end
end
@@ -395,7 +401,24 @@ module ActionController
end
alias xhr :xml_http_request
def paramify_values(hash_or_array_or_value)
case hash_or_array_or_value
when Hash
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
hash_or_array_or_value
else
hash_or_array_or_value.to_param
end
end
def process(action, parameters = nil, session = nil, flash = nil, http_method = 'GET')
# Ensure that numbers and symbols passed as params are converted to
# proper params, as is the case when engaging rack.
parameters = paramify_values(parameters) if html_format?(parameters)
# Sanity check for required instance variables so we can give an
# understandable error message.
%w(@routes @controller @request @response).each do |iv_name|
@@ -422,12 +445,11 @@ module ActionController
@request.session = ActionController::TestSession.new(session) if session
@request.session["flash"] = @request.flash.update(flash || {})
@request.session["flash"].sweep
@controller.request = @request
@controller.params.merge!(parameters)
build_request_uri(action, parameters)
@controller.class.class_eval { include Testing }
@controller.recycle!
@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?
@@ -481,6 +503,12 @@ module ActionController
@request.env["QUERY_STRING"] = query_string || ""
end
end
def html_format?(parameters)
return true unless parameters.is_a?(Hash)
format = Mime[parameters[:format]]
format.nil? || format.html?
end
end
# When the request.remote_addr remains the default for testing, which is 0.0.0.0, the exception is simply raised inline

View File

@@ -4,7 +4,7 @@ require 'html/selector'
require 'html/sanitizer'
module HTML #:nodoc:
# A top-level HTMl document. You give it a body of text, and it will parse that
# A top-level HTML document. You give it a body of text, and it will parse that
# text into a tree of nodes.
class Document #:nodoc:

View File

@@ -156,7 +156,7 @@ module HTML #:nodoc:
end
closing = ( scanner.scan(/\//) ? :close : nil )
return Text.new(parent, line, pos, content) unless name = scanner.scan(/[\w:-]+/)
return Text.new(parent, line, pos, content) unless name = scanner.scan(/[^\s!>\/]+/)
name.downcase!
unless closing

View File

@@ -1,4 +1,5 @@
require 'set'
require 'cgi'
require 'active_support/core_ext/class/attribute'
module HTML

View File

@@ -35,6 +35,10 @@ module ActionDispatch
@env["action_dispatch.request.path_parameters"] ||= {}
end
def reset_parameters #:nodoc:
@env.delete("action_dispatch.request.parameters")
end
private
# TODO: Validate that the characters are UTF-8. If they aren't,

View File

@@ -29,9 +29,9 @@ module ActionDispatch
ENV_METHODS.each do |env|
class_eval <<-METHOD, __FILE__, __LINE__ + 1
def #{env.sub(/^HTTP_/n, '').downcase}
@env["#{env}"]
end
def #{env.sub(/^HTTP_/n, '').downcase} # def accept_charset
@env["#{env}"] # @env["HTTP_ACCEPT_CHARSET"]
end # end
METHOD
end
@@ -130,10 +130,18 @@ module ActionDispatch
Http::Headers.new(@env)
end
def original_fullpath
@original_fullpath ||= (env["ORIGINAL_FULLPATH"] || fullpath)
end
def fullpath
@fullpath ||= super
end
def original_url
base_url + original_fullpath
end
def forgery_whitelisted?
get?
end
@@ -259,6 +267,30 @@ 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)
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!
when Hash
deep_munge(v)
end
end
hash
end
def parse_query(qs)
deep_munge(super)
end
private
def check_method(name)

View File

@@ -108,9 +108,9 @@ module ActionDispatch # :nodoc:
end
def body
str = ''
each { |part| str << part.to_s }
str
strings = []
each { |part| strings << part.to_s }
strings.join
end
EMPTY = " "

View File

@@ -4,7 +4,7 @@ module ActionDispatch
attr_accessor :original_filename, :content_type, :tempfile, :headers
def initialize(hash)
@original_filename = hash[:filename]
@original_filename = encode_filename(hash[:filename])
@content_type = hash[:type]
@headers = hash[:head]
@tempfile = hash[:tempfile]
@@ -30,6 +30,16 @@ module ActionDispatch
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
if "ruby".encoding_aware? && filename
filename.force_encoding("UTF-8").encode!
else
filename
end
end
end
module Upload

View File

@@ -64,14 +64,16 @@ module ActionDispatch
end
def host_or_subdomain_and_domain(options)
return options[:host] unless options[:subdomain] || options[:domain]
return options[:host] if !named_host?(options[:host]) || (options[:subdomain].nil? && options[:domain].nil?)
tld_length = options[:tld_length] || @@tld_length
host = ""
host << (options[:subdomain] || extract_subdomain(options[:host], tld_length))
host << "."
host << (options[:domain] || extract_domain(options[:host], tld_length))
unless options[:subdomain] == false
host << (options[:subdomain] || extract_subdomain(options[:host], tld_length)).to_param
host << "."
end
host << (options[:domain] || extract_domain(options[:host], tld_length))
host
end
end

View File

@@ -84,6 +84,7 @@ module ActionDispatch
class CookieOverflow < StandardError; end
class CookieJar #:nodoc:
include Enumerable
# This regular expression is used to split the levels of a domain.
# The top level domain can be any string without a period or
@@ -123,11 +124,20 @@ module ActionDispatch
alias :closed? :closed
def close!; @closed = true end
def each(&block)
@cookies.each(&block)
end
# Returns the value of the cookie by +name+, or +nil+ if no such cookie exists.
def [](name)
@cookies[name.to_s]
end
def key?(name)
@cookies.key?(name.to_s)
end
alias :has_key? :key?
def update(other_hash)
@cookies.update other_hash
self
@@ -305,7 +315,7 @@ module ActionDispatch
if secret.length < SECRET_MIN_LENGTH
raise ArgumentError, "Secret should be something secure, " +
"like \"#{ActiveSupport::SecureRandom.hex(16)}\". The value you " +
"like \"#{SecureRandom.hex(16)}\". The value you " +
"provided, \"#{secret}\", is shorter than the minimum length " +
"of #{SECRET_MIN_LENGTH} characters"
end

View File

@@ -4,7 +4,7 @@ module ActionDispatch
# read a notice you put there or <tt>flash["notice"] = "hello"</tt>
# to put a new one.
def flash
@env[Flash::KEY] ||= (session["flash"] || Flash::FlashHash.new)
@env[Flash::KEY] ||= (session["flash"] || Flash::FlashHash.new).tap(&:sweep)
end
end
@@ -70,6 +70,10 @@ module ActionDispatch
end
end
# Implementation detail: please do not change the signature of the
# FlashHash class. Doing that will likely affect all Rails apps in
# production as the FlashHash currently stored in their sessions will
# become invalid.
class FlashHash
include Enumerable
@@ -236,10 +240,6 @@ module ActionDispatch
end
def call(env)
if (session = env['rack.session']) && (flash = session['flash'])
flash.sweep
end
@app.call(env)
ensure
session = env['rack.session'] || {}
@@ -257,7 +257,8 @@ module ActionDispatch
new_hash.close!
end
if session.key?('flash') && session['flash'].empty?
if (!session.respond_to?(:loaded?) || session.loaded?) && # (reset_session uses {}, which doesn't implement #loaded?)
session.key?('flash') && session['flash'].empty?
session.delete('flash')
end
end

View File

@@ -29,7 +29,7 @@ module ActionDispatch
end
def generate_sid
sid = ActiveSupport::SecureRandom.hex(16)
sid = SecureRandom.hex(16)
sid.encode!('UTF-8') if sid.respond_to?(:encode!)
sid
end
@@ -62,6 +62,9 @@ module ActionDispatch
raise ActionDispatch::Session::SessionRestoreError, "Session contains objects whose class definition isn't available.\nRemember to require the classes for all objects kept in the session.\n(Original exception: #{const_error.message} [#{const_error.class}])\n"
end
retry
elsif argument_error.message =~ %r{dump format error \(user class\)}
# Error unmarshalling object from session.
{}
else
raise
end

View File

@@ -59,7 +59,7 @@ module ActionDispatch
end
def set_session(env, sid, session_data, options)
session_data.merge("session_id" => sid)
session_data.merge!("session_id" => sid)
end
def set_cookie(env, session_id, cookie)

View File

@@ -11,14 +11,14 @@ module ActionDispatch
def match?(path)
path = path.dup
full_path = path.empty? ? @root : File.join(@root, ::Rack::Utils.unescape(path))
full_path = path.empty? ? @root : File.join(@root, escape_glob_chars(unescape_path(path)))
paths = "#{full_path}#{ext}"
matches = Dir[paths]
match = matches.detect { |m| File.file?(m) }
if match
match.sub!(@compiled_root, '')
match
::Rack::Utils.escape(match)
end
end
@@ -32,6 +32,14 @@ module ActionDispatch
"{,#{ext},/index#{ext}}"
end
end
def unescape_path(path)
URI.parser.unescape(path)
end
def escape_glob_chars(path)
path.gsub(/[*?{}\[\]]/, "\\\\\\&")
end
end
class Static

View File

@@ -1,10 +1,9 @@
require "action_dispatch"
require "rails"
module ActionDispatch
class Railtie < Rails::Railtie
config.action_dispatch = ActiveSupport::OrderedOptions.new
config.action_dispatch.x_sendfile_header = ""
config.action_dispatch.x_sendfile_header = nil
config.action_dispatch.ip_spoofing_check = true
config.action_dispatch.show_exceptions = true
config.action_dispatch.best_standards_support = true

View File

@@ -35,6 +35,8 @@ module ActionDispatch
}
return true
ensure
req.reset_parameters
end
def call(env)
@@ -107,7 +109,7 @@ module ActionDispatch
# Add a constraint for wildcard route to make it non-greedy and match the
# optional format part of the route by default
if path.match(/\*([^\/]+)$/) && @options[:format] != false
if path.match(%r{\*([^/\)]+)\)?$}) && @options[:format] != false
@options.reverse_merge!(:"#{$1}" => /.+?/)
end
@@ -116,6 +118,8 @@ module ActionDispatch
path
elsif path.include?(":format") || path.end_with?('/')
path
elsif @options[:format] == true
"#{path}.:format"
else
"#{path}(.:format)"
end
@@ -187,13 +191,12 @@ module ActionDispatch
end
def blocks
block = @scope[:blocks] || []
if @options[:constraints].present? && !@options[:constraints].is_a?(Hash)
block << @options[:constraints]
constraints = @options[:constraints]
if constraints.present? && !constraints.is_a?(Hash)
[constraints]
else
@scope[:blocks] || []
end
block
end
def constraints
@@ -330,7 +333,7 @@ module ActionDispatch
# +call+ or a string representing a controller's action.
#
# match 'path', :to => 'controller#action'
# match 'path', :to => lambda { [200, {}, "Success!"] }
# match 'path', :to => lambda { |env| [200, {}, "Success!"] }
# match 'path', :to => RackApp
#
# [:on]
@@ -457,7 +460,9 @@ module ActionDispatch
prefix_options = options.slice(*_route.segment_keys)
# we must actually delete prefix segment keys to avoid passing them to next url_for
_route.segment_keys.each { |k| options.delete(k) }
_routes.url_helpers.send("#{name}_path", prefix_options)
prefix = _routes.url_helpers.send("#{name}_path", prefix_options)
prefix = '' if prefix == '/'
prefix
end
end
end
@@ -699,7 +704,7 @@ module ActionDispatch
# Allows you to constrain the nested routes based on a set of rules.
# For instance, in order to change the routes to allow for a dot character in the +id+ parameter:
#
# constraints(:id => /\d+\.\d+) do
# constraints(:id => /\d+\.\d+/) do
# resources :posts
# end
#
@@ -709,7 +714,7 @@ module ActionDispatch
# You may use this to also restrict other parameters:
#
# resources :posts do
# constraints(:post_id => /\d+\.\d+) do
# constraints(:post_id => /\d+\.\d+/) do
# resources :comments
# end
# end
@@ -738,7 +743,7 @@ module ActionDispatch
# if the user should be given access to that route, or +false+ if the user should not.
#
# class Iphone
# def self.matches(request)
# def self.matches?(request)
# request.env["HTTP_USER_AGENT"] =~ /iPhone/
# end
# end
@@ -876,9 +881,9 @@ module ActionDispatch
def initialize(entities, options = {})
@name = entities.to_s
@path = (options.delete(:path) || @name).to_s
@controller = (options.delete(:controller) || @name).to_s
@as = options.delete(:as)
@path = (options[:path] || @name).to_s
@controller = (options[:controller] || @name).to_s
@as = options[:as]
@options = options
end
@@ -940,12 +945,11 @@ module ActionDispatch
DEFAULT_ACTIONS = [:show, :create, :update, :destroy, :new, :edit]
def initialize(entities, options)
super
@as = nil
@name = entities.to_s
@path = (options.delete(:path) || @name).to_s
@controller = (options.delete(:controller) || plural).to_s
@as = options.delete(:as)
@options = options
@controller = (options[:controller] || plural).to_s
@as = options[:as]
end
def plural
@@ -1102,9 +1106,9 @@ module ActionDispatch
#
# The +comments+ resource here will have the following routes generated for it:
#
# post_comments GET /sekret/posts/:post_id/comments(.:format)
# post_comments POST /sekret/posts/:post_id/comments(.:format)
# new_post_comment GET /sekret/posts/:post_id/comments/new(.:format)
# post_comments GET /posts/:post_id/comments(.:format)
# post_comments POST /posts/:post_id/comments(.:format)
# new_post_comment GET /posts/:post_id/comments/new(.:format)
# edit_comment GET /sekret/comments/:id/edit(.:format)
# comment GET /sekret/comments/:id(.:format)
# comment PUT /sekret/comments/:id(.:format)

View File

@@ -124,14 +124,7 @@ module ActionDispatch
args.last.kind_of?(Hash) ? args.last.merge!(url_options) : args << url_options
end
if proxy
proxy.send(named_route, *args)
else
# we need to use url_for, because polymorphic_url can be used in context of other than
# current routes (e.g. engine's routes). As named routes from engine are not included
# calling engine's named route directly would fail.
url_for _routes.url_helpers.__send__("hash_for_#{named_route}", *args)
end
(proxy || self).send(named_route, *args)
end
# Returns the path component of a URL for the given record. It uses
@@ -172,7 +165,7 @@ module ActionDispatch
if parent.is_a?(Symbol) || parent.is_a?(String)
parent
else
ActiveModel::Naming.route_key(parent).singularize
ActiveModel::Naming.singular_route_key(parent)
end
end
else
@@ -182,10 +175,14 @@ module ActionDispatch
if record.is_a?(Symbol) || record.is_a?(String)
route << record
elsif record
if inflection == :singular
route << ActiveModel::Naming.singular_route_key(record)
else
route << ActiveModel::Naming.route_key(record)
end
else
route << ActiveModel::Naming.route_key(record)
route = [route.join("_").singularize] if inflection == :singular
route << "index" if ActiveModel::Naming.uncountable?(record) && inflection == :plural
raise ArgumentError, "Nil location provided. Can't build URI."
end
route << routing_type(options)

View File

@@ -1,4 +1,6 @@
require 'action_dispatch/http/request'
require 'active_support/core_ext/uri'
require 'rack/utils'
module ActionDispatch
module Routing
@@ -43,7 +45,7 @@ module ActionDispatch
path = args.shift
path_proc = if path.is_a?(String)
proc { |params| (params.empty? || !path.match(/%\{\w*\}/)) ? path : (path % params) }
proc { |params| (params.empty? || !path.match(/%\{\w*\}/)) ? path : (path % escape(params)) }
elsif options.any?
options_proc(options)
elsif path.respond_to?(:call)
@@ -66,7 +68,7 @@ module ActionDispatch
elsif params.empty? || !options[:path].match(/%\{\w*\}/)
options.delete(:path)
else
(options.delete(:path) % params)
(options.delete(:path) % escape_path(params))
end
default_options = {
@@ -105,6 +107,14 @@ module ActionDispatch
end
end
def escape(params)
Hash[params.map{ |k,v| [k, Rack::Utils.escape(v)] }]
end
def escape_path(params)
Hash[params.map{ |k,v| [k, URI.parser.escape(v)] }]
end
end
end
end

View File

@@ -8,6 +8,12 @@ require 'active_support/core_ext/module/remove_method'
module ActionDispatch
module Routing
class RouteSet #:nodoc:
# Since the router holds references to many parts of the system
# like engines, controllers and the application itself, inspecting
# the route set can actually be really slow, therefore we default
# alias inspect to to_s.
alias inspect to_s
PARAMETERS_KEY = 'action_dispatch.request.path_parameters'
class Dispatcher #:nodoc:
@@ -164,13 +170,14 @@ module ActionDispatch
remove_possible_method :#{selector}
def #{selector}(*args)
options = args.extract_options!
result = #{options.inspect}
if args.any?
options[:_positional_args] = args
options[:_positional_keys] = #{route.segment_keys.inspect}
if args.size > 0
result[:_positional_args] = args
result[:_positional_keys] = #{route.segment_keys.inspect}
end
options ? #{options.inspect}.merge(options) : #{options.inspect}
result.merge(options)
end
protected :#{selector}
END_EVAL

View File

@@ -16,6 +16,10 @@ module ActionDispatch
end
end
def respond_to?(method, include_private = false)
super || routes.url_helpers.respond_to?(method)
end
def method_missing(method, *args)
if routes.url_helpers.respond_to?(method)
self.class.class_eval <<-RUBY, __FILE__, __LINE__ + 1

View File

@@ -52,7 +52,7 @@ module ActionDispatch
#
# For convenience reasons, mailers provide a shortcut for ActionController::UrlFor#url_for.
# So within mailers, you only have to type 'url_for' instead of 'ActionController::UrlFor#url_for'
# in full. However, mailers don't have hostname information, and what's why you'll still
# in full. However, mailers don't have hostname information, and that's why you'll still
# have to specify the <tt>:host</tt> argument when generating URLs in mailers.
#
#
@@ -116,9 +116,10 @@ module ActionDispatch
# If <tt>:only_path</tt> is false, this option must be
# provided either explicitly, or via +default_url_options+.
# * <tt>:subdomain</tt> - Specifies the subdomain of the link, using the +tld_length+
# to split the domain from the host.
# * <tt>:domain</tt> - Specifies the domain of the link, using the +tld_length+
# to split the subdomain from the host.
# If false, removes all subdomains from the host part of the link.
# * <tt>:domain</tt> - Specifies the domain of the link, using the +tld_length+
# to split the domain from the host.
# * <tt>:tld_length</tt> - Number of labels the TLD id composed of, only used if
# <tt>:subdomain</tt> or <tt>:domain</tt> are supplied. Defaults to
# <tt>ActionDispatch::Http::URL.tld_length</tt>, which in turn defaults to 1.
@@ -131,16 +132,20 @@ module ActionDispatch
#
# Examples:
#
# url_for :controller => 'tasks', :action => 'testing', :host => 'somehost.org', :port => '8080' # => 'http://somehost.org:8080/tasks/testing'
# url_for :controller => 'tasks', :action => 'testing', :host => 'somehost.org', :anchor => 'ok', :only_path => true # => '/tasks/testing#ok'
# url_for :controller => 'tasks', :action => 'testing', :trailing_slash => true # => 'http://somehost.org/tasks/testing/'
# url_for :controller => 'tasks', :action => 'testing', :host => 'somehost.org', :number => '33' # => 'http://somehost.org/tasks/testing?number=33'
# url_for :controller => 'tasks', :action => 'testing', :host => 'somehost.org', :port => '8080'
# # => 'http://somehost.org:8080/tasks/testing'
# url_for :controller => 'tasks', :action => 'testing', :host => 'somehost.org', :anchor => 'ok', :only_path => true
# # => '/tasks/testing#ok'
# url_for :controller => 'tasks', :action => 'testing', :trailing_slash => true
# # => 'http://somehost.org/tasks/testing/'
# url_for :controller => 'tasks', :action => 'testing', :host => 'somehost.org', :number => '33'
# # => 'http://somehost.org/tasks/testing?number=33'
def url_for(options = nil)
case options
when String
options
when nil, Hash
_routes.url_for((options || {}).reverse_merge!(url_options).symbolize_keys)
_routes.url_for((options || {}).reverse_merge(url_options).symbolize_keys)
else
polymorphic_url(options)
end

View File

@@ -8,12 +8,11 @@ module ActionDispatch
extend ActiveSupport::Concern
included do
include DomAssertions
include ResponseAssertions
include RoutingAssertions
include SelectorAssertions
include TagAssertions
end
include DomAssertions
include ResponseAssertions
include RoutingAssertions
include SelectorAssertions
include TagAssertions
end
end

View File

@@ -6,13 +6,6 @@ module ActionDispatch
module ResponseAssertions
extend ActiveSupport::Concern
included do
# TODO: Need to pull in AV::Template monkey patches that track which
# templates are rendered. assert_template should probably be part
# of AV instead of AD.
require 'action_view/test_case'
end
# Asserts that the response is one of the following types:
#
# * <tt>:success</tt> - Status code was 200
@@ -92,7 +85,7 @@ module ActionDispatch
refer
else
@controller.url_for(fragment)
end.gsub(/[\r\n]/, '')
end.gsub(/[\0\r\n]/, '')
end
def validate_request!

View File

@@ -415,9 +415,9 @@ module ActionDispatch
assert !deliveries.empty?, "No e-mail in delivery list"
for delivery in deliveries
for part in delivery.parts
for part in (delivery.parts.empty? ? [delivery] : delivery.parts)
if part["Content-Type"].to_s =~ /^text\/html\W/
root = HTML::Document.new(part.body).root
root = HTML::Document.new(part.body.to_s).root
assert_select root, ":root", &block
end
end

View File

@@ -184,9 +184,16 @@ module ActionDispatch
reset!
end
remove_method :default_url_options
def default_url_options
{ :host => host, :protocol => https? ? "https" : "http" }
def url_options
@url_options ||= default_url_options.dup.tap do |url_options|
url_options.reverse_merge!(controller.url_options) if controller
if @app.respond_to?(:routes) && @app.routes.respond_to?(:default_url_options)
url_options.reverse_merge!(@app.routes.default_url_options)
end
url_options.reverse_merge!(:host => host, :protocol => https? ? "https" : "http")
end
end
# Resets the instance. This can be used to reset the state information
@@ -199,6 +206,7 @@ module ActionDispatch
@controller = @request = @response = nil
@_mock_session = nil
@request_count = 0
@url_options = nil
self.host = DEFAULT_HOST
self.remote_addr = "127.0.0.1"
@@ -244,8 +252,8 @@ module ActionDispatch
end
# Performs the actual request.
def process(method, path, parameters = nil, env = nil)
env ||= {}
def process(method, path, parameters = nil, rack_env = nil)
rack_env ||= {}
if path =~ %r{://}
location = URI.parse(path)
https! URI::HTTPS === location if location.scheme
@@ -261,7 +269,7 @@ module ActionDispatch
hostname, port = host.split(':')
default_env = {
env = {
:method => method,
:params => parameters,
@@ -279,7 +287,7 @@ module ActionDispatch
session = Rack::Test::Session.new(_mock_session)
env.reverse_merge!(default_env)
env.merge!(rack_env)
# NOTE: rack-test v0.5 doesn't build a default uri correctly
# Make sure requested path is always a full uri
@@ -296,6 +304,7 @@ module ActionDispatch
response = _mock_session.last_response
@response = ActionDispatch::TestResponse.new(response.status, response.headers, response.body)
@html_document = nil
@url_options = nil
@controller = session.last_request.env['action_controller.instance']
@@ -353,12 +362,14 @@ module ActionDispatch
end
end
extend ActiveSupport::Concern
include ActionDispatch::Routing::UrlFor
def url_options
def default_url_options
reset! unless integration_session
integration_session.url_options
integration_session.default_url_options
end
def default_url_options=(options)
reset! unless integration_session
integration_session.default_url_options = options
end
def respond_to?(method, include_private = false)
@@ -462,6 +473,7 @@ module ActionDispatch
class IntegrationTest < ActiveSupport::TestCase
include Integration::Runner
include ActionController::TemplateAssertions
include ActionDispatch::Routing::UrlFor
@@app = nil
@@ -478,5 +490,10 @@ module ActionDispatch
def app
super || self.class.app
end
def url_options
reset! unless integration_session
integration_session.url_options
end
end
end

View File

@@ -4,12 +4,7 @@ require 'active_support/core_ext/hash/indifferent_access'
module ActionDispatch
module TestProcess
def assigns(key = nil)
assigns = {}.with_indifferent_access
@controller.instance_variable_names.each do |ivar|
next if ActionController::Base.protected_instance_variables.include?(ivar)
assigns[ivar[1..-1]] = @controller.instance_variable_get(ivar)
end
assigns = @controller.view_assigns.with_indifferent_access
key.nil? ? assigns : assigns[key]
end

View File

@@ -83,7 +83,7 @@ module ActionDispatch
end
def escape_cookie(name, value)
"#{Rack::Utils.escape(name)}=#{Rack::Utils.escape(value)}"
"#{Rack::Utils.escape(name)}=#{Rack::Utils.escape(value.to_s)}"
end
def delete_nil_values!

View File

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

View File

@@ -30,6 +30,7 @@ module ActionView
extend ActiveSupport::Autoload
eager_autoload do
autoload :AssetPaths
autoload :Base
autoload :Context
autoload :Helpers

View File

@@ -0,0 +1,137 @@
require 'zlib'
require 'active_support/core_ext/file'
module ActionView
class AssetPaths #:nodoc:
attr_reader :config, :controller
def initialize(config, controller = nil)
@config = config
@controller = controller
end
# Add the extension +ext+ if not present. Return full or scheme-relative URLs otherwise untouched.
# Prefix with <tt>/dir/</tt> if lacking a leading +/+. Account for relative URL
# roots. Rewrite the asset path for cache-busting asset ids. Include
# asset host, if configured, with the correct request protocol.
#
# When :relative (default), the protocol will be determined by the client using current protocol
# When :request, the protocol will be the request protocol
# Otherwise, the protocol is used (E.g. :http, :https, etc)
def compute_public_path(source, dir, options = {})
source = source.to_s
return source if is_uri?(source)
source = rewrite_extension(source, dir, options[:ext]) if options[:ext]
source = rewrite_asset_path(source, dir, options)
source = rewrite_relative_url_root(source, relative_url_root)
source = rewrite_host_and_protocol(source, options[:protocol])
source
end
# Return the filesystem path for the source
def compute_source_path(source, dir, ext)
source = rewrite_extension(source, dir, ext) if ext
File.join(config.assets_dir, dir, source)
end
def is_uri?(path)
path =~ %r{^[-a-z]+://|^(?:cid|data):|^//}
end
private
def rewrite_extension(source, dir, ext)
raise NotImplementedError
end
def rewrite_asset_path(source, path = nil)
raise NotImplementedError
end
def rewrite_relative_url_root(source, relative_url_root)
relative_url_root && !source.starts_with?("#{relative_url_root}/") ? "#{relative_url_root}#{source}" : source
end
def has_request?
controller.respond_to?(:request)
end
def rewrite_host_and_protocol(source, protocol = nil)
host = compute_asset_host(source)
if host && !is_uri?(host)
if (protocol || default_protocol) == :request && !has_request?
host = nil
else
host = "#{compute_protocol(protocol)}#{host}"
end
end
host.nil? ? source : "#{host}#{source}"
end
def compute_protocol(protocol)
protocol ||= default_protocol
case protocol
when :relative
"//"
when :request
unless @controller
invalid_asset_host!("The protocol requested was :request. Consider using :relative instead.")
end
@controller.request.protocol
else
"#{protocol}://"
end
end
def default_protocol
@config.default_asset_host_protocol || (has_request? ? :request : :relative)
end
def invalid_asset_host!(help_message)
raise ActionController::RoutingError, "This asset host cannot be computed without a request in scope. #{help_message}"
end
# Pick an asset host for this source. Returns +nil+ if no host is set,
# the host if no wildcard is set, the host interpolated with the
# numbers 0-3 if it contains <tt>%d</tt> (the number is the source hash mod 4),
# or the value returned from invoking the proc if it's a proc or the value from
# invoking call if it's an object responding to call.
def compute_asset_host(source)
if host = asset_host_config
if host.respond_to?(:call)
args = [source]
arity = arity_of(host)
if arity > 1 && !has_request?
invalid_asset_host!("Remove the second argument to your asset_host Proc if you do not need the request.")
end
args << current_request if (arity > 1 || arity < 0) && has_request?
host.call(*args)
else
(host =~ /%d/) ? host % (Zlib.crc32(source) % 4) : host
end
end
end
def relative_url_root
config.relative_url_root
end
def asset_host_config
config.asset_host
end
# Returns the current request if one exists.
def current_request
controller.request if has_request?
end
# Returns the arity of a callable
def arity_of(callable)
callable.respond_to?(:arity) ? callable.arity : callable.method(:call).arity
end
end
end

View File

@@ -194,7 +194,7 @@ module ActionView #:nodoc:
end
def initialize(context = nil, assigns = {}, controller = nil, formats = nil) #:nodoc:
@_config = {}
@_config = ActiveSupport::InheritableOptions.new
# Handle all these for backwards compatibility.
# TODO Provide a new API for AV::Base and deprecate this one.

View File

@@ -35,9 +35,9 @@ module ActionView
def html_safe?
true
end
def html_safe
self
end
end
end
end

View File

@@ -22,7 +22,6 @@ module ActionView #:nodoc:
autoload :RecordTagHelper
autoload :RenderingHelper
autoload :SanitizeHelper
autoload :SprocketsHelper
autoload :TagHelper
autoload :TextHelper
autoload :TranslationHelper
@@ -53,7 +52,6 @@ module ActionView #:nodoc:
include RecordTagHelper
include RenderingHelper
include SanitizeHelper
include SprocketsHelper
include TagHelper
include TextHelper
include TranslationHelper

View File

@@ -1,78 +1,7 @@
require 'active_support/core_ext/file'
ActiveSupport::Deprecation.warn "ActionView::Helpers::AssetPaths is deprecated. Please use ActionView::AssetPaths instead."
module ActionView
module Helpers
class AssetPaths #:nodoc:
attr_reader :config, :controller
def initialize(config, controller)
@config = config
@controller = controller
end
# Add the extension +ext+ if not present. Return full or scheme-relative URLs otherwise untouched.
# Prefix with <tt>/dir/</tt> if lacking a leading +/+. Account for relative URL
# roots. Rewrite the asset path for cache-busting asset ids. Include
# asset host, if configured, with the correct request protocol.
def compute_public_path(source, dir, ext = nil, include_host = true)
source = source.to_s
return source if is_uri?(source)
source = rewrite_extension(source, dir, ext) if ext
source = rewrite_asset_path(source, dir)
if controller && include_host
has_request = controller.respond_to?(:request)
source = rewrite_host_and_protocol(source, has_request)
end
source
end
def is_uri?(path)
path =~ %r{^[-a-z]+://|^cid:|^//}
end
private
def rewrite_extension(source, dir, ext)
raise NotImplementedError
end
def rewrite_asset_path(source, path = nil)
raise NotImplementedError
end
def rewrite_host_and_protocol(source, has_request)
host = compute_asset_host(source)
if has_request && host && !is_uri?(host)
host = "#{controller.request.protocol}#{host}"
end
"#{host}#{source}"
end
# Pick an asset host for this source. Returns +nil+ if no host is set,
# the host if no wildcard is set, the host interpolated with the
# numbers 0-3 if it contains <tt>%d</tt> (the number is the source hash mod 4),
# or the value returned from invoking the proc if it's a proc or the value from
# invoking call if it's an object responding to call.
def compute_asset_host(source)
if host = config.asset_host
if host.is_a?(Proc) || host.respond_to?(:call)
case host.is_a?(Proc) ? host.arity : host.method(:call).arity
when 2
request = controller.respond_to?(:request) && controller.request
host.call(source, request)
else
host.call(source)
end
else
(host =~ /%d/) ? host % (source.hash % 4) : host
end
end
end
end
AssetPaths = ::ActionView::AssetPaths
end
end
end

View File

@@ -1,6 +1,7 @@
require 'action_view/helpers/asset_tag_helpers/javascript_tag_helpers'
require 'action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers'
require 'action_view/helpers/asset_tag_helpers/asset_paths'
require 'action_view/helpers/tag_helper'
module ActionView
# = Action View Asset Tag Helpers
@@ -153,7 +154,7 @@ module ActionView
# "/release-#{RELEASE_NUMBER}#{asset_path}"
# }
#
# This example would cause the following behaviour on all servers no
# This example would cause the following behavior on all servers no
# matter when they were deployed:
#
# image_tag("rails.png")
@@ -191,6 +192,7 @@ module ActionView
# RewriteEngine On
# RewriteRule ^/release-\d+/(images|javascripts|stylesheets)/(.*)$ /$1/$2 [L]
module AssetTagHelper
include TagHelper
include JavascriptTagHelpers
include StylesheetTagHelpers
# Returns a link tag that browsers and news readers can use to auto-detect
@@ -274,11 +276,7 @@ module ActionView
# The alias +path_to_image+ is provided to avoid that. Rails uses the alias internally, and
# plugin authors are encouraged to do so.
def image_path(source)
if config.use_sprockets
asset_path(source)
else
asset_paths.compute_public_path(source, 'images')
end
asset_paths.compute_public_path(source, 'images')
end
alias_method :path_to_image, :image_path # aliased to avoid conflicts with an image_path named route
@@ -293,11 +291,7 @@ module ActionView
# video_path("/trailers/hd.avi") # => /trailers/hd.avi
# video_path("http://www.example.com/vid/hd.avi") # => http://www.example.com/vid/hd.avi
def video_path(source)
if config.use_sprockets
asset_path(source)
else
asset_paths.compute_public_path(source, 'videos')
end
asset_paths.compute_public_path(source, 'videos')
end
alias_method :path_to_video, :video_path # aliased to avoid conflicts with a video_path named route
@@ -312,11 +306,7 @@ module ActionView
# audio_path("/sounds/horse.wav") # => /sounds/horse.wav
# audio_path("http://www.example.com/sounds/horse.wav") # => http://www.example.com/sounds/horse.wav
def audio_path(source)
if config.use_sprockets
asset_path(source)
else
asset_paths.compute_public_path(source, 'audios')
end
asset_paths.compute_public_path(source, 'audios')
end
alias_method :path_to_audio, :audio_path # aliased to avoid conflicts with an audio_path named route
@@ -358,8 +348,8 @@ module ActionView
src = options[:src] = path_to_image(source)
unless src =~ /^cid:/
options[:alt] = options.fetch(:alt){ File.basename(src, '.*').capitalize }
unless src =~ /^(?:cid|data):/
options[:alt] = options.fetch(:alt){ image_alt(src) }
end
if size = options.delete(:size)
@@ -374,6 +364,10 @@ module ActionView
tag("img", options)
end
def image_alt(src)
File.basename(src, '.*').sub(/-[[:xdigit:]]{32}\z/, '').capitalize
end
# Returns an html video tag for the +sources+. If +sources+ is a string,
# a single video tag will be returned. If +sources+ is an array, a video
# tag with nested source tags for each source will be returned. The

View File

@@ -60,12 +60,16 @@ module ActionView
private
def path_to_asset(source, include_host = true)
asset_paths.compute_public_path(source, asset_name.to_s.pluralize, extension, include_host)
def path_to_asset(source, options = {})
asset_paths.compute_public_path(source, asset_name.to_s.pluralize, options.merge(:ext => extension))
end
def path_to_asset_source(source)
asset_paths.compute_source_path(source, asset_name.to_s.pluralize, extension)
end
def compute_paths(*args)
expand_sources(*args).collect { |source| asset_paths.compute_public_path(source, asset_name.pluralize, extension, false) }
expand_sources(*args).collect { |source| path_to_asset_source(source) }
end
def expand_sources(sources, recursive)
@@ -92,7 +96,7 @@ module ActionView
def ensure_sources!(sources)
sources.each do |source|
asset_file_path!(path_to_asset(source, false))
asset_file_path!(path_to_asset_source(source))
end
end
@@ -123,19 +127,14 @@ module ActionView
# Set mtime to the latest of the combined files to allow for
# consistent ETag without a shared filesystem.
mt = asset_paths.map { |p| File.mtime(asset_file_path(p)) }.max
mt = asset_paths.map { |p| File.mtime(asset_file_path!(p)) }.max
File.utime(mt, mt, joined_asset_path)
end
def asset_file_path(path)
File.join(config.assets_dir, path.split('?').first)
end
def asset_file_path!(path, error_if_file_is_uri = false)
if asset_paths.is_uri?(path)
def asset_file_path!(absolute_path, error_if_file_is_uri = false)
if asset_paths.is_uri?(absolute_path)
raise(Errno::ENOENT, "Asset file #{path} is uri and cannot be merged into single file") if error_if_file_is_uri
else
absolute_path = asset_file_path(path)
raise(Errno::ENOENT, "Asset file not found at '#{absolute_path}'" ) unless File.exist?(absolute_path)
return absolute_path
end

View File

@@ -1,11 +1,11 @@
require 'thread'
require 'active_support/core_ext/file'
require 'action_view/helpers/asset_paths'
module ActionView
module Helpers
module AssetTagHelper
class AssetPaths < ActionView::Helpers::AssetPaths #:nodoc:
class AssetPaths < ::ActionView::AssetPaths #:nodoc:
# You can enable or disable the asset tag ids cache.
# With the cache enabled, the asset tag helper methods will make fewer
# expensive file system calls (the default implementation checks the file
@@ -41,7 +41,7 @@ module ActionView
# Break out the asset path rewrite in case plugins wish to put the asset id
# someplace other than the query string.
def rewrite_asset_path(source, dir)
def rewrite_asset_path(source, dir, options = nil)
source = "/#{dir}/#{source}" unless source[0] == ?/
path = config.asset_path
@@ -85,17 +85,8 @@ module ActionView
end
end
end
def rewrite_relative_url_root(source, relative_url_root)
relative_url_root && !source.starts_with?("#{relative_url_root}/") ? "#{relative_url_root}#{source}" : source
end
def rewrite_host_and_protocol(source, has_request)
source = rewrite_relative_url_root(source, controller.config.relative_url_root) if has_request
super(source, has_request)
end
end
end
end
end
end

View File

@@ -83,11 +83,7 @@ module ActionView
# javascript_path "http://www.example.com/js/xmlhr" # => http://www.example.com/js/xmlhr
# javascript_path "http://www.example.com/js/xmlhr.js" # => http://www.example.com/js/xmlhr.js
def javascript_path(source)
if config.use_sprockets
asset_path(source, 'js')
else
asset_paths.compute_public_path(source, 'javascripts', 'js')
end
asset_paths.compute_public_path(source, 'javascripts', :ext => 'js')
end
alias_method :path_to_javascript, :javascript_path # aliased to avoid conflicts with a javascript_path named route
@@ -123,10 +119,10 @@ module ActionView
# # <script type="text/javascript" src="/elsewhere/cools.js?1423139606"></script>
#
# javascript_include_tag "http://www.example.com/xmlhr"
# # => <script type="text/javascript" src="http://www.example.com/xmlhr.js?1284139606"></script>
# # => <script type="text/javascript" src="http://www.example.com/xmlhr"></script>
#
# javascript_include_tag "http://www.example.com/xmlhr.js"
# # => <script type="text/javascript" src="http://www.example.com/xmlhr.js?1284139606"></script>
# # => <script type="text/javascript" src="http://www.example.com/xmlhr.js"></script>
#
# javascript_include_tag :defaults
# # => <script type="text/javascript" src="/javascripts/jquery.js?1284139606"></script>
@@ -187,12 +183,8 @@ module ActionView
#
# javascript_include_tag :all, :cache => true, :recursive => true
def javascript_include_tag(*sources)
if config.use_sprockets
sprockets_javascript_include_tag(*sources)
else
@javascript_include ||= JavascriptIncludeTag.new(config, asset_paths)
@javascript_include.include_tag(*sources)
end
@javascript_include ||= JavascriptIncludeTag.new(config, asset_paths)
@javascript_include.include_tag(*sources)
end
end
end

View File

@@ -16,7 +16,8 @@ module ActionView
end
def asset_tag(source, options)
tag("link", { "rel" => "stylesheet", "type" => Mime::CSS, "media" => "screen", "href" => ERB::Util.html_escape(path_to_asset(source)) }.merge(options), false, false)
# We force the :request protocol here to avoid a double-download bug in IE7 and IE8
tag("link", { "rel" => "stylesheet", "type" => Mime::CSS, "media" => "screen", "href" => path_to_asset(source, :protocol => :request) }.merge(options))
end
def custom_dir
@@ -52,7 +53,7 @@ module ActionView
# If the +source+ filename has no extension, <tt>.css</tt> will be appended (except for explicit URIs).
# Full paths from the document root will be passed through.
# Used internally by +stylesheet_link_tag+ to build the stylesheet path.
#
#
# ==== Examples
# stylesheet_path "style" # => /stylesheets/style.css
# stylesheet_path "dir/style.css" # => /stylesheets/dir/style.css
@@ -60,11 +61,7 @@ module ActionView
# stylesheet_path "http://www.example.com/css/style" # => http://www.example.com/css/style
# stylesheet_path "http://www.example.com/css/style.css" # => http://www.example.com/css/style.css
def stylesheet_path(source)
if config.use_sprockets
asset_path(source, 'css')
else
asset_paths.compute_public_path(source, 'stylesheets', 'css')
end
asset_paths.compute_public_path(source, 'stylesheets', :ext => 'css', :protocol => :request)
end
alias_method :path_to_stylesheet, :stylesheet_path # aliased to avoid conflicts with a stylesheet_path named route
@@ -137,12 +134,8 @@ module ActionView
# stylesheet_link_tag :all, :concat => true
#
def stylesheet_link_tag(*sources)
if config.use_sprockets
sprockets_stylesheet_link_tag(*sources)
else
@stylesheet_include ||= StylesheetIncludeTag.new(config, asset_paths)
@stylesheet_include.include_tag(*sources)
end
@stylesheet_include ||= StylesheetIncludeTag.new(config, asset_paths)
@stylesheet_include.include_tag(*sources)
end
end

View File

@@ -51,7 +51,11 @@ module ActionView
# This dance is needed because Builder can't use capture
pos = output_buffer.length
yield
output_safe = output_buffer.html_safe?
fragment = output_buffer.slice!(pos..-1)
if output_safe
self.output_buffer = output_buffer.class.new(output_buffer)
end
controller.write_fragment(name, fragment, options)
end
end

View File

@@ -134,9 +134,9 @@ module ActionView
# WARNING: content_for is ignored in caches. So you shouldn't use it
# for elements that will be fragment cached.
def content_for(name, content = nil, &block)
content = capture(&block) if block_given?
if content
@view_flow.append(name, content)
if content || block_given?
content = capture(&block) if block_given?
@view_flow.append(name, content) if content
nil
else
@view_flow.get(name)
@@ -194,7 +194,7 @@ module ActionView
def flush_output_buffer #:nodoc:
if output_buffer && !output_buffer.empty?
response.body_parts << output_buffer
self.output_buffer = output_buffer[0,0]
self.output_buffer = output_buffer.respond_to?(:clone_empty) ? output_buffer.clone_empty : output_buffer[0, 0]
nil
end
end

View File

@@ -1,3 +1,5 @@
require 'active_support/core_ext/module/attr_internal'
module ActionView
module Helpers
# This module keeps all methods and behavior in ActionView

View File

@@ -8,8 +8,8 @@ module ActionView
module Helpers
# = Action View Date Helpers
#
# The Date Helper primarily creates select/option tags for different kinds of dates and date elements. All of the
# select-type methods share a number of common options that are as follows:
# The Date Helper primarily creates select/option tags for different kinds of dates and times or date and time
# elements. All of the select-type methods share a number of common options that are as follows:
#
# * <tt>:prefix</tt> - overwrites the default prefix of "date" used for the select names. So specifying "birthday"
# would give birthday[month] instead of date[month] if passed to the <tt>select_month</tt> method.
@@ -18,7 +18,7 @@ module ActionView
# the <tt>select_month</tt> method would use simply "date" (which can be overwritten using <tt>:prefix</tt>) instead
# of "date[month]".
module DateHelper
# Reports the approximate distance in time between two Time or Date objects or integers as seconds.
# Reports the approximate distance in time between two Time, Date or DateTime objects or integers as seconds.
# Set <tt>include_seconds</tt> to true if you want more detailed approximations when distance < 1 min, 29 secs.
# Distances are reported based on the following table:
#
@@ -176,37 +176,37 @@ module ActionView
# NOTE: Discarded selects will default to 1. So if no month select is available, January will be assumed.
#
# ==== Examples
# # Generates a date select that when POSTed is stored in the post variable, in the written_on attribute.
# date_select("post", "written_on")
# # Generates a date select that when POSTed is stored in the article variable, in the written_on attribute.
# date_select("article", "written_on")
#
# # Generates a date select that when POSTed is stored in the post variable, in the written_on attribute,
# # Generates a date select that when POSTed is stored in the article variable, in the written_on attribute,
# # with the year in the year drop down box starting at 1995.
# date_select("post", "written_on", :start_year => 1995)
# date_select("article", "written_on", :start_year => 1995)
#
# # Generates a date select that when POSTed is stored in the post variable, in the written_on attribute,
# # Generates a date select that when POSTed is stored in the article variable, in the written_on attribute,
# # with the year in the year drop down box starting at 1995, numbers used for months instead of words,
# # and without a day select box.
# date_select("post", "written_on", :start_year => 1995, :use_month_numbers => true,
# date_select("article", "written_on", :start_year => 1995, :use_month_numbers => true,
# :discard_day => true, :include_blank => true)
#
# # Generates a date select that when POSTed is stored in the post variable, in the written_on attribute
# # Generates a date select that when POSTed is stored in the article variable, in the written_on attribute
# # with the fields ordered as day, month, year rather than month, day, year.
# date_select("post", "written_on", :order => [:day, :month, :year])
# date_select("article", "written_on", :order => [:day, :month, :year])
#
# # Generates a date select that when POSTed is stored in the user variable, in the birthday attribute
# # lacking a year field.
# date_select("user", "birthday", :order => [:month, :day])
#
# # Generates a date select that when POSTed is stored in the post variable, in the written_on attribute
# # Generates a date select that when POSTed is stored in the article variable, in the written_on attribute
# # which is initially set to the date 3 days from the current date
# date_select("post", "written_on", :default => 3.days.from_now)
# date_select("article", "written_on", :default => 3.days.from_now)
#
# # Generates a date select that when POSTed is stored in the credit_card variable, in the bill_due attribute
# # that will have a default day of 20.
# date_select("credit_card", "bill_due", :default => { :day => 20 })
#
# # Generates a date select with custom prompts.
# date_select("post", "written_on", :prompt => { :day => 'Select day', :month => 'Select month', :year => 'Select year' })
# date_select("article", "written_on", :prompt => { :day => 'Select day', :month => 'Select month', :year => 'Select year' })
#
# The selects are prepared for multi-parameter assignment to an Active Record object.
#
@@ -228,20 +228,20 @@ module ActionView
# If anything is passed in the html_options hash it will be applied to every select tag in the set.
#
# ==== Examples
# # Creates a time select tag that, when POSTed, will be stored in the post variable in the sunrise attribute.
# time_select("post", "sunrise")
# # Creates a time select tag that, when POSTed, will be stored in the article variable in the sunrise attribute.
# time_select("article", "sunrise")
#
# # Creates a time select tag with a seconds field that, when POSTed, will be stored in the post variables in
# # Creates a time select tag with a seconds field that, when POSTed, will be stored in the article variables in
# # the sunrise attribute.
# time_select("post", "start_time", :include_seconds => true)
# time_select("article", "start_time", :include_seconds => true)
#
# # You can set the <tt>:minute_step</tt> to 15 which will give you: 00, 15, 30 and 45.
# time_select 'game', 'game_time', {:minute_step => 15}
#
# # Creates a time select tag with a custom prompt. Use <tt>:prompt => true</tt> for generic prompts.
# time_select("post", "written_on", :prompt => {:hour => 'Choose hour', :minute => 'Choose minute', :second => 'Choose seconds'})
# time_select("post", "written_on", :prompt => {:hour => true}) # generic prompt for hours
# time_select("post", "written_on", :prompt => true) # generic prompts for all
# time_select("article", "written_on", :prompt => {:hour => 'Choose hour', :minute => 'Choose minute', :second => 'Choose seconds'})
# time_select("article", "written_on", :prompt => {:hour => true}) # generic prompt for hours
# time_select("article", "written_on", :prompt => true) # generic prompts for all
#
# # You can set :ampm option to true which will show the hours as: 12 PM, 01 AM .. 11 PM.
# time_select 'game', 'game_time', {:ampm => true}
@@ -261,36 +261,36 @@ module ActionView
# If anything is passed in the html_options hash it will be applied to every select tag in the set.
#
# ==== Examples
# # Generates a datetime select that, when POSTed, will be stored in the post variable in the written_on
# # Generates a datetime select that, when POSTed, will be stored in the article variable in the written_on
# # attribute.
# datetime_select("post", "written_on")
# datetime_select("article", "written_on")
#
# # Generates a datetime select with a year select that starts at 1995 that, when POSTed, will be stored in the
# # post variable in the written_on attribute.
# datetime_select("post", "written_on", :start_year => 1995)
# # article variable in the written_on attribute.
# datetime_select("article", "written_on", :start_year => 1995)
#
# # Generates a datetime select with a default value of 3 days from the current time that, when POSTed, will
# # be stored in the trip variable in the departing attribute.
# datetime_select("trip", "departing", :default => 3.days.from_now)
#
# # Generate a datetime select with hours in the AM/PM format
# datetime_select("post", "written_on", :ampm => true)
# datetime_select("article", "written_on", :ampm => true)
#
# # Generates a datetime select that discards the type that, when POSTed, will be stored in the post variable
# # Generates a datetime select that discards the type that, when POSTed, will be stored in the article variable
# # as the written_on attribute.
# datetime_select("post", "written_on", :discard_type => true)
# datetime_select("article", "written_on", :discard_type => true)
#
# # Generates a datetime select with a custom prompt. Use <tt>:prompt => true</tt> for generic prompts.
# datetime_select("post", "written_on", :prompt => {:day => 'Choose day', :month => 'Choose month', :year => 'Choose year'})
# datetime_select("post", "written_on", :prompt => {:hour => true}) # generic prompt for hours
# datetime_select("post", "written_on", :prompt => true) # generic prompts for all
# datetime_select("article", "written_on", :prompt => {:day => 'Choose day', :month => 'Choose month', :year => 'Choose year'})
# datetime_select("article", "written_on", :prompt => {:hour => true}) # generic prompt for hours
# datetime_select("article", "written_on", :prompt => true) # generic prompts for all
#
# The selects are prepared for multi-parameter assignment to an Active Record object.
def datetime_select(object_name, method, options = {}, html_options = {})
InstanceTag.new(object_name, method, self, options.delete(:object)).to_datetime_select_tag(options, html_options)
end
# Returns a set of html select-tags (one for year, month, day, hour, and minute) pre-selected with the
# Returns a set of html select-tags (one for year, month, day, hour, minute and second) pre-selected with the
# +datetime+. It's also possible to explicitly set the order of the tags using the <tt>:order</tt> option with
# an array of symbols <tt>:year</tt>, <tt>:month</tt> and <tt>:day</tt> in the desired order. If you do not
# supply a Symbol, it will be appended onto the <tt>:order</tt> passed in. You can also add
@@ -343,15 +343,15 @@ module ActionView
# Returns a set of html select-tags (one for year, month, and day) pre-selected with the +date+.
# It's possible to explicitly set the order of the tags using the <tt>:order</tt> option with an array of
# symbols <tt>:year</tt>, <tt>:month</tt> and <tt>:day</tt> in the desired order. If you do not supply a Symbol,
# it will be appended onto the <tt>:order</tt> passed in.
# symbols <tt>:year</tt>, <tt>:month</tt> and <tt>:day</tt> in the desired order.
# If the array passed to the <tt>:order</tt> option does not contain all the three symbols, all tags will be hidden.
#
# If anything is passed in the html_options hash it will be applied to every select tag in the set.
#
# ==== Examples
# my_date = Time.today + 6.days
# my_date = Time.now + 6.days
#
# # Generates a date select that defaults to the date in my_date (six days afteri today).
# # Generates a date select that defaults to the date in my_date (six days after today).
# select_date(my_date)
#
# # Generates a date select that defaults to today (no specified date).
@@ -422,7 +422,7 @@ module ActionView
end
# Returns a select tag with options for each of the seconds 0 through 59 with the current second selected.
# The <tt>second</tt> can also be substituted for a second number.
# The <tt>datetime</tt> can be either a +Time+ or +DateTime+ object or an integer.
# Override the field name using the <tt>:field_name</tt> option, 'second' by default.
#
# ==== Examples
@@ -440,7 +440,7 @@ module ActionView
#
# # Generates a select field for seconds with a custom prompt. Use <tt>:prompt => true</tt> for a
# # generic prompt.
# select_minute(14, :prompt => 'Choose seconds')
# select_second(14, :prompt => 'Choose seconds')
#
def select_second(datetime, options = {}, html_options = {})
DateTimeSelector.new(datetime, options, html_options).select_second
@@ -448,21 +448,21 @@ module ActionView
# Returns a select tag with options for each of the minutes 0 through 59 with the current minute selected.
# Also can return a select tag with options by <tt>minute_step</tt> from 0 through 59 with the 00 minute
# selected. The <tt>minute</tt> can also be substituted for a minute number.
# selected. The <tt>datetime</tt> can be either a +Time+ or +DateTime+ object or an integer.
# Override the field name using the <tt>:field_name</tt> option, 'minute' by default.
#
# ==== Examples
# my_time = Time.now + 6.hours
#
# # Generates a select field for minutes that defaults to the minutes for the time in my_tiime.
# # Generates a select field for minutes that defaults to the minutes for the time in my_time.
# select_minute(my_time)
#
# # Generates a select field for minutes that defaults to the number given.
# select_minute(14)
#
# # Generates a select field for minutes that defaults to the minutes for the time in my_time
# # that is named 'stride' rather than 'second'.
# select_minute(my_time, :field_name => 'stride')
# # that is named 'moment' rather than 'minute'.
# select_minute(my_time, :field_name => 'moment')
#
# # Generates a select field for minutes with a custom prompt. Use <tt>:prompt => true</tt> for a
# # generic prompt.
@@ -473,7 +473,7 @@ module ActionView
end
# Returns a select tag with options for each of the hours 0 through 23 with the current hour selected.
# The <tt>hour</tt> can also be substituted for a hour number.
# The <tt>datetime</tt> can be either a +Time+ or +DateTime+ object or an integer.
# Override the field name using the <tt>:field_name</tt> option, 'hour' by default.
#
# ==== Examples
@@ -485,8 +485,8 @@ module ActionView
# # Generates a select field for hours that defaults to the number given.
# select_hour(13)
#
# # Generates a select field for hours that defaults to the minutes for the time in my_time
# # that is named 'stride' rather than 'second'.
# # Generates a select field for hours that defaults to the hour for the time in my_time
# # that is named 'stride' rather than 'hour'.
# select_hour(my_time, :field_name => 'stride')
#
# # Generates a select field for hours with a custom prompt. Use <tt>:prompt => true</tt> for a
@@ -501,11 +501,11 @@ module ActionView
end
# Returns a select tag with options for each of the days 1 through 31 with the current day selected.
# The <tt>date</tt> can also be substituted for a hour number.
# The <tt>date</tt> can also be substituted for a day number.
# Override the field name using the <tt>:field_name</tt> option, 'day' by default.
#
# ==== Examples
# my_date = Time.today + 2.days
# my_date = Time.now + 2.days
#
# # Generates a select field for days that defaults to the day for the date in my_date.
# select_day(my_time)

View File

@@ -4,6 +4,7 @@ require 'action_view/helpers/tag_helper'
require 'action_view/helpers/form_tag_helper'
require 'active_support/core_ext/class/attribute'
require 'active_support/core_ext/hash/slice'
require 'active_support/core_ext/module/method_names'
require 'active_support/core_ext/object/blank'
require 'active_support/core_ext/string/output_safety'
require 'active_support/core_ext/array/extract_options'
@@ -48,7 +49,7 @@ module ActionView
# <label for="person_last_name">Last name</label>:
# <input id="person_last_name" name="person[last_name]" size="30" type="text" /><br />
#
# <input id="person_submit" name="commit" type="submit" value="Create Person" />
# <input name="commit" type="submit" value="Create Person" />
# </form>
#
# As you see, the HTML reflects knowledge about the resource in several spots,
@@ -79,7 +80,7 @@ module ActionView
# <label for="person_last_name">Last name</label>:
# <input id="person_last_name" name="person[last_name]" size="30" type="text" value="Smith" /><br />
#
# <input id="person_submit" name="commit" type="submit" value="Update Person" />
# <input name="commit" type="submit" value="Update Person" />
# </form>
#
# Note that the endpoint, default values, and submit button label are tailored for <tt>@person</tt>.
@@ -202,13 +203,13 @@ module ActionView
#
# is equivalent to something like:
#
# <%= form_for @post, :as => :post, :url => post_path(@post), :html => { :class => "new_post", :id => "new_post" } do |f| %>
# <%= form_for @post, :as => :post, :url => posts_path, :html => { :class => "new_post", :id => "new_post" } do |f| %>
# ...
# <% end %>
#
# You can also overwrite the individual conventions, like this:
#
# <%= form_for(@post, :url => super_post_path(@post)) do |f| %>
# <%= form_for(@post, :url => super_posts_path) do |f| %>
# ...
# <% end %>
#
@@ -219,9 +220,9 @@ module ActionView
# <% end %>
#
# If you have an object that needs to be represented as a different
# parameter, like a Client that acts as a Person:
# parameter, like a Person that acts as a Client:
#
# <%= form_for(@post, :as => :client) do |f| %>
# <%= form_for(@person, :as => :client) do |f| %>
# ...
# <% end %>
#
@@ -232,7 +233,7 @@ module ActionView
# <% end %>
#
# If your resource has associations defined, for example, you want to add comments
# to the post given that the routes are set correctly:
# to the document given that the routes are set correctly:
#
# <%= form_for([@document, @comment]) do |f| %>
# ...
@@ -258,8 +259,8 @@ module ActionView
# :remote => true
#
# in the options hash creates a form that will allow the unobtrusive JavaScript drivers to modify its
# behaviour. The expected default behaviour is an XMLHttpRequest in the background instead of the regular
# POST arrangement, but ultimately the behaviour is the choice of the JavaScript driver implementor.
# behavior. The expected default behavior is an XMLHttpRequest in the background instead of the regular
# POST arrangement, but ultimately the behavior is the choice of the JavaScript driver implementor.
# Even though it's using JavaScript to serialize the form elements, the form submission will work just like
# a regular submission as viewed by the receiving side (all elements available in <tt>params</tt>).
#
@@ -290,7 +291,7 @@ module ActionView
#
# Example:
#
# <%= form(@post) do |f| %>
# <%= form_for(@post) do |f| %>
# <% f.fields_for(:comments, :include_id => false) do |cf| %>
# ...
# <% end %>
@@ -364,7 +365,7 @@ module ActionView
apply_form_for_options!(record, options)
end
options[:html][:remote] = options.delete(:remote)
options[:html][:remote] = options.delete(:remote) if options.has_key?(:remote)
options[:html][:method] = options.delete(:method) if options.has_key?(:method)
options[:html][:authenticity_token] = options.delete(:authenticity_token)
@@ -636,7 +637,7 @@ module ActionView
# # => <label for="post_privacy_public">Public Post</label>
#
# label(:post, :terms) do
# 'Accept <a href="/terms">Terms</a>.'
# 'Accept <a href="/terms">Terms</a>.'.html_safe
# end
def label(object_name, method, content_or_options = nil, options = nil, &block)
content_is_options = content_or_options.is_a?(Hash)
@@ -725,7 +726,7 @@ module ActionView
# # => <input type="file" id="user_avatar" name="user[avatar]" />
#
# file_field(:post, :attached, :accept => 'text/html')
# # => <input type="file" id="post_attached" name="post[attached]" />
# # => <input accept="text/html" type="file" id="post_attached" name="post[attached]" />
#
# file_field(:attachment, :file, :class => 'file_input')
# # => <input type="file" id="attachment_file" name="attachment[file]" class="file_input" />
@@ -846,7 +847,28 @@ module ActionView
InstanceTag.new(object_name, method, self, options.delete(:object)).to_radio_button_tag(tag_value, options)
end
# Returns a text_field of type "search".
# Returns an input of type "search" for accessing a specified attribute (identified by +method+) on an object
# assigned to the template (identified by +object+). Inputs of type "search" may be styled differently by
# some browsers
#
# ==== Examples
#
# search_field(:user, :name)
# # => <input id="user_name" name="user[name]" size="30" type="search" />
# search_field(:user, :name, :autosave => false)
# # => <input autosave="false" id="user_name" name="user[name]" size="30" type="search" />
# search_field(:user, :name, :results => 3)
# # => <input id="user_name" name="user[name]" results="3" size="30" type="search" />
# # Assume request.host returns "www.example.com"
# search_field(:user, :name, :autosave => true)
# # => <input autosave="com.example.www" id="user_name" name="user[name]" results="10" size="30" type="search" />
# search_field(:user, :name, :onsearch => true)
# # => <input id="user_name" incremental="true" name="user[name]" onsearch="true" size="30" type="search" />
# search_field(:user, :name, :autosave => false, :onsearch => true)
# # => <input autosave="false" id="user_name" incremental="true" name="user[name]" onsearch="true" size="30" type="search" />
# search_field(:user, :name, :autosave => true, :onsearch => true)
# # => <input autosave="com.example.www" id="user_name" incremental="true" name="user[name]" onsearch="true" results="10" size="30" type="search" />
def search_field(object_name, method, options = {})
options = options.stringify_keys
@@ -865,17 +887,29 @@ module ActionView
end
# Returns a text_field of type "tel".
#
# telephone_field("user", "phone")
# # => <input id="user_phone" name="user[phone]" size="30" type="tel" />
def telephone_field(object_name, method, options = {})
InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag("tel", options)
end
alias phone_field telephone_field
# Returns a text_field of type "url".
#
# url_field("user", "homepage")
# # => <input id="user_homepage" size="30" name="user[homepage]" type="url" />
def url_field(object_name, method, options = {})
InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag("url", options)
end
# Returns a text_field of type "email".
#
# email_field("user", "address")
# # => <input id="user_address" size="30" name="user[address]" type="email" />
def email_field(object_name, method, options = {})
InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag("email", options)
end
@@ -949,8 +983,16 @@ module ActionView
label_tag(name_and_id["id"], options, &block)
else
content = if text.blank?
object_name.gsub!(/\[(.*)_attributes\]\[\d\]/, '.\1')
method_and_value = tag_value.present? ? "#{method_name}.#{tag_value}" : method_name
I18n.t("helpers.label.#{object_name}.#{method_and_value}", :default => "").presence
if object.respond_to?(:to_model)
key = object.class.model_name.i18n_key
i18n_default = ["#{key}.#{method_and_value}".to_sym, ""]
end
i18n_default ||= ""
I18n.t("#{object_name}.#{method_and_value}", :default => i18n_default, :scope => "helpers.label").presence
else
text.to_s
end
@@ -1136,7 +1178,7 @@ module ActionView
options["name"] ||= tag_name_with_index(@auto_index)
options["id"] = options.fetch("id"){ tag_id_with_index(@auto_index) }
else
options["name"] ||= tag_name + (options.has_key?('multiple') ? '[]' : '')
options["name"] ||= tag_name + (options['multiple'] ? '[]' : '')
options["id"] = options.fetch("id"){ tag_id }
end
end
@@ -1217,7 +1259,7 @@ module ActionView
end
def fields_for(record_name, record_object = nil, fields_options = {}, &block)
fields_options, record_object = record_object, nil if record_object.is_a?(Hash)
fields_options, record_object = record_object, nil if record_object.is_a?(Hash) && record_object.extractable_options?
fields_options[:builder] ||= options[:builder]
fields_options[:parent_builder] = self

View File

@@ -298,12 +298,12 @@ module ActionView
return container if String === container
selected, disabled = extract_selected_and_disabled(selected).map do | r |
Array.wrap(r).map(&:to_s)
Array.wrap(r).map { |item| item.to_s }
end
container.map do |element|
html_attributes = option_html_attributes(element)
text, value = option_text_and_value(element).map(&:to_s)
text, value = option_text_and_value(element).map { |item| item.to_s }
selected_attribute = ' selected="selected"' if option_value_selected?(value, selected)
disabled_attribute = ' disabled="disabled"' if disabled && option_value_selected?(value, disabled)
%(<option value="#{ERB::Util.html_escape(value)}"#{selected_attribute}#{disabled_attribute}#{html_attributes}>#{ERB::Util.html_escape(text)}</option>)
@@ -427,7 +427,7 @@ module ActionView
#
# Sample usage (Hash):
# grouped_options = {
# 'North America' => [['United States','US], 'Canada'],
# 'North America' => [['United States','US'], 'Canada'],
# 'Europe' => ['Denmark','Germany','France']
# }
# grouped_options_for_select(grouped_options)
@@ -595,13 +595,13 @@ module ActionView
private
def add_options(option_tags, options, value = nil)
if options[:include_blank]
option_tags = "<option value=\"\">#{ERB::Util.html_escape(options[:include_blank]) if options[:include_blank].kind_of?(String)}</option>\n" + option_tags
option_tags = content_tag('option', options[:include_blank].kind_of?(String) ? options[:include_blank] : nil, :value => '') + "\n" + option_tags
end
if value.blank? && options[:prompt]
prompt = options[:prompt].kind_of?(String) ? options[:prompt] : I18n.translate('helpers.select.prompt', :default => 'Please select')
option_tags = "<option value=\"\">#{ERB::Util.html_escape(prompt)}</option>\n" + option_tags
option_tags = content_tag('option', prompt, :value => '') + "\n" + option_tags
end
option_tags.html_safe
option_tags
end
end

View File

@@ -30,7 +30,7 @@ module ActionView
# (by passing <tt>false</tt>).
# * A list of parameters to feed to the URL the form will be posted to.
# * <tt>:remote</tt> - If set to true, will allow the Unobtrusive JavaScript drivers to control the
# submit behaviour. By default this behaviour is an ajax submit.
# submit behavior. By default this behavior is an ajax submit.
#
# ==== Examples
# form_tag('/posts')
@@ -56,8 +56,8 @@ module ActionView
# form_tag('http://far.away.com/form', :authenticity_token => "cf50faa3fe97702ca1ae")
# # form with custom authenticity token
#
def form_tag(url_for_options = {}, options = {}, *parameters_for_url, &block)
html_options = html_options_for_form(url_for_options, options, *parameters_for_url)
def form_tag(url_for_options = {}, options = {}, &block)
html_options = html_options_for_form(url_for_options, options)
if block_given?
form_tag_in_block(html_options, &block)
else
@@ -114,11 +114,11 @@ module ActionView
html_name = (options[:multiple] == true && !name.to_s.ends_with?("[]")) ? "#{name}[]" : name
if options.delete(:include_blank)
option_tags = "<option value=\"\"></option>".html_safe + option_tags
option_tags = content_tag(:option, '', :value => '').safe_concat(option_tags)
end
if prompt = options.delete(:prompt)
option_tags = "<option value=\"\">#{prompt}</option>".html_safe + option_tags
option_tags = content_tag(:option, prompt, :value => '').safe_concat(option_tags)
end
content_tag :select, option_tags, { "name" => html_name, "id" => sanitize_to_id(name) }.update(options.stringify_keys)
@@ -598,12 +598,12 @@ module ActionView
end
private
def html_options_for_form(url_for_options, options, *parameters_for_url)
def html_options_for_form(url_for_options, options)
options.stringify_keys.tap do |html_options|
html_options["enctype"] = "multipart/form-data" if html_options.delete("multipart")
# The following URL is unescaped, this is just a hash of options, and it is the
# responsibility of the caller to escape all the values.
html_options["action"] = url_for(url_for_options, *parameters_for_url)
html_options["action"] = url_for(url_for_options)
html_options["accept-charset"] = "UTF-8"
html_options["data-remote"] = true if html_options.delete("remote")
html_options["authenticity_token"] = html_options.delete("authenticity_token") if html_options.has_key?("authenticity_token")

View File

@@ -18,7 +18,8 @@ module ActionView
# $('some_element').replaceWith('<%=j render 'some/element_template' %>');
def escape_javascript(javascript)
if javascript
javascript.gsub(/(\\|<\/|\r\n|[\n\r"'])/) { JS_ESCAPE_MAP[$1] }
result = javascript.gsub(/(\\|<\/|\r\n|[\n\r"'])/) {|match| JS_ESCAPE_MAP[match] }
javascript.html_safe? ? result.html_safe : result
else
''
end
@@ -84,7 +85,7 @@ module ActionView
# If +html_options+ has an <tt>:onclick</tt>, that one is put before +function+. Once all
# the JavaScript is set, the helper appends "; return false;".
#
# The +href+ attribute of the tag is set to "#" unles +html_options+ has one.
# The +href+ attribute of the tag is set to "#" unless +html_options+ has one.
#
# link_to_function "Greeting", "alert('Hello world!')", :class => "nav_link"
# # => <a class="nav_link" href="#" onclick="alert('Hello world!'); return false;">Greeting</a>

View File

@@ -1,3 +1,5 @@
# encoding: utf-8
require 'active_support/core_ext/big_decimal/conversions'
require 'active_support/core_ext/float/rounding'
require 'active_support/core_ext/object/blank'
@@ -98,10 +100,10 @@ module ActionView
# number_to_currency(1234567890.50) # => $1,234,567,890.50
# number_to_currency(1234567890.506) # => $1,234,567,890.51
# number_to_currency(1234567890.506, :precision => 3) # => $1,234,567,890.506
# number_to_currency(1234567890.506, :locale => :fr) # => 1 234 567 890,506
# number_to_currency(1234567890.506, :locale => :fr) # => 1 234 567 890,51
#
# number_to_currency(-1234567890.50, :negative_format => "(%u%n)")
# # => ($1,234,567,890.51)
# # => ($1,234,567,890.50)
# number_to_currency(1234567890.50, :unit => "&pound;", :separator => ",", :delimiter => "")
# # => &pound;1234567890,50
# number_to_currency(1234567890.50, :unit => "&pound;", :separator => ",", :delimiter => "", :format => "%n %u")
@@ -211,7 +213,7 @@ module ActionView
defaults = I18n.translate(:'number.format', :locale => options[:locale], :default => {})
options = options.reverse_merge(defaults)
parts = number.to_s.split('.')
parts = number.to_s.to_str.split('.')
parts[0].gsub!(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1#{options[:delimiter]}")
parts.join(options[:separator]).html_safe
@@ -342,7 +344,7 @@ module ActionView
options[:strip_insignificant_zeros] = true if not options.key?(:strip_insignificant_zeros)
storage_units_format = I18n.translate(:'number.human.storage_units.format', :locale => options[:locale], :raise => true)
base = options[:prefix] == :si ? 1000 : 1024
if number.to_i < base

View File

@@ -81,7 +81,7 @@ module ActionView
# strip_tags("<div id='top-bar'>Welcome to my website!</div>")
# # => Welcome to my website!
def strip_tags(html)
self.class.full_sanitizer.sanitize(html).try(:html_safe)
self.class.full_sanitizer.sanitize(html)
end
# Strips all link tags from +text+ leaving just the link text.

View File

@@ -1,101 +0,0 @@
require 'uri'
require 'action_view/helpers/asset_paths'
module ActionView
module Helpers
module SprocketsHelper
def debug_assets?
params[:debug_assets] == '1' ||
params[:debug_assets] == 'true'
end
def asset_path(source, default_ext = nil, body = false)
source = source.logical_path if source.respond_to?(:logical_path)
path = sprockets_asset_paths.compute_public_path(source, 'assets', default_ext, true)
body ? "#{path}?body=1" : path
end
def sprockets_javascript_include_tag(source, options = {})
debug = options.key?(:debug) ? options.delete(:debug) : debug_assets?
body = options.key?(:body) ? options.delete(:body) : false
if debug && asset = sprockets_asset_paths.asset_for(source, 'js')
asset.to_a.map { |dep|
sprockets_javascript_include_tag(dep, :debug => false, :body => true)
}.join("\n").html_safe
else
options = {
'type' => "text/javascript",
'src' => asset_path(source, 'js', body)
}.merge(options.stringify_keys)
content_tag 'script', "", options
end
end
def sprockets_stylesheet_link_tag(source, options = {})
debug = options.key?(:debug) ? options.delete(:debug) : debug_assets?
body = options.key?(:body) ? options.delete(:body) : false
if debug && asset = sprockets_asset_paths.asset_for(source, 'css')
asset.to_a.map { |dep|
sprockets_stylesheet_link_tag(dep, :debug => false, :body => true)
}.join("\n").html_safe
else
options = {
'rel' => "stylesheet",
'type' => "text/css",
'media' => "screen",
'href' => asset_path(source, 'css', body)
}.merge(options.stringify_keys)
tag 'link', options
end
end
private
def sprockets_asset_paths
@sprockets_asset_paths ||= begin
config = self.config if respond_to?(:config)
controller = self.controller if respond_to?(:controller)
SprocketsHelper::AssetPaths.new(config, controller)
end
end
class AssetPaths < ActionView::Helpers::AssetPaths #:nodoc:
def asset_for(source, ext)
source = source.to_s
return nil if is_uri?(source)
source = rewrite_extension(source, nil, ext)
assets[source]
end
def rewrite_asset_path(source, dir)
if source[0] == ?/
source
else
assets.path(source, performing_caching?, dir)
end
end
def rewrite_extension(source, dir, ext)
if ext && File.extname(source).empty?
"#{source}.#{ext}"
else
source
end
end
def assets
Rails.application.assets
end
# When included in Sprockets::Context, we need to ask the top-level config as the controller is not available
def performing_caching?
@config ? @config.perform_caching : Rails.application.config.action_controller.perform_caching
end
end
end
end
end

View File

@@ -255,9 +255,10 @@ module ActionView
# simple_format("<span>I'm allowed!</span> It's true.", {}, :sanitize => false)
# # => "<p><span>I'm allowed!</span> It's true.</p>"
def simple_format(text, html_options={}, options={})
text = ''.html_safe if text.nil?
text = '' if text.nil?
start_tag = tag('p', html_options, true)
text = sanitize(text) unless options[:sanitize] == false
text = text.to_str
text.gsub!(/\r\n?/, "\n") # \r\n and \r -> \n
text.gsub!(/\n\n+/, "</p>\n\n#{start_tag}") # 2+ newline -> paragraph
text.gsub!(/([^\n]\n)(?=[^\n])/, '\1<br />') # 1 newline -> br
@@ -279,7 +280,7 @@ module ActionView
# @items = [1,2,3,4]
# <table>
# <% @items.each do |item| %>
# <tr class="<%= cycle("even", "odd") -%>">
# <tr class="<%= cycle("odd", "even") -%>">
# <td>item</td>
# </tr>
# <% end %>

View File

@@ -5,7 +5,7 @@ module I18n
class ExceptionHandler
include Module.new {
def call(exception, locale, key, options)
exception.is_a?(MissingTranslation) ? super.html_safe : super
exception.is_a?(MissingTranslation) && options[:rescue_format] == :html ? super.html_safe : super
end
}
end
@@ -25,7 +25,7 @@ module ActionView
# * a titleized version of the last key segment as a text.
#
# E.g. the value returned for a missing translation key :"blog.post.title" will be
# <span class="translation_missing" title="translation missing: blog.post.title">Title</span>.
# <span class="translation_missing" title="translation missing: en.blog.post.title">Title</span>.
# This way your views will display rather reasonable strings but it will still
# be easy to spot missing translations.
#
@@ -45,11 +45,18 @@ module ActionView
# you know what kind of output to expect when you call translate in a template.
def translate(key, options = {})
options.merge!(:rescue_format => :html) unless options.key?(:rescue_format)
translation = I18n.translate(scope_key_by_partial(key), options)
if html_safe_translation_key?(key) && translation.respond_to?(:html_safe)
translation.html_safe
if html_safe_translation_key?(key)
html_safe_options = options.dup
options.except(*I18n::RESERVED_KEYS).each do |name, value|
unless name == :count && value.is_a?(Numeric)
html_safe_options[name] = ERB::Util.html_escape(value.to_s)
end
end
translation = I18n.translate(scope_key_by_partial(key), html_safe_options)
translation.respond_to?(:html_safe) ? translation.html_safe : translation
else
translation
I18n.translate(scope_key_by_partial(key), options)
end
end
alias :t :translate

View File

@@ -55,9 +55,9 @@ module ActionView
#
# ==== Relying on named routes
#
# If you instead of a hash pass a record (like an Active Record or Active Resource) as the options parameter,
# you'll trigger the named route for that record. The lookup will happen on the name of the class. So passing
# a Workshop object will attempt to use the +workshop_path+ route. If you have a nested route, such as
# Passing a record (like an Active Record or Active Resource) instead of a Hash as the options parameter will
# trigger the named route for that record. The lookup will happen on the name of the class. So passing a
# Workshop object will attempt to use the +workshop_path+ route. If you have a nested route, such as
# +admin_workshop_path+ you'll have to call that explicitly (it's impossible for +url_for+ to guess that route).
#
# ==== Examples
@@ -112,13 +112,13 @@ module ActionView
end
end
# Creates a link tag of the given +name+ using a URL created by the set
# of +options+. See the valid options in the documentation for
# +url_for+. It's also possible to pass a string instead
# of an options hash to get a link tag that uses the value of the string as the
# href for the link, or use <tt>:back</tt> to link to the referrer - a JavaScript back
# link will be used in place of a referrer if none exists. If +nil+ is passed as
# a name, the link itself will become the name.
# Creates a link tag of the given +name+ using a URL created by the set of +options+.
# See the valid options in the documentation for +url_for+. It's also possible to
# pass a String instead of an options hash, which generates a link tag that uses the
# value of the String as the href for the link. Using a <tt>:back</tt> Symbol instead
# of an options hash will generate a link to the referrer (a JavaScript back link
# will be used in place of a referrer if none exists). If +nil+ is passed as the name
# the value of the link itself will become the name.
#
# ==== Signatures
#
@@ -268,7 +268,7 @@ module ActionView
# to change the HTTP verb used to submit the form.
#
# ==== Options
# The +options+ hash accepts the same options as url_for.
# The +options+ hash accepts the same options as +url_for+.
#
# There are a few special +html_options+:
# * <tt>:method</tt> - Symbol of HTTP verb. Supported verbs are <tt>:post</tt>, <tt>:get</tt>,
@@ -278,7 +278,8 @@ module ActionView
# prompt with the question specified. If the user accepts, the link is
# processed normally, otherwise no action is taken.
# * <tt>:remote</tt> - If set to true, will allow the Unobtrusive JavaScript drivers to control the
# submit behaviour. By default this behaviour is an ajax submit.
# submit behavior. By default this behavior is an ajax submit.
# * <tt>:form</tt> - This hash will be form attributes
# * <tt>:form_class</tt> - This controls the class of the form within which the submit button will
# be placed
#
@@ -295,6 +296,12 @@ module ActionView
# # </form>"
#
#
# <%= button_to "Create", :action => "create", :remote => true, :form => { "data-type" => "json" } %>
# # => "<form method="post" action="/images/create" class="button_to" data-remote="true" data-type="json">
# # <div><input value="Create" type="submit" /></div>
# # </form>"
#
#
# <%= button_to "Delete Image", { :action => "delete", :id => @image.id },
# :confirm => "Are you sure?", :method => :delete %>
# # => "<form method="post" action="/images/delete/1" class="button_to">
@@ -324,10 +331,11 @@ module ActionView
end
form_method = method.to_s == 'get' ? 'get' : 'post'
form_class = html_options.delete('form_class') || 'button_to'
form_options = html_options.delete('form') || {}
form_options[:class] ||= html_options.delete('form_class') || 'button_to'
remote = html_options.delete('remote')
request_token_tag = ''
if form_method == 'post' && protect_against_forgery?
request_token_tag = tag(:input, :type => "hidden", :name => request_forgery_protection_token.to_s, :value => form_authenticity_token)
@@ -340,8 +348,10 @@ module ActionView
html_options.merge!("type" => "submit", "value" => name)
("<form method=\"#{form_method}\" action=\"#{ERB::Util.html_escape(url)}\" #{"data-remote=\"true\"" if remote} class=\"#{ERB::Util.html_escape(form_class)}\"><div>" +
method_tag + tag("input", html_options) + request_token_tag + "</div></form>").html_safe
form_options.merge!(:method => form_method, :action => url)
form_options.merge!("data-remote" => "true") if remote
"#{tag(:form, form_options, true)}<div>#{method_tag}#{tag("input", html_options)}#{request_token_tag}</div></form>".html_safe
end
@@ -497,14 +507,14 @@ module ActionView
}.compact
extras = extras.empty? ? '' : '?' + ERB::Util.html_escape(extras.join('&'))
email_address_obfuscated = email_address.dup
email_address_obfuscated = email_address.to_str
email_address_obfuscated.gsub!(/@/, html_options.delete("replace_at")) if html_options.key?("replace_at")
email_address_obfuscated.gsub!(/\./, html_options.delete("replace_dot")) if html_options.key?("replace_dot")
case encode
when "javascript"
string = ''
html = content_tag("a", name || email_address_obfuscated.html_safe, html_options.merge("href" => "mailto:#{email_address}#{extras}".html_safe))
html = escape_javascript(html)
html = escape_javascript(html.to_str)
"document.write('#{html}');".each_byte do |c|
string << sprintf("%%%x", c)
end
@@ -619,7 +629,9 @@ module ActionView
end
def add_method_to_attributes!(html_options, method)
html_options["rel"] = "nofollow" if method.to_s.downcase != "get"
if method && method.to_s.downcase != "get"
html_options["rel"] = "#{html_options["rel"].to_s} nofollow".split(" ").uniq.join(" ")
end
html_options["data-method"] = method
end

View File

@@ -10,7 +10,7 @@ module ActionView
# this key is generated just once during the request, it speeds up all cache accesses.
class LookupContext #:nodoc:
attr_accessor :prefixes
mattr_accessor :fallbacks
@@fallbacks = FallbackFileSystemResolver.instances

View File

@@ -12,8 +12,7 @@ module ActionView
#
# <%= render :partial => "account" %>
#
# This would render "advertiser/_account.html.erb" and pass the instance variable @account in as a local variable
# +account+ to the template for display.
# This would render "advertiser/_account.html.erb".
#
# In another template for Advertiser#buy, we could have:
#
@@ -28,32 +27,24 @@ module ActionView
#
# == The :as and :object options
#
# By default <tt>ActionView::Partials::PartialRenderer</tt> has its object in a local variable with the same
# name as the template. So, given
#
# <%= render :partial => "contract" %>
#
# within contract we'll get <tt>@contract</tt> in the local variable +contract+, as if we had written
#
# <%= render :partial => "contract", :locals => { :contract => @contract } %>
#
# With the <tt>:as</tt> option we can specify a different name for said local variable. For example, if we
# wanted it to be +agreement+ instead of +contract+ we'd do:
#
# <%= render :partial => "contract", :as => 'agreement' %>
#
# The <tt>:object</tt> option can be used to directly specify which object is rendered into the partial;
# useful when the template's object is elsewhere, in a different ivar or in a local variable for instance.
#
# Revisiting a previous example we could have written this code:
# By default <tt>ActionView::Partials::PartialRenderer</tt> doesn't have any local variables.
# The <tt>:object</tt> option can be used to pass an object to the partial. For instance:
#
# <%= render :partial => "account", :object => @buyer %>
#
# <% @advertisements.each do |ad| %>
# <%= render :partial => "ad", :object => ad %>
# <% end %>
# would provide the +@buyer+ object to the partial, available under the local variable +account+ and is
# equivalent to:
#
# The <tt>:object</tt> and <tt>:as</tt> options can be used together.
# <%= render :partial => "account", :locals => { :account => @buyer } %>
#
# With the <tt>:as</tt> option we can specify a different name for said local variable. For example, if we
# wanted it to be +user+ instead of +account+ we'd do:
#
# <%= render :partial => "account", :object => @buyer, :as => 'user' %>
#
# This is equivalent to
#
# <%= render :partial => "account", :locals => { :user => @buyer } %>
#
# == Rendering a collection of partials
#
@@ -366,14 +357,28 @@ module ActionView
def partial_path(object = @object)
@partial_names[object.class.name] ||= begin
object = object.to_model if object.respond_to?(:to_model)
object.class.model_name.partial_path.dup.tap do |partial|
path = @lookup_context.prefixes.first
partial.insert(0, "#{File.dirname(path)}/") if partial.include?(?/) && path.include?(?/)
merge_path_into_partial(path, partial)
end
end
end
def merge_path_into_partial(path, partial)
if path.include?(?/) && partial.include?(?/)
overlap = []
path_array = File.dirname(path).split('/')
partial_array = partial.split('/')[0..-3] # skip model dir & partial
path_array.each_with_index do |dir, index|
overlap << dir if dir == partial_array[index]
end
partial.gsub!(/^#{overlap.join('/')}\//,'')
partial.insert(0, "#{File.dirname(path)}/")
end
end
def retrieve_variable(path)
variable = @options[:as].try(:to_sym) || path[%r'_?(\w+)(\.\w+)*$', 1].to_sym
variable_counter = :"#{variable}_counter" if @collection

View File

@@ -58,7 +58,6 @@ module ActionView
attr_reader :original_exception, :backtrace
def initialize(template, assigns, original_exception)
super(original_exception.message)
@template, @assigns, @original_exception = template, assigns.dup, original_exception
@sub_templates = nil
@backtrace = original_exception.backtrace
@@ -68,6 +67,10 @@ module ActionView
@template.identifier
end
def message
original_exception.message
end
def sub_template_message
if @sub_templates
"Trace of template inclusion: " +

View File

@@ -149,8 +149,12 @@ module ActionView
# Helper for building query glob string based on resolver's pattern.
def build_query(path, details)
query = @pattern.dup
query.gsub!(/\:prefix(\/)?/, path.prefix.empty? ? "" : "#{path.prefix}\\1") # prefix can be empty...
query.gsub!(/\:action/, path.partial? ? "_#{path.name}" : path.name)
prefix = path.prefix.empty? ? "" : "#{escape_entry(path.prefix)}\\1"
query.gsub!(/\:prefix(\/)?/, prefix)
partial = escape_entry(path.partial? ? "_#{path.name}" : path.name)
query.gsub!(/\:action/, partial)
details.each do |ext, variants|
query.gsub!(/\:#{ext}/, "{#{variants.compact.uniq.join(',')}}")
@@ -159,6 +163,10 @@ module ActionView
File.expand_path(query, @path)
end
def escape_entry(entry)
entry.gsub(/[*?{}\[\]]/, '\\\\\\&')
end
# Returns the file mtime from the filesystem.
def mtime(p)
File.stat(p).mtime
@@ -235,11 +243,11 @@ module ActionView
class OptimizedFileSystemResolver < FileSystemResolver #:nodoc:
def build_query(path, details)
exts = EXTENSIONS.map { |ext| details[ext] }
query = File.join(@path, path)
query = escape_entry(File.join(@path, path))
exts.each do |ext|
query << "{"
ext.compact.each { |e| query << ".#{e}," }
ext.compact.uniq.each { |e| query << ".#{e}," }
query << "}"
end

View File

@@ -65,7 +65,7 @@ module ActionView
methods.flatten.each do |method|
_helpers.module_eval <<-end_eval
def #{method}(*args, &block) # def current_user(*args, &block)
_test_case.send(%(#{method}), *args, &block) # test_case.send(%(current_user), *args, &block)
_test_case.send(%(#{method}), *args, &block) # _test_case.send(%(current_user), *args, &block)
end # end
end_eval
end

View File

@@ -34,7 +34,7 @@ module ActionView #:nodoc:
templates << Template.new(source, _path, handler,
:virtual_path => path.virtual, :format => format, :updated_at => updated_at)
end
templates.sort_by {|t| -t.identifier.match(/^#{query}$/).captures.reject(&:blank?).size }
end
end

View File

@@ -0,0 +1,95 @@
require "fileutils"
namespace :assets do
def ruby_rake_task(task)
env = ENV['RAILS_ENV'] || 'production'
groups = ENV['RAILS_GROUPS'] || 'assets'
args = [$0, task,"RAILS_ENV=#{env}","RAILS_GROUPS=#{groups}"]
args << "--trace" if Rake.application.options.trace
ruby *args
end
# We are currently running with no explicit bundler group
# and/or no explicit environment - we have to reinvoke rake to
# execute this task.
def invoke_or_reboot_rake_task(task)
if ENV['RAILS_GROUPS'].to_s.empty? || ENV['RAILS_ENV'].to_s.empty?
ruby_rake_task task
else
Rake::Task[task].invoke
end
end
desc "Compile all the assets named in config.assets.precompile"
task :precompile do
invoke_or_reboot_rake_task "assets:precompile:all"
end
namespace :precompile do
def internal_precompile(digest=nil)
unless Rails.application.config.assets.enabled
warn "Cannot precompile assets if sprockets is disabled. Please set config.assets.enabled to true"
exit
end
# Ensure that action view is loaded and the appropriate
# sprockets hooks get executed
_ = ActionView::Base
config = Rails.application.config
config.assets.compile = true
config.assets.digest = digest unless digest.nil?
config.assets.digests = {}
env = Rails.application.assets
target = File.join(Rails.public_path, config.assets.prefix)
compiler = Sprockets::StaticCompiler.new(env,
target,
config.assets.precompile,
:manifest_path => config.assets.manifest,
:digest => config.assets.digest,
:manifest => digest.nil?)
compiler.compile
end
task :all do
Rake::Task["assets:precompile:primary"].invoke
# We need to reinvoke in order to run the secondary digestless
# asset compilation run - a fresh Sprockets environment is
# required in order to compile digestless assets as the
# environment has already cached the assets on the primary
# run.
ruby_rake_task "assets:precompile:nondigest" if Rails.application.config.assets.digest
end
task :primary => ["assets:environment", "tmp:cache:clear"] do
internal_precompile
end
task :nondigest => ["assets:environment", "tmp:cache:clear"] do
internal_precompile(false)
end
end
desc "Remove compiled assets"
task :clean do
invoke_or_reboot_rake_task "assets:clean:all"
end
namespace :clean do
task :all => ["assets:environment", "tmp:cache:clear"] do
config = Rails.application.config
public_asset_path = File.join(Rails.public_path, config.assets.prefix)
rm_rf public_asset_path, :secure => true
end
end
task :environment do
if Rails.application.config.assets.initialize_on_precompile
Rake::Task["environment"].invoke
else
Rails.application.initialize!(:assets)
Sprockets::Bootstrap.new(Rails.application).run
end
end
end

View File

@@ -0,0 +1,65 @@
module Sprockets
class Bootstrap
def initialize(app)
@app = app
end
# TODO: Get rid of config.assets.enabled
def run
app, config = @app, @app.config
return unless app.assets
config.assets.paths.each { |path| app.assets.append_path(path) }
if config.assets.compress
# temporarily hardcode default JS compressor to uglify. Soon, it will work
# the same as SCSS, where a default plugin sets the default.
unless config.assets.js_compressor == false
app.assets.js_compressor = LazyCompressor.new { expand_js_compressor(config.assets.js_compressor || :uglifier) }
end
unless config.assets.css_compressor == false
app.assets.css_compressor = LazyCompressor.new { expand_css_compressor(config.assets.css_compressor) }
end
end
if config.assets.compile
app.routes.prepend do
mount app.assets => config.assets.prefix
end
end
if config.assets.digest
app.assets = app.assets.index
end
end
protected
def expand_js_compressor(sym)
case sym
when :closure
require 'closure-compiler'
Closure::Compiler.new
when :uglifier
require 'uglifier'
Uglifier.new
when :yui
require 'yui/compressor'
YUI::JavaScriptCompressor.new
else
sym
end
end
def expand_css_compressor(sym)
case sym
when :yui
require 'yui/compressor'
YUI::CssCompressor.new
else
sym
end
end
end
end

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