Compare commits

..

6823 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
Joshua Peek
7ad24a7d96 Require sprockets beta 8 2011-05-22 20:10:13 -05:00
Joshua Peek
27159dff0f Add debug_asset support 2011-05-22 15:10:53 -05:00
Joshua Peek
cdc9c3c4af Lock to stable sprockets beta 2011-05-22 14:50:11 -05:00
José Valim
9164dda151 Fix I18n dependency as final is out. 2011-05-22 13:39:13 +02:00
José Valim
a6e945554d Fix failing tests. 2011-05-22 13:21:47 +02:00
José Valim
a0eee5f3f2 Merge pull request #1208 from dasch/patch-1
Remove superfluous whitespace from ActiveModel::SecurePassword
2011-05-22 04:11:29 -07:00
Daniel Schierbeck
93659a3166 Remove superfluous whitespace from ActiveModel::SecurePassword
Only one space is needed, yo!
2011-05-22 04:02:47 -07:00
José Valim
1ab556fa89 Merge pull request #1206 from arunagw/jruby_openssl_load
Let's load jruby-openssl now for all. #jruby
2011-05-22 03:57:51 -07:00
José Valim
f924dbe566 Merge pull request #1199 from vatrai/jdon_engine_test_fix
test fix jdom_engine_test
2011-05-22 03:48:55 -07:00
José Valim
c932539c5b Merge pull request #1198 from guilleiguaran/changelog_pluralize_table_names
Adding pluralize_table_names change to CHANGELOG
2011-05-22 03:46:32 -07:00
Arun Agrawal
69bad8f517 Let's load jruby-openssl now for all. #jruby 2011-05-22 15:49:30 +05:30
Vishnu Atrai
7bf9d6f3a8 test fix jdom_engine_test 2011-05-22 10:20:45 +05:30
Guillermo Iguaran
6e5419a0b1 Adding pluralize_table_names change to CHANGELOG 2011-05-21 22:16:34 -05:00
David Heinemeier Hansson
82857adc56 Bump versions for rc1 2011-05-21 20:56:52 -05:00
David Heinemeier Hansson
073f80eaa8 Merge pull request #1195 from dmathieu/try_undefined_method
Don't raise NoMethodError the tried method doesn't exists
2011-05-21 17:56:44 -07:00
dmathieu
a85e00c01c make sure missing method does not fail with arguments 2011-05-22 00:32:58 +02:00
dmathieu
29a5aeaae9 don't raise NoMethodError the tried method doesn't exists 2011-05-21 23:43:12 +02:00
José Valim
f674aed150 Merge pull request #1191 from arunagw/removal_extra
Removal require again from tests.
2011-05-21 13:08:13 -07:00
Arun Agrawal
40e33771e6 Removal require again from tests. 2011-05-22 00:55:12 +05:30
José Valim
f007885a03 Merge pull request #1188 from thedarkone/duplicable-duration
Fix AS::Duration#duplicable? on 1.8
2011-05-21 10:42:01 -07:00
Xavier Noria
eb0257944e Merge pull request #1180 from Karunakar/documentation_change
Documentation Error Fixed for ticket #839
2011-05-21 10:39:28 -07:00
David Heinemeier Hansson
f62aba74ef Now that we are compatible with Rake 0.9.0, lets allow it back in 2011-05-21 12:04:41 -05:00
David Heinemeier Hansson
8b719cf3f7 Merge pull request #1174 from bilts/fix-rake-dsl
Make Rake::DSL methods available within Railtie rake_tasks block (so we're compatible with Rake 0.9.0).
2011-05-21 09:57:37 -07:00
Santiago Pastorino
da8469fa7d Merge pull request #1187 from thedarkone/polymorphic-class-fix
Handle polymorphic_type NOT NULL columns
2011-05-21 09:43:42 -07:00
David Heinemeier Hansson
eba978ca50 Uglifier works properly now with 0.5.4 2011-05-21 11:23:54 -05:00
David Heinemeier Hansson
f3c3a785bd Bind to Rake 0.8.7 until a fix for Rake 0.9.0 is released 2011-05-21 10:56:03 -05:00
Andrew White
09daaaa1e0 Add support for passing mass assignment roles to dynamic finders. Closes #1170. 2011-05-21 16:33:54 +01:00
thedarkone
03cd88a072 Fix AS::Duration#duplicable? on 1.8 2011-05-21 15:32:20 +02:00
thedarkone
1c614bcb0f Handle polymorphic_type NOT NULL-able columns as well. 2011-05-21 15:18:09 +02:00
José Valim
1a959ad72f Merge pull request #1182 from prakashmurthy/patch-1
Enhanced test for duplicable in  active_support/core_ext/object/duplicable.rb
2011-05-21 04:57:36 -07:00
José Valim
26703f4905 Merge pull request #1165 from arunagw/rubyforge_remove
Not updating rubyforge for new versions.
2011-05-21 04:55:37 -07:00
Prakash Murthy
6b0dc80adc Check for Module.new.dup as well in https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/object/duplicable.rb 2011-05-21 02:19:52 -07:00
Jon Leighton
d62a39a22b Merge pull request #1162 from guilleiguaran/singularize_individual_table_name
Singularize individual table name
2011-05-21 01:30:00 -07:00
Ganesh Kumar
0a15928f06 Merge remote branch 'upstream/master' into documentation_change 2011-05-21 13:56:24 +05:30
Ganesh Kumar
3d789ea4b9 ActionMailer deliver method Documentation corrected Ticket #761 2011-05-21 13:55:52 +05:30
José Valim
7288682be4 Merge pull request #1179 from castlerock/activesupport_test
fixed failing tests of ActiveSupport for deprecation test
2011-05-21 00:37:17 -07:00
Karunakar (Ruby)
b134e0f445 Documentation Error Fixed for ticket #839 2011-05-21 13:01:53 +05:30
Raghunadh
cd6ae26e8f fixed failing tests of ActiveSupport for deprecation test 2011-05-21 00:29:30 -07:00
Andrew White
89d7133082 Correct example and expand on description of :shallow option for resources 2011-05-21 07:11:47 +01:00
José Valim
ea548c8df4 Merge pull request #1178 from joshk/ruby19_warning
Corrected a minor ruby19 variable name reuse warning
2011-05-20 22:31:44 -07:00
Josh Kalderimis
c9b5d64ec4 corrected a minor ruby19 variable name reuse warning 2011-05-21 01:27:35 -04:00
José Valim
e4bcd5e7eb Merge pull request #1177 from joshk/ruby19_warnings
Fixed some ruby 19 warnings
2011-05-20 22:24:49 -07:00
Josh Kalderimis
c659505368 fixed some ruby 19 warnings, including circular requires and variable name reuse 2011-05-21 01:23:17 -04:00
José Valim
fa3f273173 Merge pull request #1175 from joshk/active_resource_correction
attr_accessor_with_default removed from ActiveResource
2011-05-20 22:21:21 -07:00
Josh Kalderimis
1bfe9ec5de attr_accessor_with_default is deprecated, so lets not use it in ActiveResource 2011-05-21 01:05:35 -04:00
Guillermo Iguaran
e0e8918003 AliasTracker.pluralize use pluralize_table_names of model 2011-05-20 22:54:55 -05:00
Patrick Quinn
e290835667 Make Rake::DSL methods available within Railtie rake_tasks block
Fixes incompatibility introduced by Rake 0.9.0
2011-05-20 22:58:05 -04:00
José Valim
5eadb4d73d Temporarily ship with ContentLength middleware. 2011-05-20 22:20:51 +02:00
José Valim
19ee8413de Merge pull request #1169 from senny/specify_a_custom_active_model_name
Specify the name to be used for ActiveModel::Name fixes #1168
2011-05-20 08:17:11 -07:00
Yves Senn
e5429b789d Specify the name to be used for ActiveModel::Name fixes #1168
This patch allows to specify the name of your models independent of the class name.
2011-05-20 16:59:09 +02:00
Xavier Noria
499825e19f Merge pull request #1157 from smartinez87/extra_whitespaces
Remove extra white spaces.
2011-05-20 06:03:12 -07:00
Arun Agrawal
f72f591c8c Not updating rubyforge for new versions. Result of "gem list -d rails" is not useful. 2011-05-20 17:43:40 +05:30
Xavier Noria
5b8bc4613c Merge pull request #1161 from guilleiguaran/each_syntax_in_activerecord
Syntax cleanup:  for in => each on ActiveRecord
2011-05-20 03:19:13 -07:00
Guillermo Iguaran
23e94a67f8 Refactoring test_has_many_with_pluralize_table_names_false test 2011-05-20 01:53:13 -05:00
Guillermo Iguaran
6a3b3fba5a Allow pluralize_table_names for individual model 2011-05-20 01:44:13 -05:00
Guillermo Iguaran
159213001a for => each in model migration template 2011-05-20 00:22:17 -05:00
Guillermo Iguaran
e7d600dcdb Syntax cleanup: for in => each 2011-05-19 22:55:37 -05:00
Joshua Peek
54823fe6b9 Use sprockets prepend_path if its available 2011-05-19 21:50:07 -05:00
Sebastian Martinez
b91c9076a6 Remove extra white spaces. 2011-05-19 20:51:33 -03:00
Jon Leighton
0afd5850f5 Implement proxy_owner, proxy_target and proxy_reflection methods on CollectionProxy with deprecations. Fixes #1148. 2011-05-19 23:28:44 +01:00
Santiago Pastorino
c0374999c8 Merge pull request #1153 from arunagw/sprockets_update
Sprockets version update.
2011-05-19 12:49:01 -07:00
Arun Agrawal
36e330b215 Sprockets version update. 2011-05-19 23:46:26 +05:30
José Valim
e4ebded5bc Use Rack::ContentLength. 2011-05-19 12:35:07 -04:00
Michael Koziarski
2c08a74855 Merge pull request #1097 from kirillrdy/master
Improved "treat  0000-00-00 00:00:00 as nil Date"
2011-05-19 09:13:54 -07:00
Michael Koziarski
feddf311dc Merge pull request #1118 from amatsuda/pp_console
always enable `pp` on the Rails console
2011-05-19 09:05:08 -07:00
José Valim
bcdb68155a Merge pull request #1151 from joshk/wrap_params_options_change
renamed the wrap_parameters :only and :except options to :include and :ex
2011-05-19 07:51:11 -07:00
Joshua Peek
4cf4c7f454 Merge pull request #1150 from stevenbristol/master
The cookie jar does not to_s cookie names (keys)
2011-05-19 07:34:52 -07:00
Josh Kalderimis
968596fa7f renamed the wrap_parameters :only and :except options to :include and :exclude to make it consistent with controller filters 2011-05-19 10:33:25 -04:00
steve
2d50887b24 adding test 2011-05-19 10:33:18 -04:00
steve
7c000af867 fixing sym and string cookie name, two cookies to browser bug. 2011-05-19 09:49:16 -04:00
José Valim
95bd19911a Merge pull request #1137 from guilleiguaran/each_syntax_in_activemodel
Prefer 'each' instead of 'for in'
2011-05-19 05:02:06 -07:00
José Valim
5281c296e6 Merge pull request #1136 from arunagw/actionmailer_readme
Actionmailer readme
2011-05-19 04:51:08 -07:00
José Valim
b5fec0f2a0 Merge pull request #1135 from arunagw/for_to_each
README updated for for => each
2011-05-19 04:48:06 -07:00
Guillermo Iguaran
ec1993c33f Prefer each instead of for in 2011-05-19 01:25:31 -05:00
Arun Agrawal
e3eaeb490a Example Usage updated for actionpack and actionmailer. 2011-05-19 09:17:49 +05:30
Arun Agrawal
8630cd420c README updated for for => each 2011-05-19 09:03:46 +05:30
José Valim
a921cab621 Merge pull request #1109 from dlee/optimize_indifferent_access
Use dup to preserve previous behavior
2011-05-18 15:04:37 -07:00
Xavier Noria
b13d24e5b9 Merge branch 'master' of git://github.com/lifo/docrails 2011-05-18 22:50:44 +02:00
José Valim
ab42f9c9e3 Merge pull request #1133 from joshk/options_merger_test
Fix misspelling of 'lambda'. Closes #987
2011-05-18 13:03:30 -07:00
Ben Orenstein
86491476d5 Fix misspelling of 'lambda'. Closes #987 2011-05-18 15:59:08 -04:00
José Valim
0ab21539c9 Merge pull request #1132 from joshk/ares_changelog
Updated the ActiveResource changelog
2011-05-18 12:56:09 -07:00
José Valim
200708e7ed Merge pull request #1131 from joshk/active_model_xml_fix
Attributes with :string type should not be given the type passed in model. Closes #1058.
2011-05-18 12:55:28 -07:00
Jim Herzberg
fbf99653f1 Attributes with :string type should not be given the type passed in model serialization options. Closes #1058 2011-05-18 15:52:55 -04:00
Josh Kalderimis
c88f7e81aa updated the ActiveResource changelog 2011-05-18 14:40:35 -04:00
Santiago Pastorino
3a5a378056 Merge pull request #1129 from amatsuda/pgsql_schema_query_format
on.upcase!
2011-05-18 09:34:50 -07:00
Akira Matsuda
0cd38a4af1 on.upcase! 2011-05-19 01:29:34 +09:00
Aaron Patterson
66afefdd79 Merge pull request #1122 from amatsuda/postgres_schema_queries
improvements on PostgreSQL schema queries
2011-05-18 09:05:18 -07:00
José Valim
77b70c72a8 Merge pull request #1126 from sikachu/bump_rack_mount
Update Rack::Mount to 0.8.1
2011-05-18 08:53:38 -07:00
Prem Sichanugrist
6d3b89b372 Update Rack::Mount to 0.8.1 2011-05-18 11:32:34 -04:00
José Valim
f7df1f8bf3 Merge pull request #1124 from amatsuda/fix_railties_warnings
Fix railties warnings
2011-05-18 07:27:19 -07:00
Akira Matsuda
cce461511b be sure to parenthesize the arguments when the first one is a RegExp literal
this fixes: "warning: ambiguous first argument; put parentheses or even spaces"
because: you need this to tell the parser that you're not calling :/ method (division)
details (Japanese!): http://blade.nagaokaut.ac.jp/cgi-bin/vframe.rb/ruby/ruby-dev/42445?42370-43277
2011-05-18 23:20:19 +09:00
Akira Matsuda
32b9cefb63 parenthesize the arguments with splat
to make sure we're not calling the :* operator
2011-05-18 23:19:13 +09:00
Akira Matsuda
9aa10a79f9 initialize @inside_template
fixes: "warning: instance variable @inside_template not initialized"
2011-05-18 23:19:13 +09:00
José Valim
505defc27e Merge pull request #1115 from joshk/active_resource_json_updates
ActiveResource json updates
2011-05-18 06:13:44 -07:00
José Valim
22ab2316ac Merge pull request #1123 from amatsuda/generator_for_to_each
change `for ... in` in the generator templates to Enumerator#each
2011-05-18 06:10:11 -07:00
José Valim
9968b95b60 Merge pull request #1117 from joshk/as_numeric_time
Add some missing requires for AS core_ext/numeric/time. Closes #1038
2011-05-18 06:08:06 -07:00
José Valim
1ccacd4ee3 Merge pull request #1116 from guilleiguaran/typo_in_app_generator_test
Fixing typo in test for turn gem
2011-05-18 06:04:30 -07:00
Akira Matsuda
22ed6cb798 for ... in => .each
I believe this is more modern way
2011-05-18 21:08:08 +09:00
Xavier Noria
9d8e2fb5e2 set log encoding to BINARY, but still use text mode to output portable newlines 2011-05-18 12:43:29 +02:00
Akira Matsuda
486a890505 why not use JOIN statement for joining tables? (vol. 2) 2011-05-18 18:51:03 +09:00
Akira Matsuda
df13f55d75 remove unused table from FROM clause
pg_namespace has not been used since this commit 29b0707f07
2011-05-18 18:50:33 +09:00
Akira Matsuda
a61556387a why not use JOIN statement for joining tables? 2011-05-18 18:50:33 +09:00
Akira Matsuda
d54c7781f2 always enable pp on the Rails console 2011-05-18 16:51:42 +09:00
Malcolm Locke
1c9a9d9bd2 Explicitly use ActiveRecord::IrreversibleMigration 2011-05-18 19:22:05 +12:00
David Lee
96acdfbf2a Test that HWIA.with_indifferent_access does not return self 2011-05-17 22:56:28 -07:00
Josh Kalderimis
3018f47276 add some missing requires for AS core_ext/numeric/time. Closes #1038 2011-05-18 01:32:26 -04:00
Guillermo Iguaran
d52fc25ac7 Fixing typo in test for turn gem 2011-05-18 00:31:01 -05:00
José Valim
2692d3278a Merge pull request #1112 from FLOChip/turn
add test case for turn gem for testunit.
2011-05-17 21:44:21 -07:00
José Valim
c2105d3b20 Merge pull request #1114 from arunagw/databaseyml_doc
Putting back mysql2 and sqlite3 in database.yml docs. In case people use
2011-05-17 21:42:50 -07:00
Josh Kalderimis
00958696d8 corrected some further tests and docs for the ARes change to json change 2011-05-18 00:34:10 -04:00
Josh Kalderimis
b641ab5bae removed a contrived ARes example 2011-05-18 00:34:09 -04:00
Josh Kalderimis
6b4bbb4274 updated all the tests in ARes to work with json 2011-05-18 00:34:09 -04:00
Josh Kalderimis
4a9365ee18 move the ARes conn test to the correct location 2011-05-18 00:34:09 -04:00
Josh Kalderimis
6062017382 remove a circular dependency 2011-05-18 00:34:09 -04:00
Arun Agrawal
28cf893d6c Putting back mysql2 and sqlite3 in database.yml docs. In case people use "--skip-gemfile" 2011-05-18 10:00:27 +05:30
Evan Farrar
45faaee874 Prevent duplicable comments from being the opening paragraph for Object docs 2011-05-18 00:26:35 -04:00
Teng Siong Ong
da29e0bfc2 don't include 'turn' gem in Gemfile if test unit is skipped. 2011-05-18 10:21:45 +08:00
Teng Siong Ong
ea306da4eb add tests for ruby-debug gem in Gemfile and make sure that ruby-debug19 is used as long as RUBY_VERSION > '1.9'. 2011-05-18 10:08:34 +08:00
siong1987
5df9d0081b add test case for turn gem for testunit. 2011-05-18 09:56:45 +08:00
Santiago Pastorino
9773f6e1aa Add missing require 2011-05-17 19:50:17 -04:00
Sebastian Martinez
84e541ecb4 Better doc styling in ActiveRecord::Locking 2011-05-17 20:21:35 -03:00
David Lee
fb3ea8b8cb Use dup to preserve previous behavior 2011-05-17 15:54:22 -07:00
Santiago Pastorino
0a070a2444 Run bundle install once when using plugin_new --full --mountable. Closes #555 2011-05-17 18:29:20 -04:00
Aaron Patterson
a898df66e4 bumping arel requirement 2011-05-17 18:05:27 -04:00
José Valim
6d3122445c Ensure Set-Cookie is not set on assets. 2011-05-17 17:44:06 -04:00
Andrew White
f3b0be812e Don't pass a block as we are yielding 2011-05-17 22:33:36 +01:00
José Valim
324f1451b0 Dump and load rack-cache stuff. 2011-05-17 17:33:17 -04:00
Jeremy Kemper
b77e032ccf Merge pull request #247 from goncalossilva/performance_test
Performance tests improved
2011-05-17 14:28:40 -07:00
Joshua Peek
1d8d799a01 Bump sprockets dependency 2011-05-17 17:20:27 -04:00
Joshua Peek
59baf2fc9c Remove old call to sprockets context 2011-05-17 17:19:33 -04:00
Andrew White
3773aa4fbb Add block setting of attributes to singular associations 2011-05-17 22:16:24 +01:00
José Valim
be199a1d53 Add a test case for issue #476. 2011-05-17 16:52:12 -04:00
Andrew White
42f1ad6865 Pass the attribute and option hashes to build_association
The build_association method was added as an API for plugins
to hook into in 1398db0. This commit restores this API and the
ability to override class.new to return a subclass based on
a virtual attribute in the attributes hash.
2011-05-17 20:43:30 +01:00
José Valim
b81f77e2e2 Merge pull request #1093 from lucasmazza/patch-1
Using the correct CSS compressor for the yui-compressor gem.
2011-05-17 11:58:19 -07:00
José Valim
760dec17be Use anonymous? that works on both Ruby 1.8 and 1.9. 2011-05-17 14:51:44 -04:00
José Valim
1d71c93f99 Merge pull request #1104 from colinyoung/master
Update Chicago mayor
2011-05-17 11:29:56 -07:00
José Valim
442ed8c92c Merge pull request #1106 from vatrai/user_instruct
instruct user to install using Gem file in database.yml template
2011-05-17 11:13:50 -07:00
Vishnu Atrai
0e1e831ecb instruct user to install using Gem file in database.yml templete issue #1103 2011-05-17 23:36:07 +05:30
José Valim
f1e1e7658b Merge pull request #1090 from dchelimsky/issue-1089
3.1: params_wrapper raises error on anynomous controllers
2011-05-17 10:58:06 -07:00
José Valim
f627da15f4 Merge pull request #1105 from kevmoo/b1103
For Issue #1103 - Fix for sqlite3.yml, mysql.yml
2011-05-17 10:49:15 -07:00
Kevin Moore
523bac6dba Fix for sqlite3.yml, mysql.yml 2011-05-17 10:30:54 -07:00
Colin Young
5f19c42eb7 Updated seeds.rb file. 2011-05-17 12:30:04 -05:00
Jon Leighton
2b786ba215 Merge pull request #1100 from arunagw/innerjoin_test
Fixed InnerJoinAssociationTest. Need to load essays fixture.
2011-05-17 10:04:56 -07:00
Michael Koziarski
fbab6f959b Don't print deprecation warnings every time the user reads or writes an inheritable attribute. The warnings on declaration is enough. 2011-05-17 12:03:58 -04:00
Arun Agrawal
ed119aa5d6 Fixed InnerJoinAssociationTest. Need to load essays fixture. 2011-05-17 20:29:28 +05:30
José Valim
ab9639f945 Merge pull request #1099 from dlee/optimize_indifferent_access
Optimize parts of HashWithIndifferentAccess
2011-05-17 05:33:48 -07:00
José Valim
a52dc0d9cc Fixes failing test, closes #1098. 2011-05-17 05:32:14 -07:00
Vijay Dev
110a066bb4 fix coding error in readme reported in rails GH #980 2011-05-17 17:52:40 +05:30
David Chelimsky
13950a8cc9 add more robust test for wrapping params with anonymous class 2011-05-17 06:57:14 -04:00
Andy Lindeman
ee82e1c301 Add fix for error when an anonymous controller subclasses ApplicationController 2011-05-17 06:57:04 -04:00
David Chelimsky
14d5e3e459 better test name 2011-05-17 06:56:53 -04:00
David Chelimsky
29e8ca3698 add failing test for https://github.com/rails/rails/issues/1089 2011-05-17 06:56:46 -04:00
David Lee
94617d7da1 Optimize parts of HashWithIndifferentAccess 2011-05-17 03:01:31 -07:00
Jon Leighton
b0385fe1b2 Merge pull request #1095 from guilleiguaran/fix_join_model_test
Adding missing require to join_model_test
2011-05-17 00:09:16 -07:00
Kirill Radzikhovskyy
6f0ebe040a Year 0 should fall to nil only if month and day are also 0 2011-05-17 16:31:09 +10:00
Guillermo Iguaran
2c89ed9ad6 Adding missing require 2011-05-16 22:22:27 -05:00
Jon Leighton
2033ff825b Merge pull request #560 from guilleiguaran/fix_pluralize_table_names_false
Fixing has_many when ActiveRecord::Base.pluralize_table_names is false
2011-05-16 15:40:12 -07:00
Lucas Mazza
79249f590d Using the correct CSS compressor for the yui-compressor gem. 2011-05-16 15:19:44 -07:00
Xavier Noria
bf5e4b4c1f configuratin guide: finished a pass to the "Rails General Configuration" section 2011-05-16 23:55:19 +02:00
Arun Agrawal
565865ec1c Link changes lighthouse to github 2011-05-16 21:24:57 +05:30
José Valim
6733721520 Deprecate attr_accessor_with_default. 2011-05-16 11:31:34 -04:00
José Valim
40fa51123d Merge pull request #1087 from amatsuda/generate_number_field_tag
generate HTML5 number_field tag for integer fields
2011-05-16 07:54:02 -07:00
Akira Matsuda
4d1752bfb2 generate HTML5 number_field tag for integer fields 2011-05-16 23:45:39 +09:00
José Valim
12a4376ae9 Merge pull request #1085 from amatsuda/amo_validator_initializer_cleanup
cleanups on AMo validator initializers
2011-05-16 04:23:44 -07:00
Akira Matsuda
35c5ccb30c Remove unneeded merge with default false options 2011-05-16 15:37:44 +09:00
Akira Matsuda
cbe1d2488b Don't add DEFAULT_TOKENIZER to every instance of LengthValidator. Just use it only when needed. 2011-05-16 15:37:44 +09:00
Guillermo Iguaran
23ad13ee17 Mailer example has more sense calling to deliver method 2011-05-15 21:19:15 -07:00
José Valim
8b0262f953 Merge pull request #573 from smartinez87/attr
Add doc to #attribute_names
2011-05-15 19:48:03 -07:00
Sebastian Martinez
2470392e89 Add doc to #attribute_names 2011-05-15 21:33:49 -03:00
José Valim
d043d65396 Merge pull request #570 from sikachu/decouple_actionpack
Make ParamsWrapper use a well-defined API and not rely on AR methods
2011-05-15 16:13:29 -07:00
Prem Sichanugrist
d77b306b63 Make ParamsWrapper calling newly introduced Model.attribute_names instead of .column_names 2011-05-15 19:07:44 -04:00
Prem Sichanugrist
5ca67eca21 Add ActiveRecord::attribute_names to retrieve a list of attribute names. This method will also return an empty array on an abstract class or a model that the table doesn't exists. 2011-05-15 19:07:40 -04:00
José Valim
6e581cce1c Merge pull request #568 from carlosantoniodasilva/fields_for_fixes
Fields for fixes for non nested attributes and without object
2011-05-15 15:51:20 -07:00
Xavier Noria
dde82a44d7 Merge branch 'master' of git://github.com/lifo/docrails 2011-05-15 22:23:40 +02:00
Xavier Noria
3448288228 reviewed the first ~70 lines of the configuration guide 2011-05-15 22:22:31 +02:00
Pirogov Evgenij
6bd99ecb62 Use more English language 2011-05-15 10:25:33 -07:00
Guillermo Iguaran
6a408f3e90 Fixing Changelog link 2011-05-15 08:19:36 -07:00
Guillermo Iguaran
ecbde46e57 Fixing has_many association when ActiveRecord::Base.pluralize_table_names is false. fixes #557 2011-05-15 03:53:10 -05:00
Aaron Patterson
5d24c3c8c5 Merge pull request #564 from sikachu/fix_wrapper
Do not try to call `column_names` on the abstract class.
2011-05-14 21:52:31 -07:00
Prem Sichanugrist
3bed43c6a5 Do not try to call column_names on the abstract class.
Normally the table for abstract class won't be existed, so we should not trying to call `#column_names` on it.
2011-05-15 00:41:20 -04:00
Carlos Antonio da Silva
82f33dce9c Use record_name to make fields for methods more consistent 2011-05-14 22:18:36 -03:00
Carlos Antonio da Silva
f0479cbbd5 Refactor fields_for to make the api more clear, and fix usage with non nested attributes and without object 2011-05-14 22:09:12 -03:00
Pirogov Evgenij
4b10585128 Clean up redundant backslashes 2011-05-14 15:40:32 -07:00
Carlos Antonio da Silva
6871cda693 Cleanup instantiate builder method definition 2011-05-14 17:23:34 -03:00
Jon Leighton
7e6145b4a2 These extra array operations appear to be unnecessary. Reasoning:
* It is not necessary to subtract 'id' from the list of copied attributes because record and mem_record are equal, so therefore their id attributes are also equal (so there is no harm in copying it, and this reduces the complexity of the code)
 * It is not necessary to intersect the attribute names, since record and mem_record are equal, so they have the same id and class, so they have the same columns in the database. If record has non-column attributes then it seems reasonable to also copy them onto mem_record (though I am not sure what situation this would ever happen in)
2011-05-14 19:49:22 +01:00
Jon Leighton
60b23ea1da CollectionAssociation#merge_target_lists should write to the underlying attributes when copying, rather than using the assignment method 2011-05-14 19:49:22 +01:00
Jon Leighton
6660beef36 An attempt to make CollectionAssociation#merge_target_lists make more sense. 2011-05-14 19:49:22 +01:00
José Valim
e7e1d83ddf Added some docs to controller runtime. 2011-05-14 03:59:14 -07:00
José Valim
c4837f6ce3 Merge pull request #554 from tomafro/reset-activerecord-runtime-before-each-request
ActiveRecord::LogSubscriber.runtime should be reset at the start of each request
2011-05-14 03:57:24 -07:00
Tom Ward
6d96124284 Reset ActiveRecord::LogSubscriber runtime at the start of each request
Previously the runtime was reset implicitly when #cleanup_view_runtime was called at the end of most requests. However, this doesn't happen when the request redirects, or send_file is called.  Consequently, the ActiveRecord runtime recorded in the logs included the time taken for both the current request and the previous redirect.  Explicitly resetting at the start of each request ensures that this can't happen, no matter what occurs previously.
2011-05-14 10:39:01 +01:00
Tom Ward
518ffcd168 Escape regex in controller_runtime_test to actually check that the ActiveRecord message appears 2011-05-14 10:39:01 +01:00
Xavier Noria
d491130236 Merge branch 'master' of git://github.com/lifo/docrails
Conflicts:
	actionpack/lib/action_view/helpers/date_helper.rb
	railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt
2011-05-14 11:21:27 +02:00
Xavier Noria
e5524d538c minor edits after going through what's new in docrails 2011-05-14 11:15:43 +02:00
Piotr Sarnacki
db886c817c Merge pull request #553 from arunagw/namespaced_generators
Fixed failing tests for namespaced_generators_test. in 1.9.2
2011-05-14 01:54:16 -07:00
Arun Agrawal
546db693fb Fixed failing tests for namespaced_generators_test. in 1.9.2 2011-05-14 14:06:06 +05:30
Karel Minarik
47003f8cdf [GUIDES] Changed the LANGUAGE variable to GUIDES_LANGUAGE to minimize conflicts with regular environment variables (eg. in Ubuntu) 2011-05-14 09:03:30 +02:00
Aaron Patterson
1fac9c74ab securerandom ships with 1.8.7+, so just use it 2011-05-13 23:22:13 -07:00
Xavier Noria
cbe6e09f6a asking the user whether he is "offline" rather than "online" seems more natural as reaction to a potential missing network connection 2011-05-14 03:31:08 +02:00
Xavier Noria
959b7b0fea removes now unused method Rails::Generators::AppBase#dev_or_edge? 2011-05-14 02:49:20 +02:00
Xavier Noria
26cfd1f283 application and plugin generation run bundle install unless --skip-gemfile or --skip-bundle 2011-05-14 02:37:41 +02:00
José Valim
345beb8485 Merge pull request #550 from jasondew/patch-1
typo
2011-05-13 17:19:30 -07:00
Jason Dew
6b07d7f9da typo 2011-05-13 17:15:29 -07:00
Jon Leighton
8a1de9b252 Instead of doing find(:all) which does scoped.find(:all) which does scoped.all, just do scoped.all. 2011-05-13 23:53:02 +01:00
Jon Leighton
5d4799d593 Remove pointless rescue (it doesn't happen anywhere in the tests, and I can't see a way that it would happen ever) 2011-05-13 23:53:02 +01:00
José Valim
0307fc70ad Merge pull request #540 from sikachu/mailer_generator_1_9_style
Update Mailer generator to use 1.9 styled hash when run on Ruby 1.9
2011-05-13 15:29:36 -07:00
Prem Sichanugrist
f2769ebd7e Update Mailer generator to use 1.9 styled hash when run on Ruby 1.9
As always, you can run `--old-style-hash` to override that.
2011-05-13 18:25:32 -04:00
José Valim
a4a338167e Merge pull request #542 from guilleiguaran/1_9_hash_style
Use new hash syntax in wrap_parameters initializer under Ruby 1.9
2011-05-13 15:01:07 -07:00
José Valim
308ea60faf Merge pull request #547 from vatrai/patch-1
rack_mount upgrade to new version 0.8.0
2011-05-13 14:51:46 -07:00
Xavier Noria
c55d7ab9cb move bundler loading down to #bundle_command 2011-05-13 22:22:26 +02:00
Aaron Patterson
a44f228fde backport skip to the AR base class 2011-05-13 13:06:59 -07:00
Aaron Patterson
ce1a1b47be supporting infinity and -infinity for timestamps in PG. fixes #544 2011-05-13 13:04:44 -07:00
Xavier Noria
b1ceffd7b2 run bundler programmatically rather than shelling out 2011-05-13 21:34:11 +02:00
Vijay Dev
159e605d19 minor corrections 2011-05-14 00:51:54 +05:30
Prem Sichanugrist
4ef4d57719 Link the API documentation to non-edge instead 2011-05-13 15:13:40 -04:00
Prem Sichanugrist
50639c97eb Adding guide for wrapping JSON/XML parameters, which also links to the API documentation.
Note that it currently links to http://edgeapi.rubyonrails.org because it's Rails 3.1 feature.
2011-05-13 14:31:15 -04:00
Vishnu K. Sharma
a4041c5392 rack_mount upgrade to new version 0.8.0 2011-05-13 10:44:08 -07:00
Piotr Sarnacki
2a98fd96aa Merge pull request #538 from arunagw/update_rack_mount
Update rack mount
2011-05-13 02:55:22 -07:00
Guillermo Iguaran
e987bc5469 Using new hash syntax in wrap_parameters initializer under Ruby 1.9 2011-05-13 00:44:48 -05:00
Joshua Peek
e2c4282fbf Update for sprockets/master context class api 2011-05-12 22:05:46 -05:00
Arun Agrawal
e72a6f8d91 Test added for getting route segment values 2011-05-13 08:12:06 +05:30
Arun Agrawal
975fd5669d rack-mount gem updated. 2011-05-13 08:01:16 +05:30
Guillermo Iguaran
deea8ca727 Prefer topic branches instead of master branch for users contributions 2011-05-12 19:58:05 -05:00
Xavier Noria
2e5d31223c use #quietly in a few places, and s/silence/capture/ where intention is capture 2011-05-13 02:11:47 +02:00
Xavier Noria
ceeab61fef Merge pull request #537 from amatsuda/update_scripts2
eliminating the noise
2011-05-12 17:06:05 -07:00
Akira Matsuda
acb3dbb241 eliminating the noise 2011-05-13 08:59:09 +09:00
Xavier Noria
bdbb15e5a5 new reporting method Kernel#quietly 2011-05-13 01:41:52 +02:00
Xavier Noria
b0062eef34 silences stderr to prevent an expected error message in the test suite from being echoed 2011-05-13 01:06:27 +02:00
Xavier Noria
2561a1f546 say something when running bundle commands
This is convenient because we buffer stdout. In particular
bundle install takes a while and generation just hangs there
with no indication of what's going on otherwise.
2011-05-13 01:06:27 +02:00
Xavier Noria
ead9e4e626 say silence when you mean silence 2011-05-13 01:06:27 +02:00
Xavier Noria
c88dddbe4d application and plugin generation run bundle check unless --skip-gemfile
The purpose of this feature is that the user knows whether
dependencies are satisfied. In particular, if they are not
he will be warned upfront, rather than finding out himself
in an abrupt way by trying to run something.
2011-05-13 01:06:27 +02:00
Xavier Noria
55d87d2b5c removes duplicate tests 2011-05-13 01:06:27 +02:00
Jon Leighton
6e466f17c3 Don't use mass-assignment protection when setting foreign keys or association conditions on singular associations. Fixes #481 (again). 2011-05-12 23:29:22 +01:00
José Valim
b210d9e722 Merge pull request #532 from amatsuda/update_script
Revert "Delegate everything to the generator"
2011-05-12 13:15:05 -07:00
José Valim
2bff301753 Merge pull request #531 from amatsuda/update_javascripts
remove update:javascripts rake task
2011-05-12 12:44:39 -07:00
Akira Matsuda
00379ee998 Revert "Delegate everything to the generator"
This reverts commit 0904e82568.

reason: rake rails:update:scripts fails due to this change
2011-05-13 04:05:44 +09:00
Akira Matsuda
9d8ce55e06 remove update:javascripts rake task
because javascript libraries are not bundled anymore, and create_javascript_files generator was already removed
2011-05-13 03:12:08 +09:00
David Heinemeier Hansson
27a61f4f2b The new release supposedly fixed things, but it is still b0rked -- comment out for now pending JPs investigation into whats up 2011-05-12 12:48:57 -05:00
David Heinemeier Hansson
2cf191bc76 Proper fix 2011-05-12 10:57:55 -05:00
David Heinemeier Hansson
244e4607f7 Fix the assets regexp for non-js/css files 2011-05-12 10:31:04 -05:00
Santiago Pastorino
85662c0b91 Merge pull request #527 from joshk/deprecation_circular_dependency
Remove a circular require in AS deprecations.
2011-05-12 06:48:04 -07:00
Josh Kalderimis
3d03c79829 Remove a circular require in AS deprecations. This is safe as AS deprecations is autoloaded as needed. 2011-05-12 15:24:10 +02:00
Nick Sutterer
e1ceae576e added an example for AC::UrlFor usage to make usage simpler. 2011-05-12 09:58:26 +02:00
José Valim
987f79cda8 Merge pull request #524 from joshk/ar_create_mas_correction
AR#create! allows for :as => role, and AR changelog update
2011-05-12 00:34:40 -07:00
Nick Sutterer
e3b3f416b5 added docs for AbC::UrlFor and AC::UrlFor. 2011-05-12 09:31:36 +02:00
Josh Kalderimis
a0000d0ea0 updated AR#create! to accept an options hash so the mass-assignment security role can be passed in, also updated the Changelog to mention the change to some of the AR method signatures. 2011-05-12 09:24:42 +02:00
Santiago Pastorino
8cf4725f64 Merge pull request #227 from farski/master
Unnecessary redundancy in Time/Date calculations
2011-05-11 17:10:44 -07:00
Santiago Pastorino
f5fcfc2ab6 Merge pull request #521 from seanmccann/patch-1
Removed extra newline at end of development config file. (There were 2)
2011-05-11 17:03:57 -07:00
Santiago Pastorino
0979a7e680 Merge pull request #491 from arunagw/readme_changes
Some readme fixes as required.
2011-05-11 17:01:36 -07:00
Santiago Pastorino
b89f269957 Depend on master uglifier for now 2011-05-11 19:12:41 -03:00
Jon Leighton
d192d85668 Merge pull request #512 from pivotalneutron/fix_eager_load_with_calculations
Bug fixes for calculations with includes
2011-05-11 13:32:04 -07:00
Fadzril Muhamad & Joseph Palermo
1db49ced45 Bug fixes:
- If doing a count on a relation that has an :include and a :join, it does a distinct even though it should not.
- When doing a count on a relation that has an :include, it always falls back to a old style left join when performing the count.  Looks like it was broken here:
b9599502c9
2011-05-12 04:05:24 +08:00
Sean McCann
8a2f6f7470 Remove extra line at end of development config file. 2011-05-11 12:44:18 -07:00
Vijay Dev
a117ac431a fix spellings 2011-05-11 23:13:22 +05:30
Vijay Dev
e80e36c194 indentation fixes 2011-05-11 22:50:10 +05:30
Vijay Dev
b2d6f8ee92 Merge branch 'master' of github.com:lifo/docrails 2011-05-11 21:53:39 +05:30
Santiago Pastorino
c53d3929cd Add missing requires 2011-05-11 13:05:04 -03:00
José Valim
9823c17c6a Merge pull request #515 from joshk/patch-3
updated the ActiveSupport changelog
2011-05-11 09:04:41 -07:00
José Valim
55cfbd4809 Merge pull request #519 from knapo/master
`guard_protected_attributes` has invalid assignment to be always true in attributes=
2011-05-11 09:02:22 -07:00
knapo
bb498a5749 Fix assigning protected attributes by attributes= 2011-05-11 17:17:42 +02:00
Xavier Noria
8ec1f30cfd Merge pull request #516 from gucki/master
add missing require for ordered_hash dependency
2011-05-11 07:27:41 -07:00
Corin Langosch
295bf413e5 add missing require for ordered_hash dependency 2011-05-11 16:22:35 +02:00
Andrew White
0fde84c0f8 Don't remove the target if it has already been destroyed 2011-05-11 14:22:22 +01:00
Josh Kalderimis
49cd41f7df updated the ActiveSupport changelog 2011-05-11 04:45:19 -07:00
Xavier Noria
b3f45195aa Merge pull request #513 from BlackBulletIV/patch-1
Modified CollectionAssociation documentation to refer to the new class name
2011-05-11 03:43:09 -07:00
Michael Ebens
940c31f9de Modified NamedScopeTest to use CollectionAssociation. 2011-05-11 03:37:35 -07:00
Michael Ebens
ad991808d5 Modified CollectionAssociation to refer to the new class name. 2011-05-11 03:27:38 -07:00
Jon Leighton
1dd90f8f12 Don't use select() values from the join model of a through association. Fixes #508. 2011-05-11 08:56:01 +01:00
Jon Leighton
aa1fc1c88c Bring back obj.association_loaded? as a deprecated method. Fixes #472. 2011-05-11 08:56:01 +01:00
Jon Leighton
6d51f9b98c Merge pull request #509 from gucki/master
fix bug in usage example of #unscoped
2011-05-11 00:31:43 -07:00
Corin Langosch
2bfeda3f09 fix bug in usage example of #unscoped 2011-05-11 09:19:12 +02:00
José Valim
4a6855e183 Merge pull request #507 from dlee/fix_identity_map_tests
Fix tests to reflect IdentityMap no longer default
2011-05-10 23:30:53 -07:00
José Valim
a792ad6db9 Merge pull request #506 from dlee/custom_csrf_token_tests
Test csrf token param name customization
2011-05-10 23:30:32 -07:00
José Valim
af88daefe0 Merge pull request #503 from smartinez87/conventions
Follow code conventions on some tests
2011-05-10 23:26:12 -07:00
David Lee
828f171536 Fix tests to reflect IdentityMap no longer default
Broke in 0e1dcae185
2011-05-10 19:21:32 -07:00
David Lee
8366cabd65 Test csrf token param name customization 2011-05-10 18:24:14 -07:00
Dan Pickett
d10a1b5739 fix bad encoding on contributing to RoR page 2011-05-10 20:56:10 -04:00
Sebastian Martinez
21b61a8ac4 Follow code conventions on some tests 2011-05-10 20:58:36 -03:00
Sebastian Martinez
ab880b9eb0 Follow code conventions on docs 2011-05-10 20:55:31 -03:00
Sebastian Martinez
71d6b088ec Fix styiling issues on DateHelper docs 2011-05-10 20:19:47 -03:00
José Valim
fa187ec778 Merge pull request #501 from guilleiguaran/patch-2
Adding .sass-cache to gitignore template
2011-05-10 15:52:07 -07:00
Guillermo Iguaran
e78221f92d Adding .sass-cache to gitignore template 2011-05-10 15:46:03 -07:00
Sebastian Martinez
956a0f4cfd Fix styiling issues on AtomFeedHelper docs 2011-05-10 19:39:34 -03:00
Sebastian Martinez
1ca3ae5f41 Remove extra whitespace. 2011-05-10 19:36:00 -03:00
Jon Leighton
a8c1fa4afd Add test to specify that attributes from an association's conditions should be assigned without mass-assignment protection when a record is built on the association. 2011-05-10 23:35:15 +01:00
Jon Leighton
93a85ce333 Remove unnecessary '|| {}' 2011-05-10 23:35:15 +01:00
Sebastian Martinez
350b977e5b Fix styiling issue on TranslationHelper docs 2011-05-10 19:34:59 -03:00
Sebastian Martinez
1f7d55e5c7 Fix styiling issue on ActionView::Template docs 2011-05-10 19:28:37 -03:00
José Valim
a87894ae57 Get around weird missing constant error caused by AS instead of simply raising NameError, closes #477. 2011-05-11 00:08:43 +02:00
Jon Leighton
9a7dbe2c05 Don't use mass-assignment protection when applying the scoped.scope_for_create. Fixes #481. 2011-05-10 22:54:40 +01:00
Aaron Patterson
8f999a3f80 make sure log file is written in binary mode. fixes #497 2011-05-10 13:23:05 -07:00
José Valim
7b6819f985 Merge pull request #499 from smartinez87/csv
impact guides with no CSV fixture support
2011-05-10 13:09:25 -07:00
Sebastian Martinez
177f7fa7b1 impact guides with no CSV fixture support 2011-05-10 16:55:32 -03:00
David Heinemeier Hansson
8567ab9098 Need it declared too 2011-05-10 14:30:02 -05:00
David Heinemeier Hansson
de286206c3 Include lib/assets for sprocket paths 2011-05-10 14:23:18 -05:00
José Valim
1a844650a4 Merge pull request #498 from vatrai/minor_cleaning
minor cleaning with new api method all
2011-05-10 12:12:19 -07:00
Vishnu Atrai
9a0e3d44d1 minor cleaning with new api method 2011-05-11 00:15:16 +05:30
Aaron Patterson
558334a899 deprecating CSV fixture support 2011-05-10 11:08:18 -07:00
Aaron Patterson
714fea81e4 deprecating read_csv_fixture_files method 2011-05-10 11:08:18 -07:00
Piotr Sarnacki
2ea33d6b47 Merge pull request #490 from vijaydev/patch-4
Replace LH with GitHub url for filing issues
2011-05-10 10:58:12 -07:00
Piotr Sarnacki
9f0af6d6dd Merge pull request #495 from vatrai/minor_fixes
minor cleaning
2011-05-10 10:57:15 -07:00
Vishnu Atrai
33f0b6b67d minor cleaning 2011-05-10 22:51:54 +05:30
José Valim
8660433537 Merge pull request #494 from vijaydev/patch-5
Use all in place of find(:all)
2011-05-10 10:13:23 -07:00
Vijay Dev
e2390c08ce Use all in place of find(:all) 2011-05-10 10:08:31 -07:00
Aaron Patterson
134a05adcb Merge pull request #493 from guilleiguaran/changelog-fixes
Merging 3.0.x CHANGELOGs
2011-05-10 10:04:54 -07:00
Guillermo Iguaran
259c749de1 Merging 3.0.x CHANGELOGs 2011-05-10 11:51:35 -05:00
José Valim
ceaf73a503 Merge pull request #492 from jaw6/master
Serialized methods that return nil should not be considered YAML
2011-05-10 09:41:28 -07:00
Arun Agrawal
9870afb37b Some readme fixes as required. 2011-05-10 22:00:06 +05:30
Vijay Dev
8265c45db3 Replace LH with GitHub url for filing issues 2011-05-10 09:25:52 -07:00
David Heinemeier Hansson
4de977117f Update sprocket comments 2011-05-10 11:23:35 -05:00
Joshua Wehner
2cef2d411a Methods that return nil should not be considered YAML 2011-05-10 12:06:09 -04:00
Xavier Noria
8e55afb453 Merge pull request #487 from vijaydev/patch-3
s/javascript/JavaScript
2011-05-10 09:00:54 -07:00
Vijay Dev
c3c852c2d8 s/javascript/JavaScript 2011-05-10 08:51:50 -07:00
Vijay Dev
8ce2844cbb minor fix in assets usage 2011-05-10 21:19:47 +05:30
Trent Ogren
973c6e2435 typo fix 2011-05-10 08:08:20 -07:00
José Valim
3aa8f348ef Fix previous commit by allowing a proc to be given as response_body. This is deprecated and is going to be removed in future releases. 2011-05-10 16:53:57 +02:00
José Valim
4d5ce4738b Merge pull request #446 from danielstutzman/response_body_is_proc
New test: setting response_body to a Proc should be supported.
2011-05-10 07:38:43 -07:00
Aditya Sanghi
a59a67d01c Explain the implication of using :ignore_date on time_select 2011-05-10 07:37:27 -07:00
José Valim
fa8b0f44bd Merge pull request #484 from slainer68/master
Puts ActiveRecord::SessionStore attributes in white list, fixes #483
2011-05-10 07:23:26 -07:00
slainer68
95b4989559 Puts ActiveRecord::SessionStore attributes in white list, fixes #483 2011-05-10 16:11:28 +02:00
José Valim
8c05293b69 Merge pull request #482 from vijaydev/patch-2
Fix typos in IM documentation
2011-05-10 04:06:10 -07:00
Vijay Dev
a4765f74cd Fix typos in IM documentation 2011-05-10 03:44:57 -07:00
José Valim
302c912bf6 Document identity map inconsistency with associations, closes #474. 2011-05-10 11:33:39 +02:00
José Valim
5fc3564a50 Fix #480. Passing nil to create association works. 2011-05-10 11:18:16 +02:00
José Valim
0ceb21e335 Revert "b9ea751d0e56bd00d341766977a607ed3f7ddd0f".
Wrapping each Record.associations.build in a transaction is going to
make several unneeded queries. Reverting this commit also fixes #479.
2011-05-10 11:14:39 +02:00
José Valim
7c353d576a Add failing tests according to #479. 2011-05-10 11:11:30 +02:00
José Valim
b6a2113b8d Add failing tests, according to #480. 2011-05-10 11:02:34 +02:00
Bruno Michel
85a40f6fda :touch => :symbol also updates the updated_at attribute 2011-05-10 01:52:27 -07:00
José Valim
9e4b715d79 Ensure assign_attributes and update_attributes do not fail on nil, closes #478. 2011-05-10 10:30:27 +02:00
José Valim
86a0f7f735 Add tests for content_for() for read, closes #475. 2011-05-10 10:22:09 +02:00
Gonçalo Silva
7fcf0ca69e removed redundant metric support check (and print when it isn't) 2011-05-10 03:40:44 +01:00
Gonçalo Silva
aaa85cde60 remove forgotten puts 2011-05-10 02:52:10 +01:00
Gonçalo Silva
0304d8076a ruby-prof's awesome call stack printer is now used by default 2011-05-10 02:49:32 +01:00
James Miller
bb1af05247 Missing an end in routing docs 2011-05-09 18:46:07 -07:00
Gonçalo Silva
83b66f5af4 Merge branch 'performance_test' of github.com:goncalossilva/rails into performance_test 2011-05-10 02:39:05 +01:00
Gonçalo Silva
dcc99e23cd benchmarker and profiler now use the new performance testing tools (support for Rubinius and JRuby and high configurability) 2011-05-10 02:33:01 +01:00
Sebastian Martinez
ed8962c821 more fixed-fonts here 2011-05-09 22:21:00 -03:00
Sebastian Martinez
56a7db6ea8 added some fixed fonts 2011-05-09 22:06:04 -03:00
Gonçalo Silva
810fb2b527 benchmarker and profiler now use the new performance testing tools (support for Rubinius and JRuby and high configurability) 2011-05-10 01:38:21 +01:00
Vijay Dev
3f36441e90 Update copyright year in Active Resource and Active Support
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-05-09 20:17:23 -03:00
José Valim
0e1dcae185 Disable identity map by default. Detailed documentation will be pushed later. 2011-05-10 00:49:36 +02:00
Gonçalo Silva
9ca97a6baf fixed a typo in the guide 2011-05-09 23:46:07 +01:00
Gonçalo Silva
0d1f7584ba contemplate unsupported metrics 2011-05-09 23:29:00 +01:00
Aaron Patterson
73ff6797ef use a null byte as a bind parameter substitute as it is not allowed in normal SQL. fixes #411, #417 2011-05-09 13:53:57 -07:00
José Valim
c56f4b272d Merge pull request #471 from joshk/remove_as_concern
Removed an unneed AS::Concern from AR::IdentityMap
2011-05-09 13:15:59 -07:00
Josh Kalderimis
d9f95c76a4 removed an unneed AS::Concern from AR::IdentityMap 2011-05-09 22:13:25 +02:00
Vijay Dev
21be7f20e7 fixes github fork url 2011-05-10 00:08:38 +05:30
José Valim
5b4849598a Merge pull request #461 from chrislwade/sorted-migrations
Sorted migrations
2011-05-09 09:54:04 -07:00
José Valim
59705deeaf Warn if we cannot verify CSRF token authenticity 2011-05-09 17:23:41 +02:00
José Valim
2750f2ee00 Fix failing test. 2011-05-09 17:08:59 +02:00
Mike Howard
372d72445b xml_mini.rb:_dasherize() replacement 20 to 25% faster
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-05-09 17:06:56 +02:00
José Valim
851a4eab3c Oops, missing autoload, closes #466 2011-05-09 15:12:58 +02:00
Philip Roberts
9b84bd354d Fixed typos in documentation for the date_select helper in actionpack/action_view.
The description for an example of the date_select method did not match the actual code example.
2011-05-09 03:21:16 -07:00
José Valim
731923d79e Merge pull request #460 from guilleiguaran/patch-1
Just a minor fix in A.S CHANGELOG
2011-05-09 02:26:35 -07:00
José Valim
a9b72fbc9e Optimize the most common resolver case. 2011-05-09 11:17:24 +02:00
José Valim
4f03e404b2 No need for replace. 2011-05-09 10:42:54 +02:00
sgerrand
f40a3ea81c Merge pull request #42 from sgerrand/master
Fixed typo in association configuration example
2011-05-09 01:18:24 -07:00
Sasha Gerrand
b97e6300ef - Fixed typo in association parameters configuration (again) 2011-05-09 18:14:44 +10:00
Christopher Wade
e585121539 Interleave db_list and file_list. 2011-05-09 01:46:35 -05:00
Christopher Wade
2952040f70 Sort migrations by the migration ID. 2011-05-09 01:45:45 -05:00
Guillermo Iguaran
1021b51b4f Just a minor fix in A.S CHANGELOG 2011-05-08 22:59:25 -07:00
sgerrand
2fae429941 Merge pull request #41 from sgerrand/master
Corrected foreign key parameter placement in the self join example
2011-05-08 19:27:19 -07:00
Sasha Gerrand
e0fdbfd33a - Fixed typo in the example of a self join on a model 2011-05-09 12:23:24 +10:00
Sasha Gerrand
fda9c7d0c8 - Moved foreign key parameter to correct location for self join on a model example 2011-05-09 12:20:44 +10:00
Gonçalo Silva
a43f95d235 added a note about profiling options to the generators 2011-05-09 01:00:04 +01:00
Jon Leighton
72a4893452 Merge pull request #451 from baroquebobcat/fixing_last_for_issue_371 2011-05-08 23:43:34 +01:00
Nick Howard
92c10760d7 Fix for #371
if a query contains a limit or an offset, ActiveRecord::FinderMethods#find_last had inconsistent behavior.

If the records were loaded, it returned the last record in the cached list.
If they were not, it reversed the order of the query and changed the limit to one.
If the earlier limit was less than the total matching the query in the db,
it would return a different record than if the records had been cached.

This commit changes find_last so that it loads the records when getting the
last record on a query containing a limit or an offset, which makes the behavior consistent.
2011-05-08 23:42:53 +01:00
Jon Leighton
8f10ccd311 Ensure that ORDER BY clauses from default scopes are not included in calculation queries. Fixes #406. 2011-05-08 23:31:16 +01:00
Vijay Dev
d6ff2eea0b Include examples for negative ordinalize in the guide 2011-05-09 00:30:14 +05:30
Vijay Dev
668cb42f94 improve comment in wrap_parameters template 2011-05-09 00:02:27 +05:30
José Valim
b3791da031 Merge pull request #457 from vijaydev/master
Adds examples in code for ordinalizing negative numbers
2011-05-08 11:21:47 -07:00
Vijay Dev
91c18554f6 adds code examples for negative ordinalize 2011-05-08 23:48:15 +05:30
Vijay Dev
eef2060879 included examples for negative ordinalize 2011-05-08 23:43:46 +05:30
Jon Leighton
a8daea4b85 Merge pull request #332 from cmeiklejohn/bug6230_optimistic_locking_double_quoted 2011-05-08 18:53:12 +01:00
Christopher Meiklejohn
4fbd8adf48 Don't quote ID's as Arel will quote them -- follow same conventions as the delete method. 2011-05-08 18:37:28 +01:00
Ryan Sandridge
95ec18a083 Documentation fix. Corrected a copy/paste mistake for link_to_if documentation. 2011-05-08 13:26:12 -04:00
Aaron Patterson
a45f300e5f Merge pull request #445 from prakashmurthy/lighthouse_6334
Fix for Lighthouse ticket # 6334 : to_xml should render valid xml or raise an error all the time
2011-05-08 10:13:39 -07:00
José Valim
f69be6ae8f Merge pull request #455 from joshk/mass_assignment_roles
Renamed mass-assignment scopes to roles
2011-05-08 08:19:38 -07:00
Jason
c7d8661118 Fixed documentation of select tag; options with html need to pass through html_safe
https://github.com/rails/rails/issues/447
https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/6759-api-document-incorrect
2011-05-08 08:58:48 -06:00
Josh Kalderimis
b2451f4a7f renamed mass-assignment scopes to roles, updated code, tests, docs and security guide 2011-05-08 16:43:29 +02:00
José Valim
9727dd1e38 Merge pull request #388 from smartinez87/remove_method
Better use #remove_possible_method here
2011-05-08 07:42:02 -07:00
Sebastian Martinez
b94d94a1ae Better use #remove_possible_method here 2011-05-08 11:31:56 -03:00
prakashmurthy
6b31fd8070 Lighthouse ticket # 6334; added tests to verify that spaces in key are dasherized. 2011-05-08 06:13:18 -06:00
José Valim
80bf68aa1b prepend the assets route instead of appending, closes #436 2011-05-08 12:59:04 +02:00
José Valim
c2b55c4fbf Merge pull request #454 from dlee/nested_indifferent_access
indifferent access should recurse Hash subclasses
2011-05-08 03:44:27 -07:00
David Lee
099eb2b3fd indifferent access should recurse Hash subclasses
This commit makes Hash subclasses convert to HWIA by default for nested
objects of subclasses of Hash, but allows certain subclasses to prevent nested
conversion by introducing Hash#nested_under_indifferent_access that subclasses
can overwrite.

ActiveSupport::OrderedHash is one such subclass that overwrites
+nested_under_indifferent_access+, since implicitly converting it to HWIA would
remove the ordering of keys and values in Ruby 1.8.

This change is necessary because commit ce9456e broke nested indifferent access
conversion for all subclasses of Hash.
2011-05-08 03:40:51 -07:00
José Valim
e5a0122419 Revert to use === only here because of perf. :( 2011-05-08 12:40:15 +02:00
José Valim
843cab6f98 Merge pull request #420 from burke/master
Accept single prefix in ActionView::MissingTemplate#initialize
2011-05-08 03:35:14 -07:00
José Valim
30db3a82f6 Merge pull request #430 from dlee/methodoverride
Logs should show overridden method; Issue 426
2011-05-08 03:33:22 -07:00
José Valim
ad129639c7 Fix failing xml mini test. 2011-05-08 12:25:02 +02:00
Vijay Dev
197f3f07d6 Included more details on Rails coding conventions (from LH Source Style page) 2011-05-08 15:12:18 +05:30
José Valim
67c3469e6f Merge pull request #452 from jrom/runner-r-alias
Add alias `r` for rails runner
2011-05-08 01:13:08 -07:00
Gonçalo Silva
181c8422d7 explicitly return from run() under minitest (metrics were printed with the previous solution) 2011-05-08 04:20:14 +01:00
Jordi Romero
bfff5eac77 Add alias r for rails runner 2011-05-07 20:12:34 -07:00
Gonçalo Silva
aec7456f81 Merge branch 'master' of https://github.com/rails/rails into performance_test
Conflicts:
	activesupport/lib/active_support/testing/performance.rb
2011-05-08 03:54:55 +01:00
Burke Libbey
06671c37de Added activesupport requires for Array.wrap in previously modified files 2011-05-07 18:30:50 -05:00
Santiago Pastorino
70f9558d0e Merge pull request #449 from msgehard/rename_duplicate_test_methods
Rename duplicate tests
2011-05-07 16:14:37 -07:00
Mike Gehard
0bc91a4cf7 Rename duplicate tests. There is now one failing test that was failing before the rename but was never getting run. 2011-05-07 17:02:42 -06:00
Daniel Stutzman
2ab42dcc3e New test: setting response_body to a Proc should be supported. 2011-05-07 16:35:56 -06:00
Aaron Patterson
820b6f3da0 Merge pull request #442 from jasonnoble/namespace_fixtures
Namespace Fixtures in ActiveRecord
2011-05-07 15:33:51 -07:00
Jason Noble
e5c18ff2cc Added deprecation warning for Fixture(s) (Use ActiveRecord::Fixture(s)) 2011-05-07 16:15:09 -06:00
José Valim
0ef978d1d2 Revert "Merge pull request #275 from pk-amooma/master"
Several AP tests fail after this change.

This reverts commit aaf01cd537, reversing
changes made to 9cc18c52fa.
2011-05-07 23:45:15 +02:00
José Valim
0a1ba4eab0 Always expand */* 2011-05-07 23:43:44 +02:00
mathieuravaux
fadd1fa3d3 Fixes ticket #6379. Improved the handling of Accept headers containing */*.
`lookup_context#formats=` being too restrictive, "Accept: text/javascript, */*"
resulted in [:js, "*/*"] formats instead of [:js, :html].

Signed-off-by: José Valim <jose.valim@gmail.com>
2011-05-07 23:35:52 +02:00
José Valim
803548c46b xml_mini_test.rb now runs. 2011-05-07 22:45:06 +02:00
Jason Noble
7db2ef47a1 Namespace Fixtures in ActiveRecord
[Fixes #439]
2011-05-07 14:20:51 -06:00
Aaron Patterson
3a82ff9555 Merge pull request #438 from jasonmichaelroth/ordinalize_negative_numbers
ordinalize negative numbers patch
2011-05-07 12:31:20 -07:00
Jason
3880ab0d7c ordinalize negative numbers patch
Applied patch by Amir Manji
  https://github.com/rails/rails/issues/437#issuecomment-1116045

Signed-off-by: Jason <jasonmichaelroth@gmail.com>
2011-05-07 13:21:00 -06:00
Vijay Dev
e35ba99e4b remove unnecessary use of 'Example' 2011-05-07 22:38:00 +05:30
Xavier Noria
7ec3f33e3a Merge pull request #435 from vijaydev/master
Update README template to include info about app/assets
2011-05-07 09:36:46 -07:00
Vijay Dev
9d6f28d234 update readme to reflect app/assets 2011-05-07 21:40:34 +05:30
José Valim
45aec460d4 Merge pull request #434 from arunagw/changelog_doc
Updated changelog for jdbc* adapters template.
2011-05-07 09:01:36 -07:00
Arun Agrawal
4addc99d19 Updated change log for jdbc* adapters template. 2011-05-07 21:24:21 +05:30
Vijay Dev
448845cd0d replaced eg using old router api with the one in the guides. Add info on nesting with_options 2011-05-07 21:18:03 +05:30
José Valim
ba23bf43f2 Class.new.name returns an empty string on 1.8 2011-05-07 17:46:44 +02:00
José Valim
5d6c8d5e9d Revert "Revert the merge because tests did not pass."
This reverts commit 886818d2ba.
2011-05-07 17:33:40 +02:00
Vijay Dev
ffb70cf256 minor fixes 2011-05-07 20:20:28 +05:30
José Valim
00a1152fa7 Update CHANGELOG. 2011-05-07 15:32:11 +02:00
José Valim
7d7a353f77 Merge pull request #343 from asanghi/ampm
Allow AM/PM format in datetime selectors
2011-05-07 06:31:18 -07:00
Vijay Dev
6e83330590 fixes incorrect error message for sample method 2011-05-07 18:09:20 +05:30
Vijay Dev
3056b3379b use new AR calls in examples 2011-05-07 18:08:13 +05:30
Vijay Dev
7194b393a6 fix comment alignment 2011-05-07 18:07:42 +05:30
José Valim
f77cd7c7b6 Merge pull request #286 from jasoncodes/marshal_subsec
Fix marshal round-tripping of fractional seconds (Time#subsec).
2011-05-07 04:39:50 -07:00
José Valim
c444b0f67b ADdd missing requires (thanks to @arunagw) 2011-05-07 13:35:21 +02:00
José Valim
0e886fe10e Merge pull request #280 from jballanc/frozen-string-strip-tags
Stripping tags from a frozen string
2011-05-07 03:44:19 -07:00
José Valim
aaf01cd537 Merge pull request #275 from pk-amooma/master
properly escape "'" to "'" for XML
2011-05-07 03:41:26 -07:00
José Valim
9cc18c52fa Merge pull request #263 from CvX/master
Corrected dbconsole usage message
2011-05-07 03:34:28 -07:00
José Valim
b011a7a938 Merge remote branch 'rolftimmermans/desc_tracker' 2011-05-07 12:26:45 +02:00
José Valim
a761d77902 Merge pull request #248 from bigfix/enumerable_as_json
Enumerable should pass encoding options to children in #as_json/#to_json
2011-05-07 03:19:56 -07:00
David Lee
17a91a6ef9 Logs should show overridden method; Issue 426 2011-05-07 03:04:26 -07:00
José Valim
a6ef255ff5 Merge pull request #349 from bradley178/master
Hash.from_xml chokes on empty CDATA
2011-05-07 02:58:16 -07:00
Vijay Dev
162bf8ffb1 revises comment for blank? method 2011-05-07 12:13:38 +05:30
José Valim
c515f64f72 Use .ref instead of .to_sym. 2011-05-07 02:22:17 +02:00
Xavier Noria
fa8623b52e adds comments clarifying the role of SharedGeneratorTests 2011-05-07 00:11:50 +02:00
José Valim
8bbf47ad5f Merge pull request #424 from gnufied/master
Fixes around_filter from observer, github issue#329
2011-05-06 14:50:14 -07:00
Hemant Kumar
20c35bca5a fix yield not working from around filter of observers, fixes Github#329 2011-05-07 03:03:41 +05:30
José Valim
886818d2ba Revert the merge because tests did not pass.
Revert "Merge pull request #423 from richardiux/master"

This reverts commit b8f08c4ea7, reversing
changes made to fd9df1b1dd.
2011-05-06 23:17:43 +02:00
José Valim
b8f08c4ea7 Merge pull request #423 from richardiux/master
Identity Map caching bug
2011-05-06 14:07:24 -07:00
Burke Libbey
4c4d5c7e6c Remove redundant check for is_a?(String) 2011-05-06 15:28:31 -05:00
Aditya Sanghi
5e235278c4 Made language consistent with the rest of the comments in the file. 2011-05-06 13:07:14 -07:00
Burke Libbey
156039c4cf Added a test for MissingTemplate change, and changed to use Array.wrap() as
requested by josevalim.
2011-05-06 14:02:31 -05:00
Burke Libbey
30d49d001e Made ActionView::MissingTemplate#initialize optionally accept a single string
prefix to be converted to an array as in ActionView::PathSet#find_all.
2011-05-06 12:42:27 -05:00
José Valim
fd9df1b1dd Merge pull request #419 from smartinez87/avail_action
better styling on #available_action? docs
2011-05-06 10:26:13 -07:00
Sebastian Martinez
9899f53184 better styling on #available_action? docs 2011-05-06 14:23:25 -03:00
Aaron Patterson
dd752a5de9 Merge pull request #418 from myronmarston/am_observer_doc_updates
Add documentation for new observer enable/disable feature.
2011-05-06 10:20:04 -07:00
Richard Millan
fc2823a85c Adding base method symbolized_sti_name to activerecord base to be used on identity map. Identity map now considers the inheritance when creating the caching keys 2011-05-06 10:05:43 -07:00
Myron Marston
99363dcf60 Add documentation for new observer enable/disable feature. 2011-05-06 10:00:14 -07:00
José Valim
9c2c25c1a1 Revert to old semantics, use available_action? instead of action_method?. 2011-05-06 18:44:18 +02:00
José Valim
6acb858d06 Merge pull request #389 from jasonrudolph/always_flush_logger_at_exit
Always flush logger at exit
2011-05-06 09:43:57 -07:00
Jason Rudolph
cb2d811ebb Add test to verify production rake tasks flush logger on exit 2011-05-06 12:25:11 -04:00
Jason Rudolph
59982acd63 Always flush logger at exit
Prior to this change, running code via script/runner would demonstrate
different logging behavior than running the same code via a rake task.
In production mode the script/runner approach would always flush the
logger, but the rake-based approach would not automatically flush the
logger. This discrepancy violates the principle of least surprise, and
it could lead to the loss of important production logging data.

This change removes special-case code in the "runner" command, and
replaces it with a general solution to ensure that the logger gets
flushed at exit. This solution works for "runner", "console", "server",
rake tasks, and any other process that loads the Rails environment.
2011-05-06 12:21:21 -04:00
José Valim
cae68d221c Merge pull request #414 from asanghi/lh5796
config.generators.orm = false when skipping active record. LightHouse #5796
2011-05-06 08:35:57 -07:00
Aditya Sanghi
a8cfceca55 be consistent 2011-05-06 21:02:20 +05:30
Xavier Noria
ef2738472d Revert "Small edit to the if statement simplification for blank? on the Object class. An Object doesn't need to be nil and empty to be blank? just one or the other."
Reason: the original code is correct, see

    !nil && !empty -> !(nil || empty) -> !blank

That said, this example has too many negations
for my linking. Think should be revised to be
more positive and straightforward to read.

This reverts commit a4b6e3d9be.
2011-05-06 17:30:00 +02:00
Aditya Sanghi
cdf1842caa review fixes 2011-05-06 20:59:15 +05:30
Caley Woods
a4b6e3d9be Small edit to the if statement simplification for blank? on the Object class. An Object doesn't need to be nil and empty to be blank? just one or the other. 2011-05-06 08:23:12 -07:00
José Valim
0e5adbceb7 Don't pluralize, camelize. 2011-05-06 17:00:59 +02:00
Aditya Sanghi
9b5c29038d default orm and test_framework to false; change application.rb template accordingly 2011-05-06 20:29:11 +05:30
José Valim
d42bb68430 More updates to ivars list. 2011-05-06 14:57:25 +02:00
José Valim
894bdbd53d Move variables to underscore format, update protected instance variables list. 2011-05-06 14:57:25 +02:00
Aditya Sanghi
75e1e2175d When skipping skip active record, mark config.generators.orm to false; LH 5796 remainder 2011-05-06 18:04:20 +05:30
José Valim
be9857c21d Merge pull request #410 from asanghi/LH6074
distance_of_time_in_words calculates wrong no of years
2011-05-06 04:41:24 -07:00
Xavier Noria
29dbccff30 Merge pull request #396 from asanghi/lh_4346
Multiparameter POLA (principle of least authority) with respect to time_select fixes. See LH4346
2011-05-06 03:53:17 -07:00
Aditya Sanghi
65a9563209 strip space 2011-05-06 15:51:09 +05:30
Aditya Sanghi
ae7d0d816d Take leap years into account more seriously when calculating year distance [#6074 state:resolved] 2011-05-06 15:42:05 +05:30
José Valim
4c755f977c Merge pull request #408 from etdsoft/master
Rails::Server outputs 'http://' even when running over SSL
2011-05-06 02:22:06 -07:00
Jacob Poulsgaard Tjoernholm
9f9446f271 Update the description of the :path option to #resources to reflect that it sets the actual path, not a prefix. Most instances were already fixed. 2011-05-06 10:26:17 +02:00
Daniel Martin
1f1989dee0 Take into account the Rack::Server :SSLEnable option when building the application's URL 2011-05-06 07:22:27 +01:00
José Valim
785ee65ddf Ensure params wrapper settings are not inherited and calculated each time. 2011-05-06 07:11:06 +02:00
José Valim
41a6d96c1b Update CHANGELOGs. 2011-05-06 05:53:58 +02:00
José Valim
7adfd02b3f Merge pull request #400 from arunagw/ruby_prof
Adding ruby-prof gem for ruby platform only #jruby
2011-05-05 20:30:29 -07:00
Jon Leighton
030e1d06ca Merge pull request #399 from ernie/join_conditions_on_join
Add association join conditions to JOIN clause, not WHERE
2011-05-05 13:23:15 -07:00
Paul Morganthall
6df7a223ca Restore emphasis on 'application name'. 2011-05-05 12:19:01 -07:00
Ernie Miller
9b7cd75db3 Add a test for outer joins with conditions where value IS NULL 2011-05-05 14:34:48 -04:00
Aaron Patterson
f098c80947 Merge pull request #358 from baroquebobcat/fix_find_or_create_master
Fix for lighthouse #6741
2011-05-05 11:13:05 -07:00
Arun Agrawal
976a9d99b1 Grouped the ruby-prof into test. 2011-05-05 23:17:07 +05:30
Arun Agrawal
745c9f3736 Removing from duplicate places. Only in Ruby platform needed. 2011-05-05 22:46:23 +05:30
Jason Voegele
f649d137c0 Merge branch 'master' of github.com:lifo/docrails 2011-05-05 10:03:07 -07:00
Vishnu Atrai
c62fcaa659 adding ruby-prof gem for ruby platform only #jruby 2011-05-05 22:21:38 +05:30
Ernie Miller
8d270a2abb Add join conditions to JOIN clause, not WHERE 2011-05-05 12:35:29 -04:00
Jason Voegele
0f7827ca34 Added info on using Ehcache as cache store. 2011-05-05 09:22:03 -07:00
Paul Morganthall
210ebd3623 Rails 3 requires the "new" command to create a new project. 2011-05-05 09:05:40 -07:00
Richard Millan
d53b406a76 Test: identity on inherited classes should behave the same when turned on or off 2011-05-05 07:28:51 -07:00
José Valim
ee898e5248 Merge pull request #397 from dchelimsky/view-path-decorator
rename test case to better describe use case
2011-05-05 05:14:40 -07:00
Richard Millan
564922b32c Testing identity map on inherited active record classes. Distinct models that use the same database table shouldn't be retrieved as the same object when there is not a type attribute. 2011-05-05 04:52:42 -07:00
José Valim
5e1960ea20 Merge pull request #394 from splattael/fix_rake_routes_shows_custom_assets
Display custom asset routes in `rake routes`
2011-05-05 03:32:55 -07:00
Peter Suschlik
97f9000cf2 Display custom asset routes in rake routes 2011-05-05 12:14:40 +02:00
Aditya Sanghi
7d0f26796d Multiparameter POLA, time_select fixes. See LH4346 2011-05-05 15:41:14 +05:30
José Valim
008b178a90 Merge pull request #392 from janx/master
Patch for performance test: make it run with ruby19/minitest
2011-05-05 03:08:32 -07:00
José Valim
ffe731c922 Update respond_with docs to deal better with collections. 2011-05-05 03:01:15 -07:00
Jan Xie
ebc5ef0e66 add tests for performance test 2011-05-05 17:15:22 +08:00
Jan Xie
25288c137c minitest/ruby19 compatible performance test 2011-05-05 16:11:49 +08:00
José Valim
3e9bb5459c Merge pull request #390 from arunagw/jruby_openssl
Adding jruby-openssl in Gemfile by default. #jruby
2011-05-05 00:30:42 -07:00
José Valim
65fd004da4 Merge pull request #391 from bradleypriest/patch-1
Tidying up the language in wrap_parameters.rb
2011-05-05 00:24:58 -07:00
Bradley Priest
a9fb5116d7 Tidying up the language in wrap_parameters.rb 2011-05-04 23:04:30 -07:00
Arun Agrawal
2f331fd9b2 Adding jruby-openssl in Gemfile by default. #jruby 2011-05-05 08:30:26 +05:30
David Heinemeier Hansson
e99c1e3a3b No longer need to reference mysql2 from git 2011-05-04 21:08:36 -05:00
Sebastian Martinez
6826936335 Improve doc styles for ActiveModel::Conversion 2011-05-04 22:49:11 -03:00
David Heinemeier Hansson
169ae75e09 Prepare for beta1 2011-05-04 20:21:05 -05:00
David Heinemeier Hansson
5b8801442e Only show dump of regular env methods on exception screen (not all the rack crap) [DHH] 2011-05-04 19:56:56 -05:00
David Heinemeier Hansson
9f062970ca Dont show the assets mount in rake routes 2011-05-04 19:24:41 -05:00
Aaron Patterson
38d92d705e ensure query cache is cleared when Rack body is closed, fixes bug reported on 951e18abea 2011-05-04 15:24:26 -07:00
Josh Kalderimis
8e69f1eb20 minor correction to the ActionDispatch::Http::URL subdomain docs 2011-05-04 21:53:10 +02:00
Santiago Pastorino
bd4831d699 Bump up rack-cache, tzinfo and thor 2011-05-04 16:47:48 -03:00
Sebastian Martinez
6372d23616 Fix punctuation errors. 2011-05-04 15:51:47 -03:00
Xavier Noria
aada1a4f78 Merge branch 'master' of github.com:rails/rails 2011-05-04 20:15:34 +02:00
Xavier Noria
47e1cca5dc Merge branch 'master' of git://github.com/lifo/docrails 2011-05-04 20:15:00 +02:00
José Valim
871096d854 Merge pull request #387 from smartinez87/remove_method.
Use #remove_possible_method instead
2011-05-04 11:14:57 -07:00
Sebastian Martinez
9be7911e87 Use #remove_possible_method instead here 2011-05-04 15:13:40 -03:00
Vijay Dev
2076295aba commented meta code 2011-05-04 23:42:29 +05:30
José Valim
afc3ccf74c Fix renew feature on cookies. 2011-05-04 20:12:27 +02:00
Vijay Dev
3e7a8ccdc4 formatting results in comments 2011-05-04 23:38:21 +05:30
Sebastian Martinez
1c2dc92aae Use #remove_possible_method instead 2011-05-04 15:07:34 -03:00
José Valim
6b79463ed8 Fix .subdomain regression. 2011-05-04 20:05:35 +02:00
José Valim
a93bd11b1d Use remove possible method here. 2011-05-04 19:31:43 +02:00
José Valim
85b8a88d87 Relax this dependency a bit. 2011-05-04 19:30:23 +02:00
José Valim
f6dc816367 Let's run those precious tests against the gem. 2011-05-04 18:46:19 +02:00
José Valim
92661b0c50 Move sandbox to AR and pass the sandbox as a value. This way, other ORMs like Datamapper can also have their own sandboxing in rails console. 2011-05-04 16:47:35 +02:00
José Valim
b9bba555ca Remove defined?(ActiveRecord) and use the railtie hook instead. 2011-05-04 16:32:24 +02:00
Xavier Noria
cea3b3cc9d Merge branch 'master' of git://github.com/lifo/docrails 2011-05-04 14:51:04 +02:00
Xavier Noria
897318f4ee fixes typo in railties/CHANGELOG (spotted by Vijay Dev) 2011-05-04 12:10:38 +02:00
José Valim
1632a3a49f More AV::Base cleanup. 2011-05-04 12:07:37 +02:00
Xavier Noria
30bb17e5e0 Merge pull request #384 from arunagw/new_plugin_test.
Fixed tests for new_plugin_generator.
2011-05-04 02:54:18 -07:00
Arun Agrawal
dd9200c32e Fixed tests for new_plugin_generator. 2011-05-04 15:07:06 +05:30
José Valim
6afc900191 Move prefixes to view paths as they are now a lookup context dependency. 2011-05-04 11:28:37 +02:00
Xavier Noria
d9c39c3ae9 restores the -j option, but now it accepts the name of any library
If passed "foo", a gem "foo-rails" is added to the Gemfile
and "foo" and "foo_ujs" are required in the application
JavaScript manifest.
2011-05-04 10:33:53 +02:00
Xavier Noria
5d2cdb190a removes the :update_ujs task in railties 2011-05-04 10:33:53 +02:00
Xavier Noria
33567d1d7b jQuery is no longer vendored 2011-05-04 10:33:53 +02:00
José Valim
c9fa3f03fe Also allow prefixes as third argument to lookup context. 2011-05-04 09:07:11 +02:00
José Valim
4758d37044 Merge remote branch 'apotonick/presentation' 2011-05-04 08:37:59 +02:00
Sebastian Martinez
24586edae2 Remove extra whitespaces 2011-05-03 21:38:19 -03:00
Sebastian Martinez
0ee2513356 Improves Mysql2 adapter docs 2011-05-03 21:26:02 -03:00
Sebastian Martinez
fab9bb77bf Added #recreate_database docs 2011-05-03 21:25:38 -03:00
Sebastian Martinez
f049062497 Fixes on schema_definitions docs 2011-05-03 21:11:17 -03:00
Nick Sutterer
eb327c1bab no @controller dependency in Renderers. 2011-05-04 00:12:11 +02:00
Nick Sutterer
b4bc2c50ca fixed test to assert initialization value. 2011-05-04 00:11:34 +02:00
Nick Sutterer
88c21121f1 initialize prefixes in LookupContext. 2011-05-04 00:10:21 +02:00
Nick Sutterer
65ceccb0ba controller's prefixes are now added to LookupContext. 2011-05-03 23:41:38 +02:00
Nick Sutterer
37f448e05e added :prefixes accessor to LookupContext. 2011-05-03 23:38:44 +02:00
José Valim
bff374050d Use latest rack-test. 2011-05-03 23:03:07 +02:00
Aaron Patterson
836b54eed8 Merge pull request #381 from joshk/mysql2_schema_test.
Added the mysql schema test to mysql2 adapter
2011-05-03 13:54:00 -07:00
backspace
3b795c12d7 Fix typo in Factory Girl description 2011-05-03 15:41:11 -05:00
Josh Kalderimis
323b7585e1 added the mysql schema test to mysql2 adapter, and fixed the corresponding failures 2011-05-03 21:15:10 +02:00
José Valim
d54ce7129c Merge pull request #380 from vijaydev/master.
Fixes typos in params wrapper test
2011-05-03 11:19:27 -07:00
Vijay Dev
f490a81443 Fix typos in test method names 2011-05-03 23:35:01 +05:30
Aaron Patterson
cb9557c432 make sure IM repository is cleared after body is closed 2011-05-03 09:59:22 -07:00
Aaron Patterson
d0719c5938 proxying the body in the IM middleware so that IM is available for streaming ERb 2011-05-03 09:59:22 -07:00
Aaron Patterson
3f897c1a4c adding a test case for the identity map middleware 2011-05-03 09:59:21 -07:00
Aaron Patterson
af8c54be0a cache strings in the AST for faster comparison than include? 2011-05-03 09:59:21 -07:00
José Valim
dd7afdb2dc Merge pull request #378 from danielvlopes/master.
Select_tag should have the same API of select from form_builder
2011-05-03 08:02:14 -07:00
José Valim
f9849070ac Add a shared entry point for AV and AC render which can be used as extension in the future. 2011-05-03 16:51:47 +02:00
Daniel Lopes
c5d54be746 fix select_tag to have the same behavior of select 2011-05-03 11:39:27 -03:00
José Valim
f82767e276 Merge pull request #377 from joshk/rails_legacy_mapper_message.
raise an error if the old router draw method is used
2011-05-03 07:21:35 -07:00
Josh Kalderimis
275529446e raise an error if the old router draw method is used, along with a message advising them to either upgrade their routes or add rails_legacy_mapper to their Gemfile 2011-05-03 16:07:25 +02:00
José Valim
7ae3b82ceb Merge pull request #375 from k33l0r/master.
Google Chrome sometimes incorrectly identifies the rescues template charset
2011-05-03 06:44:01 -07:00
Matias Korhonen
49b825e502 Sets the HTTP charset parameter for rescue response. 2011-05-03 16:30:59 +03:00
Matias Korhonen
c7f7a45676 Rescues template HTML5 doctype and the utf8 charset meta tag, and better font choices for Mac users. 2011-05-03 16:30:04 +03:00
José Valim
1ca81238b5 Add static_cache_control as configuration option and set a default for test. Should improve performance in acceptance tests. 2011-05-03 13:07:39 +02:00
José Valim
06ddda0a5f We no longer depend on those git repos. 2011-05-03 12:56:57 +02:00
José Valim
f7c711baee No need for a regexp here. 2011-05-03 12:42:42 +02:00
José Valim
e1c1685016 Static middleware accepts cache control. 2011-05-03 12:32:14 +02:00
José Valim
ed3e667415 Multipart is now fixed in Rack. 2011-05-03 12:10:11 +02:00
José Valim
ce6fef9d8b Merge pull request #373 from sikachu/bomb.
Fixing failing test case on 1.8.7 & bump Rack version
2011-05-03 02:57:16 -07:00
Prem Sichanugrist
31f412fc97 Fix broken params_wrapper_test on 1.8.7 💣
I have to keep in mind that 1.8.7 does *not* preserve the hash order.

Guys, let's move to use 1.9.2 in production!
2011-05-03 16:51:19 +07:00
Prem Sichanugrist
8bf5d684fd Update Action Pack to depend on Rack 1.3.0
Rack 1.3.0 was released a while ago, which break the hard dependency we set in Action Pack. This dependency bump won't be the issue, as we always depends on edge Rack. Also, we was waiting for Rack 1.3.x release before we can release Rails 3.1 beta anyway.
2011-05-03 15:40:52 +07:00
David Heinemeier Hansson
2fbbd08616 Use require_self from latest Sprockets 2011-05-02 19:24:49 -05:00
David Heinemeier Hansson
b359f9fe7c Merge branch 'master' of github.com:rails/rails 2011-05-02 19:21:03 -05:00
José Valim
35d0d82ae3 More performance optimizations. 2011-05-03 01:37:01 +02:00
Sebastian Martinez
d53c2e4952 fixed-fonts on SchemaDefinitions 2011-05-02 20:30:31 -03:00
José Valim
a55f2de0c5 Improve performance for filtered parameters and add tests. 2011-05-03 01:04:57 +02:00
José Valim
1afb56f481 Instrumentation should have callbacks. 2011-05-03 01:04:57 +02:00
José Valim
4bddc06e83 Move most processing to load time for performance and improve test suite. 2011-05-03 01:04:57 +02:00
José Valim
3cca86641e Update CHANGELOG. 2011-05-03 01:04:57 +02:00
Aaron Patterson
fa77665a34 Merge pull request #370 from joshk/unrolled_map.
favor map over each in mysql* adapters
2011-05-02 15:44:57 -07:00
Aaron Patterson
81cfbf4146 removing auto_link and moving it to the rails_autolink gem. 💣 2011-05-02 15:43:33 -07:00
Josh Kalderimis
b5824a4d04 favor collect over each in mysql* adapters 2011-05-03 00:33:39 +02:00
David Heinemeier Hansson
e30f068d65 Merge pull request #369 from smartinez87/params_wrapper.
Fix ParamsWrapper docs errors
2011-05-02 15:14:24 -07:00
Sebastian Martinez
c894fff60a Fix ParamsWrapper docs errors 2011-05-02 19:07:48 -03:00
David Heinemeier Hansson
b29a905f94 Flunk makes a lot more sense, doesnt it (hat tip @tenderlove) 2011-05-02 17:04:21 -05:00
José Valim
11db2ae4e0 Koz asked to test something crazy. 2011-05-02 23:45:24 +02:00
José Valim
83e35b9c08 Allow ignore_accept_header through configuration option. 2011-05-02 23:39:42 +02:00
José Valim
73c94ed97a Add ignore_accept_header config to AD::Request. 2011-05-02 23:38:57 +02:00
David Heinemeier Hansson
79a9bebcbf Merge pull request #359 from sikachu/params_wrapper.
Add `ActionController::ParamsWrapper` to wrap JSON parameters into a nested parameters.
2011-05-02 14:08:44 -07:00
Prem Sichanugrist
8c9e4d5202 Add ActionController::ParamsWrapper to wrap parameters into a nested hash
This will allow us to do a rootless JSON/XML request to server.
2011-05-03 03:21:43 +07:00
José Valim
7f5ff5df2d Merge pull request #367 from sikachu/credit_changelog.
Update CHANGELOG file to mention my name
2011-05-02 12:56:45 -07:00
Prem Sichanugrist
c577f186aa Update CHANGELOG file to mention my name
On the commit for updating :format parameters, seems like I've left out
the credit name after the CHANGELOG entry. This should fix it, and in
case someone has a problem they could seek assistance easier.
2011-05-03 02:38:10 +07:00
Aaron Patterson
951e18abea introduce a body proxy to ensure that query cache is enabled during streaming 2011-05-02 11:30:49 -07:00
Aaron Patterson
4300855e7d more tests around caching 2011-05-02 11:17:31 -07:00
Aaron Patterson
3066ea8b44 add a couple test cases surrounding query cache middleware 2011-05-02 11:13:49 -07:00
Sebastian Martinez
04d37b077b Remove extra whitespaces 2011-05-02 10:37:34 -03:00
Vijay Dev
09edaf4964 removed reference to verify method 2011-05-02 17:39:46 +05:30
Vijay Dev
527036ebd1 removed verify docs (feature removed in Rails3) 2011-05-02 17:31:00 +05:30
José Valim
3fc37e8ef9 Fix failing AR test. 2011-05-02 10:16:13 +02:00
José Valim
de9166325b Merge pull request #360 from cgriego/activeresource-performance.
Optimize ActiveResource::Base.new(attributes)
2011-05-01 23:36:50 -07:00
Joshua Peek
f76726c09d Use sprockets beta gem 2011-05-01 23:23:31 -07:00
Chris Griego
a962bfe472 Optimize ActiveResource::Base.new(attributes)
* Add performance benchmark similar to ActiveRecord
* Lazily find_or_create_resource_for_collection to not incur the overhead for empty arrays and arrays of primatives
* #duplicable? is faster than inline rescues when the object is not duplicable
* Don't constantly raise and handle NameError, raising is expensive
* Even when a resource is nested inside a module, always look inside the class first for the resource definition so we don't overwrite classes all the time

Before:                                     user     system      total        real
Model.new (instantiation)               0.120000   0.000000   0.120000 (  0.119961)
Nested::Model.new (instantiation)       0.150000   0.010000   0.160000 (  0.151183)
Model.new (setting attributes)         28.540000   0.680000  29.220000 ( 29.271775)
Nested::Model.new (setting attributes) 29.740000   0.580000  30.320000 ( 30.486210)

After:                                        user     system      total        real
Model.new (instantiation)                 0.120000   0.000000   0.120000 (  0.121249)
Nested::Model.new (instantiation)         0.150000   0.010000   0.160000 (  0.152429)
Model.new (setting attributes)           11.480000   0.170000  11.650000 ( 11.656163)
Nested::Model.new (setting attributes)   11.510000   0.210000  11.720000 ( 11.724249)
2011-05-01 23:13:08 -05:00
Sebastian Martinez
9fa080e703 Update security guide with #new and #create respect mass-assignment 2011-05-02 00:15:36 -03:00
David Heinemeier Hansson
31155eeb3c Make the identity map use the instrumentation infrastructure so we can style the messages nicely with colors (FIXME: Can someone look into why the test is not working?) 2011-05-01 19:10:21 -06:00
David Heinemeier Hansson
635abc7194 Remove schema noise from logging (TODO: Deprecate/remove the name attribute to all these methods -- will take a pull request!) 2011-05-01 18:22:43 -06:00
David Heinemeier Hansson
a8861c8f5b Merge pull request #357 from joshk/assign_attributes.
Assign protected attributes with create/new and control the role.
2011-05-01 16:59:33 -07:00
David Heinemeier Hansson
32ef3ccaa6 Merge pull request #340 from joshk/default_scope_changes.
removed the default_scope deprecations and updated the docs and tests to
2011-05-01 16:54:36 -07:00
Xavier Noria
2db538c8a8 made a copy-edit pass on the streaming RDoc 2011-05-02 01:26:53 +02:00
Nick Howard
86ea94e4d0 Fix for lighthouse #6741
- adds tests for find_or_create_by and find_or_initialize_by on has_many associations
- changes the behavior of ActiveRecord::Associations::CollectionProxy#method_missing to differ to
  ActiveRecord::FinderMethods#find_or_instantiator_by_attributes for arg processing and saving so
  find_or_create_by's api on associations will be consistent w/ the api for model classes.
2011-05-01 16:22:56 -06:00
Josh Kalderimis
86d7ed3375 singular and collection relations in AR can now specify mass-assignment security options (:as and :without_protection) in build, create and create! methods. 2011-05-01 23:30:07 +02:00
Josh Kalderimis
7c5ae0a88f Added mass-assignment security :as and :without_protection support to AR.new and AR.create 2011-05-01 23:08:50 +02:00
Aaron Patterson
b8ccd05524 convert strings to lambdas so we can use a consistent interface to the objects in the collection 2011-05-01 12:16:12 -07:00
Sebastian Martinez
06b9138188 Added some docs on ActiveResource::HttpMock 2011-05-01 15:59:27 -03:00
Aaron Patterson
23eb81a3d1 assert_difference can take a callable piece of code rather than just evaling a string 2011-05-01 11:55:13 -07:00
Sebastian Martinez
825dae1f0b Documented ActiveResource#observing 2011-05-01 15:50:53 -03:00
Sebastian Martinez
2472428881 Remove extra whitespaces. 2011-05-01 15:46:01 -03:00
Sebastian Martinez
31110c50e4 Fix punctuation errors. 2011-05-01 15:33:27 -03:00
Aaron Patterson
1800a6d1c8 Merge pull request #316 from arunagw/jdbc_postgresql.
Re-factored database.rake to allow Jdbcpostgresql. #jruby
2011-05-01 10:53:41 -07:00
José Valim
13df194c00 Tidy up pending TODOs after discussion with Mr. Gatoz (@wycats). 2011-05-01 19:39:57 +02:00
Sebastian Martinez
ca608b8c9c Bring this back on the contributing guide. 2011-05-01 12:28:16 -03:00
José Valim
8dbee3aba6 Streaming docs. 2011-05-01 14:50:42 +02:00
José Valim
46611a995d log errors when an exception happens when streaming. 2011-05-01 13:40:14 +02:00
José Valim
6960a230fa Add a test for rendering from the controller context. 2011-05-01 13:40:14 +02:00
José Valim
b735761385 Introduce view renderer. 2011-05-01 13:40:13 +02:00
José Valim
367bdc5361 Remove view dependency from AV::Renderer. 2011-05-01 13:40:13 +02:00
José Valim
33cc001f91 More cleanup and moving responsibilities around. 2011-05-01 13:40:12 +02:00
José Valim
2f683fd870 Remove more dependencies from the view. 2011-05-01 13:40:12 +02:00
José Valim
bebaccdf4a Remove dependency from _template. 2011-05-01 13:40:12 +02:00
José Valim
d08f65118c Start abstracting the renderer. 2011-05-01 13:40:12 +02:00
Xavier Noria
e68b7a001d (temporary hack) generate a main file for RDoc escaping "Rails"
RDoc autolinks the word "Rails" to the doc page for the Rails module.
But README.rdoc is displayed in the home page at GitHub and the slashes
are visible there, which is weird. We leave by now the slashes off in
the file, and generate a second file for the API with them.
2011-05-01 13:15:15 +02:00
Vijay Dev
d1f7656448 remove info about adding verified tag 2011-05-01 16:15:53 +05:30
Vijay Dev
4760464efb fix GitHub guides url 2011-05-01 15:46:46 +05:30
Xavier Noria
2fbf302149 Merge branch 'master' of git://github.com/lifo/docrails
Conflicts:
	railties/guides/source/contributing_to_ruby_on_rails.textile
2011-05-01 11:16:31 +02:00
Aaron Patterson
a0656989c4 fixing more test warnings in 1.9.3 2011-04-30 17:40:53 -07:00
Aaron Patterson
9274a5744b fixing test warnings 2011-04-30 17:37:58 -07:00
Aaron Patterson
1d7c0336ef using bind parameters for updates 2011-04-30 17:27:46 -07:00
Aaron Patterson
e14e696e96 fixing arel requirements for released arel 2011-04-30 17:27:25 -07:00
Sebastian Martinez
b84b759ec6 Improved ActiveModel Observing docs. 2011-04-30 20:35:25 -03:00
Santiago Pastorino
754c2dd2e1 Change from LH to github way of autoclosing issues 2011-04-30 02:16:50 -03:00
Xavier Noria
b2aacc346c Prototype and Scriptaculous are no longer vendored, but provided by prototype-rails from now on, also the -j option of the application generator is removed 2011-04-30 03:53:24 +02:00
Aaron Patterson
7ee5f2eee5 making sure the create_fixtures method works to prevent regressions 2011-04-29 18:21:24 -07:00
Aaron Patterson
2987115656 make sure we flatten the fixture path list 2011-04-29 18:21:24 -07:00
Aaron Patterson
1f5249bf93 shorten up our fixture path resolving code 2011-04-29 18:21:24 -07:00
Mike Gehard
bf3a3c22c0 Removed so info about assigning to specific devs and adding tags. I don't believe that you can do that in GitHub issues. Remove state:committed notes as they also don't exist in GitHub issues. 2011-04-29 19:19:25 -06:00
Santiago Pastorino
9ef4b70b20 Update jquery-ujs and prototype-ujs 2011-04-29 21:44:40 -03:00
Santiago Pastorino
5076264163 Make update_ujs task update the right files 2011-04-29 21:44:05 -03:00
Sebastian Martinez
1302bf295a Added missing word on guide 2011-04-29 21:22:33 -03:00
David Heinemeier Hansson
e350641d02 Include CSRF token in remote:true calls 2011-04-29 18:22:10 -06:00
Aaron Patterson
651836a4bd table name needs to be classified when instantiating fixtures 2011-04-29 17:20:56 -07:00
Sebastian Martinez
9c0196a6bb Upload patches is for LH, we use pull requests on GitHub now 2011-04-29 21:18:49 -03:00
Dan Pickett
1efaed5af1 Merge branch 'master' of github.com:lifo/docrails 2011-04-29 19:18:10 -04:00
Dan Pickett
85c8d73642 update contributors guide to reflect GitHub use
* outlines how to review pull requests
* outlines how to issue pull requests
* changed all references from LH => GH
2011-04-29 19:17:34 -04:00
Xavier Noria
9971387a3b Merged pull request #350 from bcardarella/master.
Fixed documentation, 'asset' -> 'assets'
2011-04-29 14:23:33 -07:00
Brian Cardarella
564fe7f633 Fixed comment 'config.asset' => 'config.assets' 2011-04-29 14:17:40 -07:00
Xavier Noria
cc35d5c9e7 JavaScript expansions are ignored if the application uses the asset pipeline, warn the user 2011-04-29 22:14:34 +02:00
Bradley Harris
aba149d702 Fix bug with empty CDATA not being handled in Hash.from_xml 2011-04-29 14:47:49 -04:00
Aaron Patterson
60c877c43b convert query results to a list of lists 2011-04-29 11:47:04 -07:00
Aaron Patterson
0eea560b48 requring pg ~> 0.11, so remove conditional code for supporting older versions of the gem 2011-04-29 11:44:17 -07:00
José Valim
0c76eb1106 No need for &block here. 2011-04-29 20:30:21 +02:00
José Valim
58ad5e1859 Make postgresql faster on development (thanks to @tapajos). 2011-04-29 20:30:20 +02:00
Aaron Patterson
146474256c lean on rubygems to provide error messages about missing gems 2011-04-29 11:09:37 -07:00
Aaron Patterson
00f030c6e1 supporting delete with bind parameters in mysql2 2011-04-29 11:09:37 -07:00
Aaron Patterson
ed775c66bc refactor exec_delete to reuse the statement cache from exec_query 2011-04-29 11:09:37 -07:00
Aaron Patterson
4c41be9b83 statement cache for deletes working on mysql 2011-04-29 11:09:37 -07:00
Aaron Patterson
453bd2f39d sqlite3 supports prepared statement deletes 2011-04-29 11:09:37 -07:00
Aaron Patterson
f1df6b2dce postgresql supports prepare statement deletes 2011-04-29 11:09:37 -07:00
Bradley Harris
2450177656 Added test for empty CDATA bug in from_xml 2011-04-29 14:09:06 -04:00
Aaron Patterson
850b3ca477 supporting nil when passed in as an IN clause 2011-04-29 11:01:59 -07:00
gmile
66a18855ea Test that passing nil member of array in conditions retrieves records with nil
value on a selected field.
2011-04-29 09:43:18 -07:00
José Valim
3331166b48 Merged pull request #344 from asanghi/callback_if.
:if should not fire on validations when not in context with :on
2011-04-28 23:24:40 -07:00
Aditya Sanghi
8bce6e761d DRY this baby up 2011-04-29 10:21:16 +05:30
Aditya Sanghi
36ee2bafec fix typo 2011-04-29 09:53:02 +05:30
Aditya Sanghi
bf5cf5db86 :if should not fire on validations when not in context with :on 2011-04-29 02:54:37 +05:30
Aditya Sanghi
610e4d9f24 add more documentation; remove unused assignment 2011-04-29 02:03:56 +05:30
Aditya Sanghi
a869382a9f Allow AM/PM in datetime selectors 2011-04-29 01:49:45 +05:30
José Valim
e59491355e Merge remote branch 'myron/am_disabling_fix_memory_leaks' 2011-04-28 19:17:03 +02:00
Aaron Patterson
fc343d26ff clearing statement from cache on exception in order to support older versions of mysql 2011-04-28 09:48:16 -07:00
Josh Kalderimis
5164c50d7f removed the default_scope deprecations and updated the docs and tests to reflect its use cases 2011-04-28 18:46:40 +02:00
Myron Marston
7db7aa5053 Add additional tests for AM::ObserverArray that I had missed yesterday. 2011-04-28 08:32:22 -07:00
Myron Marston
fef22157b0 Fix bug with AM::Observer disablement.
Now that we propagate the enabling/disabling to descendants, we no longer have to check the disabled_observer Set on each superclass of the model class.  This was causing a bug when disabling all observers at a superclass level and then enabling an individual observer at a subclass level.

Plus the logic is simpler now :).
2011-04-28 08:27:15 -07:00
Myron Marston
9a385394ac Fix dev env memory leaks by using AS::DescendantsTracker rather than keeping track of subclasses manually.
There's also no need to keep track of all ObserverArray instances in a hash, as this is likely to leak memory, too.
2011-04-28 08:07:08 -07:00
Myron Marston
05d4653cef Revert "Revert "Handle enabling/disabling observers at different levels of the class hierarchy.""
This reverts commit 2a25c5818b.

I'm going to add another commit that keeps the same behavior of fixes
the problems of leaking memory in development.
2011-04-28 07:58:58 -07:00
José Valim
bf50222b0b Merged pull request #327 from dcrec1/master.
Prefix option for number_to_human_size
2011-04-28 05:38:46 -07:00
José Valim
533efd891a Merged pull request #336 from neerajdotname/upgrade_rack_mount.
upgrade rack-mount to 0.7.2
2011-04-28 03:46:12 -07:00
Neeraj Singh
502aaec92c upgrade rack-mount
Newer version is a few minor performance fixes
2011-04-28 06:35:58 -04:00
José Valim
bb44cd727f Tidy up previous commit. 2011-04-28 09:47:07 +02:00
José Valim
182d00897a Merged pull request #219 from panthomakos/memcache.
Character encoding issues with MemCacheStore in 1.9.2
2011-04-28 00:40:42 -07:00
José Valim
be55228bbf Merged pull request #333 from jgarber/master.
Specific translations for labels with values
2011-04-28 00:36:32 -07:00
Stefan Rohlfing
010dbf7a2f Merged pull request #40 from bytesource/master.
Rails Routing from the Outside In (routing.textile): Fixed Regex
2011-04-28 00:35:29 -07:00
José Valim
2a25c5818b Revert "Handle enabling/disabling observers at different levels of the class hierarchy."
This reverts commit ad62f19287 because the current
subclasses implementation leaks memory in development.

Instead of keeping an array of subclasses, the better solution is to
ask the parent if an observer is being disabled or not.
2011-04-28 09:32:57 +02:00
Stefan Rohlfing
4c50a0f800 Edited railties/guides/source/routing.textile via GitHub 2011-04-28 00:25:03 -07:00
José Valim
5297049e32 Merged pull request #328 from MSNexploder/fix_clear_inflector.
proper reset all inflector scopes
2011-04-28 00:19:13 -07:00
Jason Garber
a07cee62c7 Allow a label with the value option to have value-specific translations. 2011-04-27 21:00:27 -06:00
Myron Marston
ad62f19287 Handle enabling/disabling observers at different levels of the class hierarchy.
Last call wins.
2011-04-28 10:25:07 +08:00
Myron Marston
1f8cc446d9 Allow observers to be enabled and disabled.
This is useful in situations like model unit tests and the occasional rake task to backfill old data.
2011-04-28 10:23:49 +08:00
Myron Marston
5d20c0a64a Wrap line that is over 200 characters long. Now it's much easier to read. 2011-04-28 10:23:48 +08:00
Diego Carrion
07bbaaa3b1 added a :prefix option to number_to_human_size 2011-04-27 20:29:03 -03:00
Aaron Patterson
bed6a775df requiring a newer version of the mysql2 gem 2011-04-27 14:44:28 -07:00
Aaron Patterson
e190569cfb Merged pull request #325 from joshk/mass_assignment_tests_fixed.
final corrections to the mass-assignment security tests
2011-04-27 14:32:49 -07:00
Josh Kalderimis
78e581bd2f some test renaming to avoid collisions, and some annoying issues between dbs 2011-04-27 23:27:10 +02:00
Vijay Dev
001a5a6496 document the reorder method(fb21511040) 2011-04-28 01:50:00 +05:30
misfo
9f6cafd5fd prevent errors when passing a frozen string as a param to ActionController::TestCase#process
since ActionDispatch::Http::Parameters#encode_params will force encoding on all params strings (when using an encoding aware Ruby), dup all strings passed into process.  This prevents modification of params passed in and, more importantly, doesn't barf when a frozen string is passed
thanks and high fives to kinsteronline
2011-04-28 04:07:57 +08:00
Aaron Patterson
1cd5a084c1 Merged pull request #325 from joshk/mass_assignment_tests_fixed.
final corrections to the mass-assignment security tests
2011-04-27 12:07:36 -07:00
Josh Kalderimis
e85dbd8f06 final corrections to the mass-assignment security tests 2011-04-27 20:57:56 +02:00
Arun Agrawal
ffc9374afd Minor fixes in databases.rake 2011-04-27 23:09:56 +05:30
Vijay Dev
089ee31aad update the Array#from behaviour changes - returns [] if index exceeds array length 2011-04-27 22:21:50 +05:30
Joshua Peek
c992045da3 Merged pull request #324 from joshk/fix_array_from.
fixed a small bug with Array#from core_ext
2011-04-27 08:42:32 -07:00
Josh Kalderimis
11537c57cb fixed a small bug with Array#from core_ext 2011-04-27 17:35:00 +02:00
David Heinemeier Hansson
e84788e60c Relevant options closer together 2011-04-27 08:55:26 -06:00
Vijay Dev
f76dd271c6 minor changes 2011-04-27 19:50:51 +05:30
Josh Kalderimis
a009c3b4b9 minor git sources formatting change in railties app_base.rb 2011-04-27 22:05:58 +08:00
Jared McFarland
d56befbd31 using @tenderlove's suggested implementation to speed things up 2011-04-27 20:51:39 +08:00
Ganesh Kumar
bd2444d1a8 enable uglifier gem as new version of execjs is relased 2011-04-27 20:50:09 +08:00
Arun Agrawal
8fd998284d Allowing jdbcsqlite3 to drop database, clone structure. #jruby 2011-04-27 13:51:07 +05:30
Sebastian Martinez
c4b494bdc4 Rephrased Dirty#changed? docs 2011-04-26 23:37:11 -03:00
Sebastian Martinez
4554983ab1 Removed extra whitespace 2011-04-26 23:29:11 -03:00
Sebastian Martinez
a2bfa5fa30 Better formatting on ActiveModel::Translation 2011-04-26 23:26:10 -03:00
Piotr Sarnacki
e8c1031092 Merged pull request #319 from nusco/master.
Fixed minor typo in comment
2011-04-26 16:32:15 -07:00
Paolo "Nusco" Perrotta
24e4ea582b Fixed minor typo in comment 2011-04-26 16:15:20 -07:00
Aaron Patterson
2cac007c41 Merged pull request #318 from joshk/fix_tests.
fix mass-assignment security tests
2011-04-26 15:34:03 -07:00
Josh Kalderimis
fee69cb021 fix mass-assignment security tests, this was due to a string column limit which doesn't cause issues on sqlite 2011-04-27 00:28:24 +02:00
David Heinemeier Hansson
344c7766a5 Merged pull request #317 from jaredonline/master.
Change Array#from to return consistent results
2011-04-26 14:55:22 -07:00
Jared McFarland
74634d452b fixing Array#from to return consistent results 2011-04-26 14:46:52 -07:00
Arun Agrawal
c8102817ca Re-factored database.rake to allow Jdbcpostgresql. #jruby 2011-04-27 00:57:50 +05:30
David Heinemeier Hansson
4ce14fb080 Merged pull request #313 from chadk/master.
[patch] Asset helpers should understand scheme-relative URLs
2011-04-26 11:56:40 -07:00
Chad Krsek
c15108ce06 moving check fo scheme-relative URI into is_uri? 2011-04-26 11:50:08 -07:00
David Heinemeier Hansson
c57320d769 Prem fixes 1.9 engine test issue 2011-04-26 12:46:28 -06:00
José Valim
e36befbdd7 Merged pull request #279 from miloops/434d757.
Fix console to accept [environment] [options] as specified in docs.
2011-04-26 11:15:42 -07:00
Vijay Dev
c1132f7093 added the list of reversible commands in the newer migrations 2011-04-26 23:40:47 +05:30
Aaron Patterson
91bd1951cc Merged pull request #314 from smartinez87/master.
Fix #update_attributes api format error
2011-04-26 11:08:00 -07:00
Sebastian Martinez
0421002d78 Fix #update_attributes api format error 2011-04-26 14:58:06 -03:00
Vijay Dev
b105dc441b minor changes in migrations guide 2011-04-26 23:18:55 +05:30
Aaron Patterson
e28f9ad9df simplifying buffered logger for easier and slightly more performant codes. pumpkin 2011-04-26 10:41:59 -07:00
Aaron Patterson
315f555744 Merged pull request #307 from arunagw/master.
jdbcpostgresql support added into template.
2011-04-26 10:32:29 -07:00
Chad Krsek
b49a1192d3 asset helpers should understand scheme-relative URLs 2011-04-26 10:24:50 -07:00
David Heinemeier Hansson
9dc41a27d9 Merged pull request #311 from joshk/assign_attributes.
AR update_attributes api is updated to reflect the addition of assign_att
2011-04-26 10:00:51 -07:00
Prem Sichanugrist
d4259d8932 Change from self.(up|down) to (up|down) method 2011-04-26 23:33:39 +07:00
Prem Sichanugrist
72822800d5 Update guide to use change method in various places after migration generator has changed. 2011-04-26 23:32:03 +07:00
Aaron Patterson
8111facdb4 Merged pull request #311 from joshk/assign_attributes.
AR update_attributes api is updated to reflect the addition of assign_att
2011-04-26 09:22:43 -07:00
Joshua Peek
472f3fb61f Merged pull request #312 from joshk/bump_multi_json.
bump multi_json dependency
2011-04-26 09:07:14 -07:00
Josh Kalderimis
bb7024b6ec AR update_attributes api is updated to reflect the addition of assign_attributes 2011-04-26 18:00:57 +02:00
Josh Kalderimis
1233e09b7d bump multi_json dependency 2011-04-26 17:54:41 +02:00
Aaron Patterson
6e02a61f39 Merged pull request #310 from beanieboi/master.
Added support for tsvector datatype in postgres
2011-04-26 08:52:37 -07:00
Prem Sichanugrist
e6898e3b60 Change examples in guide to reflect changes from XML -> JSON 2011-04-26 22:23:57 +07:00
Sven Fuchs
a5b0f7064c bump the i18n gem to 0.6.0beta1 and update docs for the i18n exception handler [#6739 state:committed]
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-04-26 15:10:58 +02:00
Mikel Lindsaar
dd44626c7f Updating to use Mail v2.3.0
Need to move the require of mail in test/abstract_unit to be after active support
  to make sure we use ActiveSupport multibyte handlers, otherwise, Mail will load its
  internal multibyte compat
2011-04-26 20:05:59 +10:00
Benjamin Fritsch
714b4a82f4 Added tsvector Datatype Support
Applied Patch from https://rails.lighthouseapp.com/projects/8994/tickets/5577-suport-from-tsvector-data-type-in-postgresql
2011-04-26 09:47:40 +02:00
José Valim
b73c84eaa7 Merged pull request #308 from joshk/assign_attributes.
deprecated the use of guard_protected_attributes with attributes= in AR
2011-04-25 23:58:23 -07:00
Chad Krsek
7469041c59 Revert "asset helpers should understand scheme-relative URLs"
This reverts commit 057412ce38.
2011-04-25 21:57:49 -07:00
Chad Krsek
057412ce38 asset helpers should understand scheme-relative URLs 2011-04-25 21:57:28 -07:00
Aaron Patterson
3a109f78cd Merged pull request #277 from kuinak/master.
Correct documentation for asset host strategy for 1.9.2
2011-04-25 17:00:52 -07:00
Philipp Kempgen
474e313d02 test "Escapes special HTML/XML characters" do ... 2011-04-26 01:05:41 +02:00
Aaron Patterson
933644519c Merged pull request #306 from rsim/case_insensitive_uniqueness_validation_fix.
Do not use SQL LIKE operator for case insensitive uniqueness validation
2011-04-25 15:33:05 -07:00
Aaron Patterson
242d24d385 Merged pull request #309 from arunagw/sass_new.
Using sass directly as new version is out.
2011-04-25 15:30:02 -07:00
Josh Kalderimis
f9d5a7bb8c deprecated the use of the guard_protected_attributes argument with attributes= in AR in favor of assign_attributes(attrs, :without_protection => true) 2011-04-25 23:57:09 +02:00
Arun Agrawal
348b5b9938 Using sass directly as new version is out. 2011-04-26 02:56:05 +05:30
Diego Carrion
873c13fc0d added test for number_to_phone with an empty string and area code true
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-04-25 17:57:54 -03:00
Arun Agrawal
253ba7779e Database creation for jdbcpostgresql #jruby 2011-04-26 02:13:20 +05:30
Vishnu Atrai
16d3266144 jdbcpostgresql support added into template. 2011-04-26 01:00:37 +05:30
Raimonds Simanovskis
070c9984a5 Do not use SQL LIKE operator for case insensitive uniqueness validation
It can result in wrong results if values contain special % or _ characters. It is safer to use SQL LOWER function and compare for equality.
2011-04-25 22:17:18 +03:00
Aaron Patterson
12427c8dea Merged pull request #304 from arunagw/jdbcmysql_db_create.
Fixed error when running db:create with jdbcmysql
2011-04-25 11:17:16 -07:00
José Valim
f3c335f1cd Merged pull request #305 from joshk/bump_deprecation.
bump AS deprecation_horizon to 3.2
2011-04-25 10:58:50 -07:00
Josh Kalderimis
75216248ef bump AS deprecation_horizon to 3.2 2011-04-25 19:55:09 +02:00
Rashmi Yadav
6464f7b9be Fixed error when running db:create with jdbcmysql 2011-04-25 23:05:17 +05:30
Aaron Patterson
17fec021d1 Merged pull request #300 from arunagw/jdbc_test.
Start Adding jdbcmysql support to new rails template.
2011-04-25 09:20:40 -07:00
Aaron Patterson
2fc8d7ea90 Merged pull request #302 from metaskills/empty_inserts.
Use existing #empty_insert_statement_value for an insert with no columns.
2011-04-25 09:18:39 -07:00
Piotr Sarnacki
f545a5081e Fix tests, main_app mounted helper must be defined explicitly now. 2011-04-25 17:57:52 +02:00
Piotr Sarnacki
d4bea35f1a Make ActionController::Base.modules_for_helpers and ActionController::Base.all_helpers_from_path public methods 2011-04-25 15:02:41 +02:00
Piotr Sarnacki
820c0feda3 Explicitly define main_app proxy 2011-04-25 14:56:58 +02:00
Piotr Sarnacki
e38b4436a5 Add Engine#helpers method which loads all the engine's helpers 2011-04-25 13:44:27 +02:00
David Heinemeier Hansson
723a0f82c4 Go with latest Sass directly 2011-04-25 06:34:43 -05:00
José Valim
2bc48561d5 Fix tests. 2011-04-25 11:14:39 +02:00
David Chelimsky
8d00dfca7f rename test case to better describe use case
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-04-25 09:31:48 +02:00
Prem Sichanugrist
f2fc921447 No need to check for both full and mountable.
All mountable engine are considered `full?` already.
2011-04-25 15:30:58 +08:00
Prem Sichanugrist
a1c31eca47 Add app/assets/images directory to plugin new generator 2011-04-25 15:30:58 +08:00
David Heinemeier Hansson
05ce0007db Temporarily disable uglifier until a new version depending on execjs 0.2.0 can be released (tomorrow?) 2011-04-24 20:34:22 -05:00
David Heinemeier Hansson
b306502286 Merge branch 'master' of github.com:rails/rails 2011-04-24 20:33:33 -05:00
Stefan Huber
ba9891f13d proper reset all inflector scopes 2011-04-25 02:17:22 +01:00
Sebastian Martinez
c60e207674 Better formatting here 2011-04-24 19:44:12 -03:00
Ken Collins
35d0b6029f Use existing #empty_insert_statement_value for an insert with no columns. 2011-04-24 12:52:28 -04:00
Josh Kalderimis
bf40c729c6 minor correction to the AMo mass-assignment security docs 2011-04-24 09:58:12 +02:00
Josh Kalderimis
f3b9d3aba8 added config.active_record.whitelist_attributes which creates an empty whitelist of attributes available for mass assignment for all models in your app 2011-04-24 09:58:12 +02:00
Josh Kalderimis
b3ba36830b updated the security guide on the updated mass-assignment security scopes addition, and assign_attributes in AR 2011-04-24 09:56:48 +02:00
Josh Kalderimis
a08d04bedf Added assign_attributes to Active Record which accepts a mass-assignment security scope using the :as option, while also allowing mass-assignment security to be bypassed using :with_protected 2011-04-24 09:53:18 +02:00
Josh Kalderimis
1054ebd613 AM mass assignment security attr_accessible and attr_protected now allow for scopes using :as => scope eg.
attr_accessible :name
    attr_accessible :name, :admin, :as => :admin
2011-04-24 09:53:18 +02:00
David Chelimsky
220782e4f0 rename test case to better describe use case 2011-04-23 17:18:06 -05:00
Vijay Dev
dcee094b22 indentation fixes 2011-04-24 02:17:06 +05:30
Arun Agrawal
51854de52c Adding jdbcsqlite3 name in comment. 2011-04-24 01:59:20 +05:30
Arun Agrawal
d59a9507cb Looks more friendly. 2011-04-24 00:17:19 +05:30
misfo
3e1f4dbb4d document HTML::Selector's :has(string) pseudo class 2011-04-23 10:15:38 -05:00
Arun Agrawal
b335533e16 jdbcsqlite3 support added into template. #jruby 2011-04-23 19:03:24 +05:30
David Heinemeier Hansson
8d7efe6a4e Stop adding actual dummy tests (they clutter up the real ones in a new app), just show how its done 2011-04-23 13:22:30 +02:00
Sebastian Martinez
0887385d8e Added missing docs to mysql2_adapter 2011-04-22 21:30:30 -03:00
Sebastian Martinez
8f1b141b3f Fixed punctuation errors. 2011-04-22 21:17:51 -03:00
Sebastian Martinez
a510f5c39f Better docs formatting 2011-04-22 21:13:35 -03:00
Sebastian Martinez
4d0464187c Fix #postgresql_version docs 2011-04-22 21:02:49 -03:00
Sebastian Martinez
17d34d149e Added docs for #version on mysql_adapter 2011-04-22 21:01:29 -03:00
Sebastian Martinez
3e678daa72 Added some docs on SQLite adapter 2011-04-22 20:58:02 -03:00
Sebastian Martinez
868fb3825c Make this docs more consistent with the rest of the docs present 2011-04-22 20:50:15 -03:00
Sebastian Martinez
0ce94f4020 dot missing here 2011-04-22 20:39:26 -03:00
Sebastian Martinez
616eef33a5 Added doc for #table_exists? 2011-04-22 20:39:00 -03:00
Sebastian Martinez
e382d95e1e Added docs for #rename_table on some adapters 2011-04-22 20:26:20 -03:00
Sebastian Martinez
5d59cd8d6a Added docs for #columns on some adapters 2011-04-22 20:20:25 -03:00
Xavier Noria
384dbfd140 Merge branch 'master' of git://github.com/rails/rails 2011-04-23 01:16:21 +02:00
Sebastian Martinez
900470cf3c Added docs for #indexes on adapters 2011-04-22 20:13:24 -03:00
Xavier Noria
af1b48926f Merge branch 'master' of git://github.com/lifo/docrails
Conflicts:
	activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
2011-04-23 01:11:24 +02:00
Xavier Noria
df70b9dfb2 copy-edits 0e2644c 2011-04-23 00:54:20 +02:00
Xavier Noria
ca2f826f5a copy-edits e2656e0 2011-04-23 00:54:19 +02:00
Xavier Noria
2c50239216 copy-edits 3d45964 2011-04-23 00:54:19 +02:00
Xavier Noria
ec33de5dcb copy-edits 2f0dca5 2011-04-23 00:54:19 +02:00
Sebastian Martinez
1a7737353f Added docs for #drop_database on MySQL adapter 2011-04-22 19:44:30 -03:00
José Valim
f7538808d4 File watcher won't make the cut for 3.1. Maybe on 3.2. 2011-04-23 00:00:30 +02:00
Ronnie Miller
3050497a54 Grammer fix on note about wildcard routes 2011-04-22 14:50:52 -07:00
David Heinemeier Hansson
3f7a434d2e The example uses erb 2011-04-22 23:38:03 +02:00
Vijay Dev
e46e106c54 fix block alignment 2011-04-23 03:06:06 +05:30
José Valim
013d9016ca Use .erb in the test. 2011-04-22 23:25:52 +02:00
Vijay Dev
b22f39ec6f fix indentation 2011-04-23 02:54:07 +05:30
Vijay Dev
98b700e0bf add examples for array access methods 2011-04-23 02:54:07 +05:30
Vijay Dev
eac264d747 updating to_xml example to new AR api 2011-04-23 02:54:07 +05:30
Aaron Patterson
5bed6494d4 split indexes and column types on money / binary iteration 2011-04-22 15:41:13 -05:00
Aaron Patterson
3d19b356d7 fetch result row arrays from pg in C and return early if there are no money or binary columns. ❤️ 2011-04-22 15:41:13 -05:00
Aaron Patterson
3eae734012 set the backtrace to prevent AR exceptions from lying to us 2011-04-22 15:41:13 -05:00
Arun Agrawal
d42e43b3e5 Fixed images path in plugin_new_generator 2011-04-23 04:08:01 +08:00
Schneems
a8870d140e show http method in routing error message 2011-04-23 03:40:09 +08:00
Arun Agrawal
6cea2436d7 Start Adding jdbcmysql support to new rails template.
More will come for jruby app.
2011-04-23 00:41:52 +05:30
Arun Agrawal
eb599295db Images path fixed in test. 2011-04-23 02:22:12 +08:00
David Heinemeier Hansson
bb6b17216d Need this for testing 2011-04-22 20:03:12 +02:00
David Heinemeier Hansson
89f315bfb2 We cant use assert_block because its buggy in MiniTest and wont actually show you the failure message you provide -- instead you just always get a "Expected block to return true" 2011-04-22 19:38:01 +02:00
Aaron Patterson
a37722182f removing incorrect comment and string concatenation 2011-04-22 12:21:59 -05:00
Pavel Forkert
96acdd3ec4 Added test case and fix for proper eager loading associations 2011-04-22 12:06:15 -05:00
Aaron Patterson
fe4932b531 bumping the pg requirements 2011-04-22 11:27:14 -05:00
Ken Collins
bc50c1cb02 The #substitute_at gets an ActiveRecord::ConnectionAdapters::Column in #insert to match replacement in #exec_query. 2011-04-23 00:15:33 +08:00
David Heinemeier Hansson
59ce0f695b Turn on JS/CSS compression by default 2011-04-22 18:06:59 +02:00
Sebastian Martinez
02ee2003a8 Added docs for #disconnect! on adapters 2011-04-22 12:59:05 -03:00
Sebastian Martinez
0e2644cde0 Added missing docs for clear_cache! on adapters 2011-04-22 12:53:02 -03:00
Joshua Peek
dab96a267e Add shorthand for js and css compressors 2011-04-22 10:49:55 -05:00
Sebastian Martinez
e2656e07b9 Added missing docs for +supports_primary_key?+ on some adapters 2011-04-22 12:45:46 -03:00
Sebastian Martinez
3d459645c6 Added missing docs for +support_migrations?+ on some adapters 2011-04-22 12:35:53 -03:00
Sebastian Martinez
00e9cbd78a Have a more connection specific rdoc for +supports_statement_cache?+ 2011-04-22 12:22:53 -03:00
Sebastian Martinez
20002850b3 Removed ON() on distinct comment 2011-04-22 12:14:47 -03:00
Semyon Perepelitsa
6822f39f67 Remove HTML escaping from Record Tag Helper docs. 2011-04-22 23:12:14 +08:00
Ken Collins
ed2820d6ec Move #exec_insert to abstract adapter's database statements. 2011-04-22 22:32:55 +08:00
Josh Kalderimis
0cf7b2f1b4 minor correction to the Active Model instantiate_observers doc 2011-04-22 15:24:11 +02:00
Cheah Chu Yeow
c389b832f0 Grammar fixes for Object#in? documentation. 2011-04-22 15:14:14 +08:00
Aaron Patterson
724a786677 stop using distinct on for the unique id queries. [#6450 state:resolved] 2011-04-21 22:47:13 -05:00
Joshua Peek
84f1b83df8 Only include SprocketsHelper into assets context 2011-04-21 11:03:56 -05:00
Joost Baaij
783007a8ad Replace example hostname with "example.com".
The hostname used in these comments actually exists, which is
undesirable. See also RFC 2606.
2011-04-21 16:32:02 +02:00
José Valim
d31af44012 Fix tests on 1.8 by explicitly checking for strings (which also improves performance). 2011-04-20 21:54:19 +02:00
Vijay Dev
2f0dca5ee0 document the Active Support extension - String#inquiry 2011-04-20 23:25:33 +05:30
Eric Anderson
a48f8089ab Exception got moved to ActiveModel with Rails 3 2011-04-20 10:43:35 -04:00
Sebastian Martinez
aa19a7d085 Fix 'FIXME' annotation typo 2011-04-19 23:21:40 -03:00
Akira Matsuda
1c5d5ad3e9 NilClass is a singleton 2011-04-20 06:31:56 +09:00
Xavier Noria
356dacbafc Merge branch 'master' of git://github.com/lifo/docrails 2011-04-19 23:03:28 +02:00
Josh Kalderimis
68eb84d735 correction to the i18n locale filter examples 2011-04-19 22:52:00 +02:00
José Valim
2f549b8bbd Use initialize_copy! to proper initialize now on clone. 2011-04-19 22:38:51 +02:00
Florent Piteau
89ed9fbd19 Don't reuse a closed flash when using now 2011-04-20 04:32:26 +08:00
José Valim
22fcef90b1 Actually add an abstract class, so it is easier to get rid of old asset paths in the future. 2011-04-19 22:02:02 +02:00
Xavier Noria
e162e912c9 Merge branch 'master' of git://github.com/lifo/docrails
Conflicts:
	railties/guides/source/ajax_on_rails.textile
	railties/guides/source/generators.textile
2011-04-19 21:54:10 +02:00
José Valim
a19c260038 Include modules to the context in the railtie. 2011-04-19 21:49:28 +02:00
Xavier Noria
ad60286926 Revert "Better formatting"
No need to change this formatting.

This reverts commit 9c861e8a0e.
2011-04-19 21:43:17 +02:00
José Valim
914218ef30 Let's use inheritance here, shall we? 2011-04-19 21:32:58 +02:00
Xavier Noria
5fee98adf8 remove unwanted Example headers as per the guidelines, s/instaces of NilClass/nil/ and friends, completes some rdocs 2011-04-19 21:15:15 +02:00
Xavier Noria
eaf0d1a491 commit copy-edit: simplifies blank? rdoc and revises formatting 2011-04-19 21:00:16 +02:00
Xavier Noria
571b4a2a91 Revert "Formated docs"
Reason: "To be blank" and "to be empty" belongs to our everyday
terminology, they go in regular font.

This reverts commit 280a870992.
2011-04-19 21:00:15 +02:00
Xavier Noria
3265516c50 brings a #:nodoc: back 2011-04-19 21:00:15 +02:00
Florent Piteau
a1639ad752 Undocumented :openssl_verify_mode option for smtp_settings 2011-04-19 20:44:20 +02:00
David Heinemeier Hansson
c96bf840ad Add app/assets/images and include the rails.png as a sample there 2011-04-19 20:38:38 +02:00
David Heinemeier Hansson
9aac54c4bf Add note about the option to add other precompile targets 2011-04-19 20:35:53 +02:00
David Heinemeier Hansson
e6850136d6 Set a default precompile target to be the application.js, application.css, and all non-css/js files (images etc) 2011-04-19 20:33:56 +02:00
David Heinemeier Hansson
1e56c89559 Give assets access to asset_path during precompilation 2011-04-19 20:06:09 +02:00
David Heinemeier Hansson
626bcc9bf4 Switch to asset_path and make it available in the Sprockets::Context (now you can do asset_path("logo.png") in a stylesheet.css.erb file and get fingerprinting) 2011-04-19 19:05:07 +02:00
David Heinemeier Hansson
d35c91225e Cleanup compute_sprockets_path -- when you are reaching for code comments, the method could be simpler 2011-04-19 18:30:44 +02:00
Xavier Noria
9b423ac0b7 let this regexp be stricter
The purpose of this regexp is to detect strings that
are valid identifiers to be used as method names.
The anchor $ allows a trailing newline, and both ^
and $ may be bypassed because Ruby regexps are
multiline always. The anchors \A and \z are the
proper ones to ensure string boundaries.
2011-04-19 18:16:38 +02:00
David Heinemeier Hansson
a3a5c7eba3 All assets, including images, audio, and video, now uses the asset pipeline when its on 2011-04-19 18:07:42 +02:00
José Valim
dca31b9224 Let's not dup because value may not always be duplicable. 2011-04-19 18:06:01 +02:00
José Valim
30472d4244 Avoid define_method if possible. 2011-04-19 17:58:06 +02:00
Joshua Peek
d24d938af4 Merge branch 'joshk-multi_json' 2011-04-19 09:43:47 -05:00
Joshua Peek
011afb70e5 Merge branch 'multi_json' of https://github.com/joshk/rails into joshk-multi_json 2011-04-19 09:42:11 -05:00
Josh Kalderimis
b24621809e remove MultiJson from the Gemfile and instead add the current rc to the AS gemspec 2011-04-19 16:34:34 +02:00
José Valim
069e9b004f Do not stream on HTTP/1.0. 2011-04-19 15:04:28 +02:00
José Valim
b398520c14 Output a redirect to the 500 page if something happens when streaming.
Currently, we output:

  "><script type="text/javascript">window.location = "/500.html"</script></html>
2011-04-19 12:26:11 +02:00
José Valim
a66c917235 Do not inherit from Rack::Response, remove a shit-ton of unused code. 2011-04-19 11:54:12 +02:00
Paco Guzman
66a2ffcdb7 Update link to Rails 2.3 guides from 2.3.8 to last release 2.3.11. Maybe someone could regenerate the guides 2011-04-19 11:24:09 +02:00
José Valim
6380f1a9f4 Be sure to not store the closed flash in the session. 2011-04-19 10:34:17 +02:00
Sebastian Martinez
082e299e97 docs for ActionMailer::Base.default_i18n_subject 2011-04-18 23:37:27 -03:00
Jon Leighton
3bff8bdb2a Merge branch 'master' of github.com:rails/rails 2011-04-18 23:35:28 +01:00
Jon Leighton
019cd51a3f Bring back support for passing a callable object to the default_scope macro. You can also just use a block. 2011-04-18 23:35:22 +01:00
Jon Leighton
6f84c73dc4 Un-deprecate using 'default_scope' as a macro, but if you are calling the macro multiple times that will give deprecation warnings, and in 3.2 we will simply overwrite the default scope when you call the macro multiple times. 2011-04-18 23:15:38 +01:00
Josh Kalderimis
e5919536a6 Merge branch 'master' of https://github.com/rails/rails into multi_json 2011-04-19 00:14:50 +02:00
Josh Kalderimis
1d8be7bc6f AS Json parse_error makes a return for backwards compatibility, although it will return MultiJson::DecodeError 2011-04-19 00:01:50 +02:00
Aaron Patterson
64e2a549cf adding a rake task to help generate changelog notes for release announcements 2011-04-18 14:44:12 -07:00
Josh Kalderimis
e019587e31 removed AS backends and instead rely on MultiJson for json decoding 2011-04-18 21:39:15 +02:00
David Heinemeier Hansson
0acc6bd6cb Use proper coffee comments 2011-04-18 21:07:04 +02:00
Arun Agrawal
92537b8c27 File should be open in read/write mode. When doing lock on a file. 2011-04-18 09:08:53 -07:00
Sebastian Martinez
280a870992 Formated docs 2011-04-18 10:02:55 -03:00
Sebastian Martinez
51f5209dc1 oops fixed typo 2011-04-18 09:34:51 -03:00
Sebastian Martinez
af41d5540b Fixed docs for NilClass#try 2011-04-18 09:33:00 -03:00
José Valim
3b0f917b1d Test explicit skip. 2011-04-18 14:27:49 +02:00
José Valim
07fde1a3d3 Just define the controller if fibers are defined. 2011-04-18 14:27:49 +02:00
David Heinemeier Hansson
3e33592316 Add description to assets:precompile such that it shows up in rake -T 2011-04-18 11:18:37 +02:00
David Heinemeier Hansson
39372964d2 Add String#inquiry as a convenience method for turning a string into a StringInquirer object [DHH] 2011-04-18 10:57:38 +02:00
José Valim
389d15ef13 Body... wanna *stream* my body? Body... such a thrill my body!
Added stream as class level method to make it explicit when to stream.
Render also accepts :stream as option.
2011-04-18 08:55:41 +02:00
José Valim
7a152ab012 Rename it to DataStreaming. 2011-04-18 08:17:47 +02:00
José Valim
944b4d5796 Add missing dependency. 2011-04-18 08:13:28 +02:00
José Valim
4f044528c0 Slightly reorganize rendering stack. 2011-04-18 08:12:51 +02:00
Malcolm Locke
9556e9c923 best-of-bread -> best-of-breed 2011-04-18 16:02:30 +12:00
Sebastian Martinez
9dfc215327 Formatting docs 2011-04-17 20:40:33 -03:00
Sebastian Martinez
49e7555a5e Docs for +duplicable?+ 2011-04-17 20:38:50 -03:00
Sebastian Martinez
bb626e785a Docs for NilClass#try 2011-04-17 20:22:53 -03:00
Sebastian Martinez
0675047d79 Formatting examples 2011-04-17 20:12:39 -03:00
Sebastian Martinez
d0635b6ad4 Documented String#blank? 2011-04-17 19:47:46 -03:00
Sebastian Martinez
b14b058be8 Documented Hash#blank? 2011-04-17 19:44:34 -03:00
Sebastian Martinez
ceeed213a9 Documented Array#blank? 2011-04-17 19:42:53 -03:00
Sebastian Martinez
c497999230 Documented TrueClass#blank? 2011-04-17 19:39:40 -03:00
Sebastian Martinez
a48d2a7a07 Documented FalseClass#blank? 2011-04-17 19:38:32 -03:00
Sebastian Martinez
bd302542d0 Documented NilClass#blank? 2011-04-17 19:36:56 -03:00
Jon Leighton
b839d40933 Fix test_load_save in test/cases/binary_test.rb (thanks @tenderlove for actually working out how to fix it) 2011-04-17 22:30:27 +01:00
Jon Leighton
2a5e317951 Fix test_associate_existing in has_many_through_associations_test on mysql and postgresql 2011-04-17 21:58:47 +01:00
José Valim
daf7a8c0db What a lovely surprise, controller_generator_test was also failing. 2011-04-17 22:10:08 +02:00
José Valim
60547391c9 Fix more generator tests. 2011-04-17 22:08:21 +02:00
Jon Leighton
28146378d3 Bring back some bits of documentation for scopes which were removed as part of the reversion in 256b363 2011-04-17 20:55:24 +01:00
Jon Leighton
256b363eee Revert "Deprecate defining scopes with a callable (lambda, proc, etc) via the scope class method. Just define a class method yourself instead."
This reverts commit f0e198bfa1.

Conflicts:

	activerecord/test/models/post.rb
2011-04-17 20:47:52 +01:00
Arun Agrawal
d1f10e74ca Test failing with Jruby "uninitialized constant TestJSONEncoding::JSON"
activesupport/test/json/encoding_test.rb need Json to pass against with Jruby
2011-04-17 12:00:55 -07:00
Aaron Patterson
da80d87f4d Merge branch 'identity_map' of https://github.com/jasoncodes/rails into jasoncodes-identity_map
* 'identity_map' of https://github.com/jasoncodes/rails:
  Bypass IdentityMap in PostgreSQL geometric tests.
2011-04-17 11:49:52 -07:00
Aaron Patterson
3dc4d543f1 make our constructor signature match the superclass 2011-04-17 11:49:25 -07:00
Gonçalo Silva
1c2b2233c3 Merge branch 'master' of https://github.com/rails/rails into performance_test 2011-04-17 17:08:49 +01:00
Sebastian Martinez
38e77879e0 Remove 2.3 since guides are supposed to be for Rails 3 2011-04-17 13:06:48 -03:00
Jason Weathered
0fd0d68962 Bypass IdentityMap in PostgreSQL geometric tests.
The identity map cache prevents us from seeing the DB formatted strings.
2011-04-17 23:51:20 +10:00
Jason Weathered
96546bb63b Fix marshal round-tripping of fractional seconds (Time#subsec). 2011-04-17 21:10:02 +10:00
José Valim
b6843f22ac Lazily load sprockets. 2011-04-17 11:50:19 +02:00
José Valim
a9a2035722 Fix assets generators. 2011-04-17 11:48:15 +02:00
José Valim
3a68aec1a1 Make generators more modular, add hooks and improve test suite. 2011-04-17 11:44:52 +02:00
José Valim
8f75c3abcd Move app initializers to sprockets railtie. 2011-04-17 10:51:07 +02:00
José Valim
16b9547a88 Move controller configs to sprockets own railtie. 2011-04-17 10:26:32 +02:00
José Valim
eb75f15a1a Generate app/* stubs directories for full plugins to show ththat it is possible to extend them. 2011-04-17 10:23:07 +02:00
Sebastian Martinez
8606fff6f1 Added CHANGELOG entry for new section additions on ActionView guide 2011-04-16 20:09:54 -03:00
Sebastian Martinez
9c861e8a0e Better formatting 2011-04-16 18:29:55 -03:00
Sebastian Martinez
558f096115 Added Templates section on ActionView guide. 2011-04-16 18:26:44 -03:00
Michal Papis
29caa46c40 Merge branch 'master' of github.com:lifo/docrails 2011-04-16 22:57:29 +02:00
Michal Papis
8c68bcf829 Added information about grouping conditional validations 2011-04-16 22:56:58 +02:00
Sebastian Martinez
143ed7edc3 Added Spacer Templates on Partials section of ActionView guide. 2011-04-16 17:32:04 -03:00
Sebastian Martinez
eecb8385b4 Added Partials section to ActionView guide. 2011-04-16 17:14:46 -03:00
Sebastian Martinez
7c9927a409 Added Using Action View with Rails guide section. 2011-04-16 16:02:05 -03:00
Piotr Sarnacki
5952d4f860 Fix plugin new generator to work with new javascript/stylesheets conventions 2011-04-16 19:59:21 +02:00
Mikel Lindsaar
1a1e4d484a Updating mail to 2.2.16 2011-04-16 23:30:21 +10:00
José Valim
0114dc38d5 Fix CI test on 1.8 2011-04-16 12:25:21 +02:00
José Valim
2bf0d9b06a Class docs. 2011-04-16 12:13:29 +02:00
José Valim
eec5d5db5d Docs. 2011-04-16 11:42:02 +02:00
José Valim
ab105e6072 content_for should work with provide. 2011-04-16 11:34:07 +02:00
José Valim
3e0aedba90 Add more tests, ensure we never yield outside the fiber context and that we swap buffers when moving from parent to child. 2011-04-16 11:22:36 +02:00
José Valim
29078ff8f1 Basic tests for streaming. Basic tests for provide. 2011-04-16 10:50:33 +02:00
José Valim
62668cccb9 The magic medicine worked. 2011-04-16 10:31:55 +02:00
José Valim
e30ca001ef Yo dawg, I heard you like streaming. So I put a fiber, inside a block, inside a body, so you can stream. 2011-04-16 10:28:47 +02:00
Matt Duncan
50b2eb8cbd Fixing another example result 2011-04-15 22:09:23 -04:00
Matt Duncan
1229904602 Removing incorrect example results 2011-04-15 21:56:01 -04:00
Matt Duncan
b6bfcc9115 Fix syntax error in example 2011-04-15 21:50:29 -04:00
Matt Duncan
f274394afb Fixing more spacing inconsistencies 2011-04-15 21:34:49 -04:00
Matt Duncan
e8afe4e1ea Making spacing consistent 2011-04-15 20:30:51 -04:00
Matt Duncan
004042c0d9 Fixing missing colon on symbol in example 2011-04-15 20:27:05 -04:00
Matt Duncan
7f98b544e3 Negative format example should use a negative number 2011-04-15 20:18:30 -04:00
José Valim
2dd43c3f80 Buffer should be an option passed down to template rendering. 2011-04-16 02:10:36 +02:00
Matt Duncan
6ddd4a3d95 Days are never approximated using 'about' 2011-04-15 20:08:11 -04:00
Matt Duncan
8ac365f476 Making example result match actual result 2011-04-15 20:03:52 -04:00
Matt Duncan
3ca6d0e8fe Including actual usage in example 2011-04-15 19:56:48 -04:00
José Valim
fad214b9e1 Initial work on fibered layout. 2011-04-16 01:10:13 +02:00
Aaron Patterson
c630750fa5 switch to using comments to comment things 2011-04-15 14:13:46 -07:00
José Valim
2c54fde54d Fix generator tests. 2011-04-15 22:01:06 +02:00
José Valim
9982b5af94 Fix missing test_helper. 2011-04-15 21:32:36 +02:00
José Valim
d6bd606bdd render :once, YAGNI. 2011-04-15 21:11:54 +02:00
José Valim
d5ad92ced1 Make static faster as we don't have to serve multiple paths anymore. 2011-04-15 20:09:39 +02:00
José Valim
afc828828f Remove the ability for engines to serve assets from the public directory. 2011-04-15 19:57:52 +02:00
José Valim
d84b2f37d0 Fix tests. 2011-04-15 19:17:58 +02:00
Sebastian Martinez
91761b775c Added an example of exception situation on Array#sample docs 2011-04-15 14:13:10 -03:00
Sebastian Martinez
4dd84c8db0 Improved Array#sample documentation 2011-04-15 14:08:37 -03:00
José Valim
2fe70c1803 Booya, sprockets now works from Engines. 2011-04-15 18:43:22 +02:00
José Valim
8e5ff7d0a7 Add some very simple docs. 2011-04-15 18:43:21 +02:00
José Valim
ae13cb1523 Remove rescue as it was clobbering the real error. 2011-04-15 18:43:21 +02:00
Jon Leighton
7dea4b57a4 Merge branch 'master' of github.com:rails/rails 2011-04-15 13:30:21 +01:00
Jon Leighton
65469a6e5e Return nil from read_attribute(:foo) if 'foo' is not present in the @attributes hash, but the _foo method has been defined. This brings the behaviour into line with the 3-0-stable branch and the master branch before 93641ed6c8 (there were previously no assertions about this which is why the change slipped through). Note that actually calling the 'foo' method will still raise an error if the attribute is not present. 2011-04-15 13:27:08 +01:00
Jon Leighton
e01dfb27fc Undo performances regressions I introduced in bbe0a507f2 and add test for an edge case. Add comments to explain the intent of the code. 2011-04-15 13:09:12 +01:00
José Valim
dd90f3923c attribute should be attributes 2011-04-14 23:40:56 -07:00
José Valim
c8c012caa8 Edited actionpack/lib/action_view/helpers/form_helper.rb via GitHub 2011-04-14 23:37:35 -07:00
Joshua Ballanco
2adeaa9c90 Fix for stripping tags from frozen strings.
This returns behavior under Ruby 1.9 to match Ruby 1.8.
2011-04-14 23:25:18 -04:00
Joshua Ballanco
c09538941f Test for stripping tags from a frozen string.
This test will pass under Ruby 1.8 but fail under Ruby 1.9 because of
the change in behavior of gsub! w.r.t. frozen strings that do not
match the pattern used [ruby-core:23664].
2011-04-14 23:18:12 -04:00
Emilio Tagua
434d75705f Fix console to accept [environment] [options] as specified in docs. 2011-04-14 23:05:08 -03:00
Jon Leighton
e68a83c9ec Refactor test to avoid hackery 2011-04-15 02:19:11 +01:00
Jon Leighton
bbe0a507f2 Remove unnecessary code from define_read_method and add assertion to make sure the underscored version is actually generated 2011-04-15 01:44:27 +01:00
Sebastian Martinez
ba8a71588d Added more detailed use of the +list+ command on debugging guide 2011-04-14 21:26:20 -03:00
Sebastian Martinez
bbfc6cda82 Remove extra whitespaces from guides 2011-04-14 20:37:12 -03:00
David Heinemeier Hansson
3d44e45758 Use JS comments, please 2011-04-15 01:33:03 +02:00
Aaron Patterson
3e23752236 bcrypt will encrypt anything, so validate_presence_of would not catch nil / blank passwords. Thank you to Aleksander Kamil Modzelewski for reporting this 2011-04-14 14:54:25 -07:00
Aaron Patterson
9951af0289 sort insert columns for better cache hits 2011-04-14 14:26:57 -07:00
Aaron Patterson
199c0bb338 generated session ids should be encoded as UTF-8 2011-04-14 13:37:40 -07:00
Aaron Patterson
12ae92216b refactoring inserts to use the same method on the connection 2011-04-14 13:37:40 -07:00
Aaron Patterson
0268eac963 mimic prepared statements in the exec_insert for mysql2 2011-04-14 13:37:40 -07:00
Aaron Patterson
a22ceaeefa mysql type cast should return integers when typecasting true / false 2011-04-14 13:37:39 -07:00
Aaron Patterson
a0d4c8d1bf using the database adapter to typecast before executing prepared statement 2011-04-14 13:37:39 -07:00
Aaron Patterson
27f8c57f5f inserting big decimals as strings works consistently among dbs, so use string form 2011-04-14 13:37:39 -07:00
Aaron Patterson
8571facea3 insert statements are prepared, but values are not escaped properly 2011-04-14 13:37:39 -07:00
Aaron Patterson
4893170da2 adding a type cast method for prepared statements 2011-04-14 13:37:38 -07:00
Evan Petrie
53d3bafc8b ruby 1.9.2 and other ruby implementations may not return the same hash value for the same string each time. This can result in your static assets being served from different asset hosts, which makes browser caching less effective. Use md5 or some other digest method instead. 2011-04-14 12:08:18 -07:00
Jon Leighton
6b6ecbefad Extract the constraint-building for joins in JoinAssociation into a separate method to make it easy to change/override (requested by Ernie Miller so that MetaWhere can add to it easily) 2011-04-14 19:34:19 +01:00
Sebastian Martinez
5be72684f6 Update guide mentioning that +in?+ may raise an +ArgumentError+ exception 2011-04-14 13:45:00 -03:00
Jared McFarland
cd233dd87e Only rescue a thrown NoMethodError, don't preemptively check for #include?; added tests 2011-04-15 00:36:07 +08:00
Jared McFarland
2db9f8a41c added an exception to Object#in? to match the methods documentation 2011-04-15 00:36:05 +08:00
Prem Sichanugrist
89884c194a Update scaffold controller to generate scss file if Sass is available 2011-04-15 00:32:27 +08:00
Stian Grytøyr
93641ed6c8 Fixes performance issue introduced in 3.0.6 (issue #6695) 2011-04-14 08:56:02 -07:00
Philipp Kempgen (Amooma)
328a16b31e for escaping HTML can be treated as normal XML 2011-04-14 07:55:10 -07:00
Philipp Kempgen (Amooma)
9257106b09 properly escape "'" to "&apos;" for XML/HTML (BTW Erubis does that as well) 2011-04-14 07:51:14 -07:00
Sebastian Martinez
28bf4c67ca Move [#ticket_number state:commited] to the end of the commit message 2011-04-14 10:59:48 -03:00
Sebastian Martinez
fb6fa1e425 change to use the Sass file extension .scss
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-04-14 10:14:57 -03:00
Sebastian Martinez
1bcc7055d8 Remove extra whitespace 2011-04-14 10:05:08 -03:00
Sebastian Martinez
9aff7e0898 Update guides with controller generator producing asset stubs 2011-04-14 10:04:10 -03:00
Sebastian Martinez
02883a1090 Update Contributing to the Rails Code guide for automatically change the status of LH tickets 2011-04-14 09:36:22 -03:00
David Heinemeier Hansson
6c91b699bf The controller and resource generators will now automatically produce asset stubs (this can be turned off with --skip-assets). These stubs will use Coffee and Sass, if those libraries are available. [DHH] 2011-04-14 12:23:21 +02:00
Andre Arko
bd032fe97e files are a special case and need whitespace to be significant 2011-04-14 17:08:57 +08:00
Andre Arko
d01be122b8 gsub is not needed (thanks @fxn!) 2011-04-14 16:58:52 +08:00
David Heinemeier Hansson
90246acb6d Bring back tmp/cache for the default local cache to work 2011-04-14 10:57:14 +02:00
Brian Cardarella
a8365ab9ad Declaring the attr_accessor for password_confirmation is not necessary
as the confirmation validation already adds that attr_accessor
2011-04-14 16:43:51 +08:00
Andre Arko
7660e7cb4d attributes no longer disappear if a tag contains whitespace
old:
Hash.from_xml("<tag foo='bar'>\n</tag>")
=> {"tag"=>"\n"}

new:
Hash.from_xml("<tag foo='bar'>\n</tag>")
=> {"tag"=>{"foo"=>"bar", "__content__"=>"\n"}
2011-04-14 16:33:41 +08:00
Eric Hayes
ada550d908 Fixed a comment typo 2011-04-14 16:29:06 +08:00
Sebastian Martinez
beed866e43 Fix patch file name to make it consistent with the rest of the guide 2011-04-13 23:38:05 -03:00
Ben Orenstein
4db4f8c624 Add tests for InheritableOptions.
[#6625 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-04-13 23:30:58 -03:00
Matt Duncan
2f24265237 Making colon usage consistent 2011-04-13 20:58:26 -04:00
Matt Duncan
974a6aa176 Remove trailing whitespace 2011-04-13 20:49:14 -04:00
Matt Duncan
e56b19bbed Aligning table cells 2011-04-13 20:32:36 -04:00
Matt Duncan
1447ff5654 Making identifiers consistent in example 2011-04-13 20:17:22 -04:00
Sebastian Martinez
f8ecb46e82 Documented +ActiveSupport::Notifications+ module. 2011-04-13 19:54:31 -03:00
David Heinemeier Hansson
443af58995 Its assets.enabled, not assets.enable 2011-04-14 00:45:25 +02:00
Matt Duncan
04a75e0289 Moving note out of prologue to match other guides and so it'll display correctly 2011-04-13 17:19:47 -04:00
David Chelimsky
a26d407f63 ActionView::PathSet# accepts String or Array
- Closes #6692

Signed-off-by: José Valim <jose.valim@gmail.com>
2011-04-13 21:45:51 +02:00
David Heinemeier Hansson
bd3b2241a4 Cleanup the Gemfile and compute whats needed depending on whether we are on 1.8 or 1.9 2011-04-13 21:32:41 +02:00
Sebastian Martinez
21c03a2f48 Update guides with new scaffold.css path 2011-04-13 15:42:44 -03:00
Aaron Patterson
1f4dae9daa do not depend on to_yaml being called, but rather depend on YAML being dumped 2011-04-13 11:41:42 -07:00
Prem Sichanugrist
0f8a6ebba3 Fix missing requires in Action Mailer
This made the isolated test failed on CI server.

Signed-off-by: Xavier Noria <fxn@hashref.com>
2011-04-13 19:52:19 +02:00
Aaron Patterson
eebb19c954 use index based substitution for bind parameters 2011-04-13 09:42:51 -07:00
David Heinemeier Hansson
48fb6b3380 Generate scaffold.css to app/assets/stylesheets (next step, SCSSify it if SCSS is available) 2011-04-13 18:21:52 +02:00
David Heinemeier Hansson
023d4f9fc1 Includes have to be in the first comment 2011-04-13 18:09:04 +02:00
David Heinemeier Hansson
e7280cb1bd Use driver_ujs now that we no longer have to depend on a shared name and insert all prototype dependencies if thats specified 2011-04-13 18:08:40 +02:00
David Heinemeier Hansson
17c1b0f0d3 Use driver_ujs now that we no longer have to depend on a shared name and insert all prototype dependencies if thats specified 2011-04-13 18:08:02 +02:00
David Heinemeier Hansson
26528efb54 Blah, assets cant be turned on from initializers either 2011-04-13 18:02:49 +02:00
David Heinemeier Hansson
4eb3ee4818 Cleanup comments 2011-04-13 17:54:11 +02:00
David Heinemeier Hansson
5b49867a75 Not needed 2011-04-13 17:51:46 +02:00
David Heinemeier Hansson
65ffcecc6a Require asset pipeline targets by default 2011-04-13 17:50:55 +02:00
David Heinemeier Hansson
7e3b374312 Require everything by default 2011-04-13 17:50:37 +02:00
David Heinemeier Hansson
f3f28ee493 Dont need to make application.js into coffee since it will mostly be a manifest file anyway 2011-04-13 17:37:48 +02:00
David Heinemeier Hansson
cf5599d9fa Move json requirement to user Gemfile -- still need to do better than this, though 2011-04-13 17:31:32 +02:00
David Heinemeier Hansson
1652c55651 Use Sass from git until the final gem is out 2011-04-13 17:30:08 +02:00
David Heinemeier Hansson
e3273f5cce Move the asset template engines to the user-generated Gemfile 2011-04-13 17:14:14 +02:00
Joshua Peek
23aa7dacb5 Generate CoffeeScript stub by default 2011-04-13 10:03:47 -05:00
Joshua Peek
9f09aeb827 Include CoffeeScript in Gemfile 2011-04-13 09:57:22 -05:00
Joshua Peek
9333ca74b3 Add default require directives for jquery 2011-04-13 09:47:29 -05:00
David Heinemeier Hansson
5e7e81ab1a Blah, identity_map has to be setup in application.rb to work 2011-04-13 16:42:59 +02:00
David Heinemeier Hansson
6fa7c3e036 Fix triplets 2011-04-13 16:26:22 +02:00
David Heinemeier Hansson
6d5e86eb6b Clean up the generator, switch to assets usage, use vendor/assets for the default scripts, and more 2011-04-13 16:19:46 +02:00
Sebastian Martinez
b2cb991251 Removed Object#among? from guides 2011-04-13 09:59:01 -03:00
David Heinemeier Hansson
101406d743 Move to app/assets in anticipation of image support being added as well. Also add vendor/assets to default load path 2011-04-13 14:31:09 +02:00
David Heinemeier Hansson
ab1f91394f Until the latest sprockets gem is released, we need new apps to reference it directly 2011-04-13 14:31:09 +02:00
Prem Sichanugrist
733bfa63f5 Remove #among? from Active Support
After a long list of discussion about the performance problem from using varargs and the reason that we can't find a great pair for it, it would be best to remove support for it for now.

It will come back if we can find a good pair for it. For now, Bon Voyage, `#among?`.
2011-04-13 20:25:28 +08:00
Xavier Noria
1f869114f5 updates AP CHANGELOG 2011-04-13 13:41:26 +02:00
Xavier Noria
66e43aa1a8 updates railties CHANGELOG 2011-04-13 13:40:43 +02:00
Xavier Noria
acdbc6ae41 renames response_from_page_or_rjs -> response_from_page, and extracts the RJS in it 2011-04-13 13:24:33 +02:00
Xavier Noria
86d6cdd7f7 fixes the name of a test 2011-04-13 13:24:33 +02:00
Xavier Noria
06ae5769e1 removes some remaining .rjs occurrences 2011-04-13 13:24:33 +02:00
Xavier Noria
d76fbff8b4 removes reference to RJS from AC::RecordIdentifier docs 2011-04-13 13:24:32 +02:00
Xavier Noria
404ae77c40 removes a remaining reference to .rjs in template resolver's RDoc 2011-04-13 13:24:32 +02:00
Xavier Noria
16bccca361 removed references to RJS from the AP README 2011-04-13 13:24:32 +02:00
Xavier Noria
e06771f9d4 removes RJS documentation from AV::Base 2011-04-13 13:24:32 +02:00
Xavier Noria
6cf1fc5cda removes mentions to RJS in the security guide 2011-04-13 13:24:32 +02:00
Xavier Noria
d8f23ca627 removes debug_rjs from ActionView::Base 2011-04-13 13:24:32 +02:00
Xavier Noria
7c9d91f53e removes render :update from views 2011-04-13 13:24:32 +02:00
Xavier Noria
90de26703e removes ActionView::Helpers::PrototypeHelper 2011-04-13 13:24:32 +02:00
Xavier Noria
06bdaae071 removes ActionView::Helpers::ScriptaculousHelper 2011-04-13 13:24:31 +02:00
Xavier Noria
5850f16935 removes the RJS template handler 2011-04-13 13:23:18 +02:00
Xavier Noria
eea66892c8 removes support for render :update 2011-04-13 13:23:17 +02:00
Xavier Noria
25181cafee let the default function in button_to_function be nil
I don't know which is the use case for button_to_function(name)
but there's a test for it. I am focused now on RJS extraction
and do not want to introduce a backwards incompatible change
at this moment. Perhaps worth revisiting when the whole thing
is done.
2011-04-13 13:23:16 +02:00
Xavier Noria
f9472f064f applies API guidelines to example 2011-04-13 13:23:16 +02:00
Xavier Noria
3223e04a21 removes support for RJS in button_to_function 2011-04-13 13:23:16 +02:00
Xavier Noria
b878757c50 removes assert_select_rjs 2011-04-13 13:23:16 +02:00
Xavier Noria
8449da929e removes support for RJS in link_to_function 2011-04-13 13:23:16 +02:00
Xavier Noria
096fa1b60f jQuery is the new default 2011-04-13 13:23:16 +02:00
Matt Duncan
805126b20a Aligning comments 2011-04-13 16:14:53 +08:00
Matt Duncan
93def19063 Fixing distance_of_time_in_words range near 2 days 2011-04-13 16:14:52 +08:00
Joshua Peek
f004c88681 Merge branch 'sprockets' 2011-04-12 22:35:24 -05:00
Aaron Patterson
1b5b53da5e common @jonleighton 💣 2011-04-12 20:29:35 -07:00
Joshua Peek
a4518517f7 Index sprockets environment if perform caching is enabled 2011-04-12 22:12:27 -05:00
Joshua Peek
ed24595647 Merge branch 'master' into sprockets 2011-04-12 21:56:00 -05:00
Jon Leighton
f0e198bfa1 Deprecate defining scopes with a callable (lambda, proc, etc) via the scope class method. Just define a class method yourself instead. 2011-04-12 19:46:05 -07:00
Jon Leighton
788bd30859 ActiveRecord::Base.scopes hash is not needed 2011-04-12 19:46:04 -07:00
Jon Leighton
8572ae6671 Evaluate default scopes at the last possible moment in order to avoid problems with default scopes getting included into other scopes and then being unable to remove the default part via unscoped. 2011-04-12 19:46:04 -07:00
Jon Leighton
5740d4ec0c Deprecated support for passing hashes and relations to default_scope, in favour of defining a 'default_scope' class method in the model. See the CHANGELOG for more details. 2011-04-12 19:46:04 -07:00
Jon Leighton
fc9a04b6a6 Removing the scope-caching which happens on association proxies, because the query is already cached by the query cacher. For formalised proof see http://www.youtube.com/watch?v=wDefXLb-FDs 2011-04-12 19:46:04 -07:00
Sebastian Martinez
a616e7a88c Update test name to the corresponding method name
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-04-12 21:04:00 -03:00
Sebastian Martinez
dbf32eb6ca Changed Object#either? to Object#among? on guides 2011-04-12 18:58:41 -03:00
Xavier Noria
3366479a9a Merge branch 'master' of git://github.com/lifo/docrails 2011-04-12 22:45:33 +02:00
4e873ffcda Corrected dbconsole usage message. 2011-04-12 00:59:55 -07:00
Sebastian Martinez
40d156955c Update guides reflecting that scaffold_controller generator generates now code for JSON response instead of XML 2011-04-11 22:43:27 -03:00
Sebastian Martinez
7a1189a2c7 Updated AS guide with new Object#in? and Object#either? methods 2011-04-11 20:09:22 -03:00
Aaron Patterson
b53ffb35e0 stop using deprecated methods in arel 2011-04-11 15:50:05 -07:00
Xavier Noria
3f283c2dd5 Revert "Edited railties/guides/source/active_support_core_extensions.textile via GitHub"
Reason: The original sentence is correct. Please note the guide
covers the stable version of Active Support.

This reverts commit 5265650d51.
2011-04-12 00:37:02 +02:00
David Heinemeier Hansson
d1575ae1b9 Change Object#either? to Object#among? -- thanks to @jamesarosen for the suggestion! 2011-04-12 00:23:07 +02:00
Aaron Patterson
5918b868b2 remove so many nested if statements 2011-04-11 15:19:10 -07:00
Aaron Patterson
622f23b604 wrap the pg_get_serial_sequence function and reuse it for the default sequence name 2011-04-11 14:38:42 -07:00
Oge Nnadi
5265650d51 Edited railties/guides/source/active_support_core_extensions.textile via GitHub 2011-04-11 14:26:23 -07:00
Aaron Patterson
75dc9fbac7 cache table exists queries in prepared statement cache 2011-04-11 14:12:31 -07:00
Aaron Patterson
f6c0c8ff61 only use the primary_key method, refactor schema and table name parsing 2011-04-11 14:08:27 -07:00
Aaron Patterson
a9e8554b46 use prepared statements for primary key queries 2011-04-11 13:57:00 -07:00
Aaron Patterson
5df072d64b last insert id can never be called, so remove that code path 2011-04-11 13:10:20 -07:00
Oge Nnadi
d5634b2287 Added missing </tt> 2011-04-11 13:08:58 -07:00
Oge Nnadi
d3dce774ef Edited README.rdoc via GitHub 2011-04-11 12:57:52 -07:00
Oge Nnadi
a43abfafd2 Rewording 2011-04-11 12:54:46 -07:00
Aaron Patterson
9ba94c8fc4 we know the table and pk, so we can calculate a default sequence name 2011-04-11 10:54:08 -07:00
Aaron Patterson
cbb65de1a6 always look up pk and sequence unless both are provided 2011-04-11 10:37:23 -07:00
Aaron Patterson
302b6f3f73 pg does not know the insert_id in advance, so super will never return true 2011-04-11 10:31:13 -07:00
Aaron Patterson
4c30304e15 updating the docco for ActiveRecord::Result 2011-04-11 10:10:01 -07:00
Aaron Patterson
269cd1b3c5 implement exec_query on mysql2 adapter 2011-04-11 10:10:01 -07:00
Aaron Patterson
8a11799a47 make sqlite insert_sql more consistent with other adapters 2011-04-11 10:10:01 -07:00
Aaron Patterson
58259bbf29 adding exec_insert for postgresql 2011-04-11 10:10:01 -07:00
Aaron Patterson
b1ba04b32b fixing variable name in mysql test 2011-04-11 10:10:01 -07:00
Aaron Patterson
90a371496a properly name schema queries for the logger 2011-04-11 10:10:01 -07:00
Aaron Patterson
3d96e6217b adding mysql adapter test case 2011-04-11 10:10:00 -07:00
Aaron Patterson
0845b5062d adding client_encoding method for discovering the encoding set for this client, testing exec_insert on a string 2011-04-11 10:10:00 -07:00
Aaron Patterson
f9d3f01866 properly name schema queries for logging 2011-04-11 10:10:00 -07:00
Aaron Patterson
32dbf00d99 adding exec_insert to sqlite3 2011-04-11 10:10:00 -07:00
Aaron Patterson
c4fc396300 adding a case_sensitive_modifier for forcing comparisons to be case sensitive 2011-04-11 10:02:39 -07:00
Aaron Patterson
35b2715456 only support pg >= 8.2, so no need to check 2011-04-11 09:08:45 -07:00
José Valim
7379114c2f Remove code duplication. 2011-04-11 18:01:10 +02:00
José Valim
df5691aa94 No need to rescue here. Invoking the wrong method in an object can happen anywhere if you are not careful. In other words, test your shit. 2011-04-11 17:47:59 +02:00
José Valim
5bf3d46bec Revert "Add :use_include option to allow user to explicitly use Range#include? method in Ruby 1.9"
Use :with => range.to_a instead.

This reverts commit f6540211b5.
2011-04-11 17:41:33 +02:00
David Heinemeier Hansson
b93199b547 Keep the same API semantics for update/delete as we had for XML (just return 200 OK, no body) 2011-04-11 15:50:05 +02:00
David Heinemeier Hansson
1d8bf4f4f9 Cant use inclusion in commands/application.rb as the frameworks havent all been required yet 2011-04-11 15:25:39 +02:00
Aaron Patterson
1f3d3eb49d pg should define insert_sql so that query cache actually works for inserts 2011-04-10 22:45:14 -07:00
Prem Sichanugrist
d6edaeeaf8 Fix failing test case on master
It turned out that I overlook at some replacements ..
2011-04-10 22:40:21 -07:00
Aaron Patterson
743b6631df adding pg support notes to the changelog 2011-04-10 22:34:27 -07:00
Aaron Patterson
35dba50be9 community support for pg < 8.2 has ended, so we can drop support for those versions 2011-04-10 22:30:27 -07:00
Brian Cardarella
a30b440deb Refactored uniqueness validator to use Arel instead of hardcoded SQL 2011-04-10 21:28:12 -07:00
Prem Sichanugrist
a9f3c9da01 Using Object#in? and Object#either? in various places
There're a lot of places in Rails source code which make a lot of sense to switching to Object#in? or Object#either? instead of using [].include?.
2011-04-11 03:17:09 +08:00
Prem Sichanugrist, Brian Morearty, John Reitano
635d991683 Add support for Object#in? and Object#either? in Active Support [#6321 state:committed]
This will allow you to check if an object is included in another object
or the list of objects or not.

This patch is derived from patch by Brian Morearty and John Reitano on
Lighthouse ticket. I've rewrite it and make sure that we support both
'another object' and 'list of objects' version, as it surely be useful
to support both.
2011-04-11 03:17:08 +08:00
José Valim
62b2755f7a Remove dead branch code that appeared back in a merge. 2011-04-10 13:03:49 +02:00
Prem Sichanugrist
f6540211b5 Add :use_include option to allow user to explicitly use Range#include? method in Ruby 1.9
In Ruby 1.9 we're currently use `Range#cover?` to fix the performance problem. However, there might be the case that you want to use `Range#include?` instead. This patch will give you that option.
2011-04-10 18:49:28 +08:00
Prem Sichanugrist
58594be680 Add support for proc or lambda as an option for InclusionValidator, ExclusionValidator, and FormatValidator
You can now use a proc or lambda in :in option for InclusionValidator and ExclusionValidator, and :with, :without option for FormatValidator
2011-04-10 18:49:28 +08:00
Jo Liss
c59456a1d9 removed :nodoc: from ActionController::MimeResponds
So we don't miss out on the nice documentation of the respond_to and
respond_with instance methods.  Also added :nodoc: to protected method.
2011-04-10 11:47:22 +02:00
Prem Sichanugrist
22a3416298 Add --old-style-hash option to force creating old style hash on Ruby 1.9
That means if you don't like the new syntax, you can pass --old-style-hash to force Rails to generate code with hash rockets.
2011-04-10 16:47:52 +08:00
Prem Sichanugrist
74960c3976 Rails will now generate Ruby 1.9 style hash when running app generator on Ruby 1.9.x
The new hash syntax of Ruby 1.9 looks more superior, so we decide to switch to it in the places that appropriate.
2011-04-10 16:47:51 +08:00
Prem Sichanugrist
63cd92f9f3 Rails will now generate Ruby 1.9 style hash when running scaffold_controller generator on Ruby 1.9.x
The new hash syntax of Ruby 1.9 looks more superior, so we decide to switch to it in the places that appropriate.

This patch has been requested by DHH.
2011-04-10 16:47:50 +08:00
Prem Sichanugrist
c0efc4009a Make scaffold_controller generator generate code for JSON response instead of XML
It seems like a lot of people are using JSON in their API more than XML nowadays, so Rails should follow that convention by providing the JSON format block in scaffold_controller by default.

This patch has been requested by DHH
2011-04-10 16:47:49 +08:00
Aaron Patterson
508c679f11 moving sqlite_adapter_tests to sqlite3_adapter_test so that the tests are actually run. 💣 2011-04-08 11:22:21 -07:00
Aaron Patterson
bd79172e43 make turn a soft dependency. generate a Gemfile that contains turn and require turn if it is available 2011-04-08 09:40:33 -07:00
James Robinson
2cdc1f0cd5 Make csrf_meta_tags use the tag helper
Improved formatting of csrf_helper and improved test coverage
2011-04-08 02:21:08 +02:00
Aaron Patterson
a7c5d40d80 Merge branch 'master' of github.com:rails/rails
* 'master' of github.com:rails/rails:
  Cache flash now
  Revert "Use freeze instead of close!"
  Revert "Eagerly load Signed and Permanent cookies"
  cookies here
  Eagerly load Signed and Permanent cookies
  Use freeze instead of close!
2011-04-07 09:35:24 -07:00
Santiago Pastorino
0e624ce9eb Cache flash now 2011-04-07 09:27:00 -03:00
Santiago Pastorino
03d561ad77 Revert "Use freeze instead of close!"
This reverts commit 29592a7f09.
2011-04-07 09:26:04 -03:00
Santiago Pastorino
5b0149a17a Revert "Eagerly load Signed and Permanent cookies"
This reverts commit dffeda3770.
2011-04-07 09:20:56 -03:00
Santiago Pastorino
17205435f8 cookies here 2011-04-07 09:20:35 -03:00
Santiago Pastorino
dffeda3770 Eagerly load Signed and Permanent cookies 2011-04-07 09:15:28 -03:00
Aaron Patterson
1e90229e04 many args does not make sense with the current implementation because of how use works 2011-04-06 18:13:16 -07:00
Aaron Patterson
32f876786a getting the flash hash under test 2011-04-06 18:01:03 -07:00
Aaron Patterson
76c2ea7882 favor composition over inheritance, have FlashHash delegate to a Hash 2011-04-06 17:26:55 -07:00
Santiago Pastorino
29592a7f09 Use freeze instead of close! 2011-04-06 20:53:48 -03:00
Aaron Patterson
0ca69ca65f CookieJar should prefer composition over inheritance 2011-04-06 16:27:05 -07:00
Santiago Pastorino
9f765f4e09 Delete useless arguments 2011-04-06 19:18:41 -03:00
Santiago Pastorino
ed04243629 Delete useless env variable 2011-04-06 19:15:33 -03:00
Santiago Pastorino
0d45567362 Add tests to verify that signed and permanent cookies raises if someone tries
to modify the cookies when it was already streamed back to the client
or converted to HTTP headers
2011-04-06 19:12:35 -03:00
Santiago Pastorino
0e4748cd41 Make process reuse the env var passed as argument 2011-04-06 16:37:55 -03:00
Santiago Pastorino
0c5aded092 raise if someone tries to modify the cookies when it was already streamed back to the client or converted to HTTP headers 2011-04-06 15:47:58 -03:00
Santiago Pastorino
90ecad0bc9 Add ClosedError message to the initializer 2011-04-06 15:45:23 -03:00
Vijay Dev
e836fc1bd2 fix example query 2011-04-06 15:14:47 +05:30
Vijay Dev
c327ef4d65 Merge branch 'master' of github.com:lifo/docrails 2011-04-06 13:01:12 +05:30
Aaron Patterson
2e757bc298 do not return html safe strings from auto_link 2011-04-05 16:22:53 -07:00
Josh Kalderimis
e9020b4b5d added find_zone and find_zone! to AS timezones and changed the AS Railtie to use find_zone! as well as adding Railtie tests
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-04-05 17:12:09 -03:00
Marc-Andre Lafortune
1c4db4d7c3 Raise on invalid timezone
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-04-05 17:11:13 -03:00
Emilio Tagua
18dde7bf4f Disable IdentityMap in log tests, it's not important and when running tests rake task it logs more messages in the tested buffer.
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-04-05 22:08:00 +02:00
Josh Kalderimis
cb9e501a28 AM register_interceptor and register_observer only constantize if the argument is a String 2011-04-06 02:45:37 +08:00
John Firebaugh
d907f3cb5c Rename test directory to match code directory
Hopefully "serializeration" is not an in joke that I missed.
2011-04-06 01:50:35 +08:00
Santiago Pastorino
d7a5638dfb raise if someone tries to modify the flash when it was already streamed back to the client or converted to HTTP headers 2011-04-05 10:41:34 -03:00
Durran Jordan
a9b4b5da7c Destroying records via nested attributes works independent of reject_if:
- When a :_destroy truthiness is provided in the attributes hash, the
  record should get destroyed regardless of the result of the proc or
    method supplied to :reject_if. (If :allow_destroy is true)

[#6006 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-04-05 10:38:54 -03:00
Ryan Bigg
92e6255b58 Merge branch 'master' of github.com:lifo/docrails
* 'master' of github.com:lifo/docrails: (57 commits)
  Made the defaults section a little more readable and more to the point, giving a overview of the possibilities.
  Added information about default values
  added .'s to headings in the initialization textile page
  s/ERb/ERB/g (part II)
  s/ERb/ERB/g
  Bump up erubis to 2.7.0
  Implicit actions named not_implemented can be rendered
  Gem::Specification#has_rdoc= is deprecated since rubygems 1.7.0
  default_executable is deprecated since rubygems 1.7.0
  Trivial fix to HTTP Digest auth MD5 example
  Moved Turn activation/dependency to railties
  fix typo
  Direct logging of Active Record to STDOUT so it's shown inline with the results in the console [DHH]
  Add using Turn with natural language test case names if the library is available (which it will be in Rails 3.1) [DHH]
  require turn only for minitest
  Use Turn to format all Rails tests and enable the natural language case names
  Improve docs.
  pass respond_with options to controller render when using a template for api navigation
  only try to display an api template in responders if the request is a get or there are no errors
  when using respond_with with an invalid resource and custom options, the default response status and error messages should be returned
  ...
2011-04-05 21:22:38 +10:00
Ryan Bigg
357578256f Correct documentation on url_for. It doesn't call to_s, but rather to_param 2011-04-05 21:22:10 +10:00
simply-phi
ac07da8fc7 Made the defaults section a little more readable and more to the point, giving a overview of the possibilities. 2011-04-04 11:04:07 +02:00
simply-phi
f323a8fed4 Added information about default values 2011-04-04 11:03:59 +02:00
Josh Kalderimis
284ca810c1 remove AM delegating register_observer and register_interceptor to Mail and instead implement smarter versions allowing for string class names, also added proper Railtie support with tests.
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-04-04 10:49:09 +02:00
Emilio Tagua
454ec93ff7 Add log message when loading records from Identity Map.
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-04-04 10:48:17 +02:00
Emilio Tagua
b35617235d Use IM when trying to load records using ID.
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-04-04 10:48:12 +02:00
Santiago Pastorino
16e5d158c2 Add railties to the LOAD_PATH if running from a Rails checkout 2011-04-03 19:18:57 -03:00
Vijay Dev
4ac719686c Merge branch 'master' of github.com:lifo/docrails 2011-04-04 02:43:12 +05:30
Xavier Noria
3e24e9ebc2 Merge branch 'master' of git://github.com/lifo/docrails 2011-04-03 22:22:03 +02:00
orta
4c323bc25a added .'s to headings in the initialization textile page 2011-04-03 15:19:32 +02:00
Akira Matsuda
9bf5cddd28 s/ERb/ERB/g (part II) 2011-04-03 16:59:37 +09:00
Akira Matsuda
bd3cdeea35 s/ERb/ERB/g
The author of ERB sais, his eRuby implementation was originally named "ERb/ERbLight" and then renamed to "ERB" when started bundled as a Ruby standard lib.
http://www2a.biglobe.ne.jp/~seki/ruby/erb.html
2011-04-03 12:47:51 +09:00
Santiago Pastorino
a000fc58b8 Bump up erubis to 2.7.0 2011-04-02 23:56:52 -03:00
Santiago Pastorino
cc58fe79ac Implicit actions named not_implemented can be rendered 2011-04-02 23:47:50 -03:00
Gonçalo Silva
8d558cb1b0 don't use internal profiler methods on Rubinius and JRuby since we're only measuring wall clock for now (and the APIs will/can change, respectively) 2011-04-03 03:16:35 +01:00
Gonçalo Silva
65022acda0 removed unused class declaration 2011-04-03 02:09:53 +01:00
Gonçalo Silva
5b2b513742 Merge branch 'master' of https://github.com/rails/rails into performance_test 2011-04-03 02:02:35 +01:00
Gonçalo Silva
677ce63d92 profiling enabled under JRuby. Added documentation for workaround described in JRUBY-5650. 2011-04-03 02:02:03 +01:00
Santiago Pastorino
99da42c299 Gem::Specification#has_rdoc= is deprecated since rubygems 1.7.0 2011-04-02 00:35:33 -03:00
Santiago Pastorino
9de8dea2e8 default_executable is deprecated since rubygems 1.7.0 2011-04-01 23:58:37 -03:00
John Firebaugh
080e2a7abf Enumerable should pass encoding options to children in #as_json/#to_json. 2011-04-01 12:16:54 -07:00
Jon Cooper
c17b8e4047 Trivial fix to HTTP Digest auth MD5 example 2011-03-31 16:22:52 -07:00
David Heinemeier Hansson
0eb6e5e270 Moved Turn activation/dependency to railties 2011-03-31 16:20:59 -07:00
burningTyger
63e4e218c5 fix typo 2011-04-01 00:12:58 +02:00
David Heinemeier Hansson
caf0a72c85 Direct logging of Active Record to STDOUT so it's shown inline with the results in the console [DHH] 2011-03-31 14:33:24 -07:00
David Heinemeier Hansson
6eff04499e Add using Turn with natural language test case names if the library is available (which it will be in Rails 3.1) [DHH] 2011-03-31 12:25:04 -07:00
David Heinemeier Hansson
edf7c9a6a3 require turn only for minitest 2011-03-31 12:17:28 -07:00
David Heinemeier Hansson
b27057731c Use Turn to format all Rails tests and enable the natural language case names 2011-03-31 12:11:03 -07:00
José Valim
7a9dafd96c Improve docs. 2011-03-31 19:00:05 +02:00
Josh Kalderimis
b45302d767 pass respond_with options to controller render when using a template for api navigation
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-03-31 18:53:36 +02:00
Josh Kalderimis
48404a751d only try to display an api template in responders if the request is a get or there are no errors
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-03-31 18:53:27 +02:00
Josh Kalderimis
9766997f4c when using respond_with with an invalid resource and custom options, the default response status and error messages should be returned
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-03-31 18:53:21 +02:00
Amaia Castro
a64abdda25 Explain in the method doc that you need to call respond_to at the class level in order to use respond_with. 2011-03-31 13:19:19 +02:00
Vijay Dev
4c76f68948 Merge branch 'master' of github.com:lifo/docrails 2011-03-31 16:34:07 +05:30
Josiah Ivey
f44d85a030 Grammar tweaks to the guides guidelines 2011-03-31 00:16:45 -05:00
David Heinemeier Hansson
2867093365 Delegate pending to skip if Minitest is available 2011-03-30 21:16:29 -07:00
Joshua Peek
d7b521db12 Fix assets prefix joining 2011-03-30 22:17:43 -05:00
Joshua Peek
bcde6cdf27 Fix assets prefix joining 2011-03-30 22:12:00 -05:00
Joshua Peek
203b151af7 Fix config.assets.precompile option 2011-03-30 22:00:16 -05:00
Joshua Peek
28fee29e38 Unify sprockets config options 2011-03-30 21:56:15 -05:00
Joshua Peek
56a5da89db Merge branch 'master' into sprockets
Conflicts:
	railties/lib/rails/application/configuration.rb
2011-03-30 21:04:33 -05:00
Joshua Peek
5df076ad09 Merge branch 'master' into sprockets 2011-03-30 20:56:05 -05:00
Joshua Peek
ac9443ed71 Switch to sprockets/master 2011-03-30 20:46:49 -05:00
Aaron Patterson
58c3ec1b7b use assert_equal so we get normal error messages along with our custom failure message 2011-03-30 15:29:52 -07:00
Ryan Bigg
cf07da0929 Symbol to proc is preferred over longer form of map 2011-03-31 06:59:48 +11:00
Ryan Bigg
04d5decfd3 Cleanup of named_scope documentation 2011-03-31 06:48:05 +11:00
Ryan Bigg
7a34ab7d60 Fix typo in named_scope documentation 2011-03-31 06:48:05 +11:00
Eadz
6a1715111e add space to conform with style 2011-03-31 06:48:05 +11:00
Eadz
45d5d6b268 Documented undocumented feature: Class methods on your model are automatically available on scopes 2011-03-31 06:48:05 +11:00
Santiago Pastorino
4f90b28e06 Bring back AMo#i18n_key method 2011-03-30 16:29:43 -03:00
Aaron Patterson
d688a9d084 Merge branch 'master' of github.com:rails/rails
* 'master' of github.com:rails/rails:
  Make action_method? public and change implicit rendering to override it instead.
2011-03-30 09:55:02 -07:00
Aaron Patterson
cfb6f77ac0 TableAlias leg ordering has changed, so change accordingly 2011-03-30 09:54:46 -07:00
José Valim
ba51aa0b1b Make action_method? public and change implicit rendering to override it instead. 2011-03-30 17:22:05 +02:00
Joshua Peek
25c0b569f5 Precompile configured assets 2011-03-29 22:11:47 -05:00
Joshua Peek
77d8f7a4b7 Seperate asset directories 2011-03-29 21:40:24 -05:00
Gonçalo Silva
b8f9a45156 Merge branch 'master' of https://github.com/rails/rails into performance_test 2011-03-30 03:24:20 +01:00
Gonçalo Silva
6212749bd4 updated documentation because of the benchmark/profile improvements 2011-03-30 03:23:49 +01:00
Gonçalo Silva
09cdd1cac1 check if there is support for the specified metric when profiling 2011-03-30 03:23:16 +01:00
Joshua Peek
651d371a24 Rename option to config.asset_pipeline 2011-03-29 21:23:05 -05:00
Joshua Peek
612454e00e Move sprockets initializers back to application 2011-03-29 21:16:44 -05:00
Aaron Patterson
2be383b946 test against AR class rather than the relation (thanks Andrew White!) 2011-03-29 17:50:39 -07:00
Aaron Patterson
0471fc9f1c Merge branch 'master' into zomg
* master: (51 commits)
  order is not guaranteed by this select, so add an order and call first!
  oracle stores this with microseconds, so convert to seconds before comparing
  make sure that active connections are not cleared during test when an exception happens
  clearing active connections in the ConnectionManagement middleware if an exception happens
  proxy body responses so we close database connections after body is flushed
  Pass the proper method_name instead of hardcoding to action_name.
  Quote find_in_batches ORDER BY clause [#6620 state:resolved]
  Delegate first!, last!, any? and many? to scoped
  Dont call authenticate_or_request_with_http_basic twice
  Remove 'warning: ambiguous first argument' when running ActionPack tests
  Change exists? so that it doesn't instantiate records [#6127 state:resolved]
  Move mapper_test to the appropriate location
  Update the wildcard route to be non-greedy by default, therefore be able to match the (.:format) segment [#6605 state:resolved]
  Fix examples
  Added Base.http_basic_authenticate_with to do simple http basic authentication with a single class method call [DHH]
  make sure we have an active database connection before running each connection management test
  adding active_connections? to the connection pool for finding open connections
  adding active_connection? to the connection pool
  testing app delegation from the ConnectionManagement middleware
  namespacing connection management tests. ❤️
  ...
2011-03-29 17:38:43 -07:00
Aaron Patterson
58becf1165 order is not guaranteed by this select, so add an order and call first! 2011-03-29 17:27:32 -07:00
Aaron Patterson
6067d29a1f oracle stores this with microseconds, so convert to seconds before comparing 2011-03-29 17:09:22 -07:00
Joshua Peek
db3e310d6b Change back to /assets prefix 2011-03-29 18:05:23 -05:00
Gonçalo Silva
391ccdaf35 fixed a bug where rubinius was creating the profiling files as directories 2011-03-30 00:00:26 +01:00
Aaron Patterson
c7b7c6ad1c make sure that active connections are not cleared during test when an exception happens 2011-03-29 15:47:16 -07:00
Gonçalo Silva
a35ba6cf5a don't allow decimal places on the amount of objects and gc runs 2011-03-29 23:43:26 +01:00
Aaron Patterson
3b2a032677 clearing active connections in the ConnectionManagement middleware if an exception happens 2011-03-29 15:42:32 -07:00
Aaron Patterson
e5246092d1 proxy body responses so we close database connections after body is flushed 2011-03-29 15:37:07 -07:00
Joshua Peek
8e4d0b118b Fix building route set with sprockets in production 2011-03-29 17:28:46 -05:00
Joshua Peek
a5f547cc79 Only add fingerprints if perform_caching is on 2011-03-29 17:27:49 -05:00
Joshua Peek
e646385993 Fix sprockets logger 2011-03-29 17:02:29 -05:00
Gonçalo Silva
be0a2b8f01 performance tests inherit from AD::PT and not AC::PT, fixed performance test generator invocation (guide) 2011-03-29 22:41:49 +01:00
Joshua Peek
bed7a1acc4 Copy use_sprockets config 2011-03-29 16:17:49 -05:00
Joshua Peek
375443a9c5 Use sprockets helpers if config.use_sprockets is set 2011-03-29 15:53:28 -05:00
Joshua Peek
2b4705961d Add sprockets to Gemfile for testing 2011-03-29 15:42:57 -05:00
Joshua Peek
1af295fc9a Tests for SprocketsHelper 2011-03-29 15:42:31 -05:00
José Valim
94907035b6 Pass the proper method_name instead of hardcoding to action_name.
Conflicts:

	actionpack/lib/action_controller/metal/implicit_render.rb
2011-03-29 19:30:59 +02:00
Andrew White
555d016389 Quote find_in_batches ORDER BY clause [#6620 state:resolved] 2011-03-29 17:24:55 +01:00
Andrew White
a9dafbb28d Delegate first!, last!, any? and many? to scoped 2011-03-29 17:21:21 +01:00
David Heinemeier Hansson
e8d20b858d Dont call authenticate_or_request_with_http_basic twice 2011-03-29 07:29:10 -07:00
Sebastian Martinez
52351bcfeb Remove 'warning: ambiguous first argument' when running ActionPack tests
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-29 10:23:10 -03:00
Andrew White
b155fdadf3 Change exists? so that it doesn't instantiate records [#6127 state:resolved] 2011-03-29 12:51:58 +01:00
Prem Sichanugrist
84a4ef63a4 Move mapper_test to the appropriate location
It seems like in 89c5b9aee7 Aaron actually put the test in action_dispatch folder. However, there's already a `test/dispatch` directory which I think it's more appropriate.

Signed-off-by: Andrew White <andyw@pixeltrix.co.uk>
2011-03-29 10:12:17 +01:00
Prem Sichanugrist
51551a0a5b Update the wildcard route to be non-greedy by default, therefore be able to match the (.:format) segment [#6605 state:resolved]
After some discussion with Andrew White, it seems like this is a better approach for handling a wildcard route. However, user can still bring back the old behavior by supplying `:format => false` to the route.

Signed-off-by: Andrew White <andyw@pixeltrix.co.uk>
2011-03-29 10:12:17 +01:00
mhutchin
ff09d4bd5b Minor rephrasing to improve grammar and readability. 2011-03-29 01:50:00 -07:00
mhutchin
9fdfe2ec1e Fixed typo and improved readability. 2011-03-29 00:39:33 -07:00
John Firebaugh
b671e4d86a Fix formatting and broken markup 2011-03-28 22:31:05 -07:00
John Firebaugh
07054fe369 Fix grammar, formatting, and cross references 2011-03-28 22:17:20 -07:00
Gabriel Horner
cc446d6c9f Add docs for ActionController::Metal class methods 2011-03-28 23:48:45 -04:00
ozzyaaron
837f0ab5c8 Merge branch 'master' of github.com:lifo/docrails 2011-03-29 11:23:20 +08:00
ozzyaaron
d5dc02b5e8 Added back the Callback debugging section by interrogating the _*_callbacks method 2011-03-29 11:22:16 +08:00
Sebastian Martinez
54af8dfbfc Fix Basic Authentication examples 2011-03-28 22:49:43 -03:00
Sebastian Martinez
70779a08a0 Updated Basic Authentication guides to reflect new Base.http_basic_authenticate_with method 2011-03-28 22:46:13 -03:00
David Heinemeier Hansson
3d1e7c2645 Fix examples 2011-03-28 18:15:41 -07:00
David Heinemeier Hansson
e2b07ee000 Added Base.http_basic_authenticate_with to do simple http basic authentication with a single class method call [DHH] 2011-03-28 18:10:08 -07:00
Aaron Patterson
aea1477362 make sure we have an active database connection before running each connection management test 2011-03-28 17:47:46 -07:00
Aaron Patterson
25f94971ab adding active_connections? to the connection pool for finding open connections 2011-03-28 17:29:37 -07:00
Aaron Patterson
4211866b7a adding active_connection? to the connection pool 2011-03-28 16:43:34 -07:00
Aaron Patterson
ec0cacc293 testing app delegation from the ConnectionManagement middleware 2011-03-28 16:22:37 -07:00
Aaron Patterson
7b4866e0ae namespacing connection management tests. ❤️ 2011-03-28 16:08:42 -07:00
Aaron Patterson
e1a5007207 sql logger ignores schema statements 2011-03-28 15:27:37 -07:00
Joshua Peek
3b4e1a9159 Update sprockets path generation method 2011-03-28 15:58:29 -05:00
Joshua Peek
9cb264555d Add SprocketsHelper 2011-03-28 15:19:34 -05:00
Vijay Dev
910a8d2246 Merge branch 'master' of github.com:lifo/docrails 2011-03-29 00:41:11 +05:30
Joshua Peek
41cc643065 Remove sprockets exception from main asset helpers 2011-03-28 13:54:58 -05:00
Joshua Peek
8ceec5c6c2 Fix reference to config.use_sprockets 2011-03-28 13:44:14 -05:00
Joshua Peek
954d73df53 Add use_sprockets flag 2011-03-28 13:22:13 -05:00
Joshua Peek
7197eb77d5 Logger isn't set here 2011-03-28 11:10:45 -05:00
Joshua Peek
170680ae91 Add route for assets 2011-03-28 11:04:31 -05:00
Sebastian Martinez
fb21511040 Bring #reorder back
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-28 10:24:08 -03:00
Rolf Timmermans
0a28073acc Engines that use isolate_namespace with nested modules should set correct module prefix for their routes. 2011-03-28 15:58:28 +08:00
mhutchin
62dd3458e3 Minor typo correction. 2011-03-27 23:50:51 -07:00
Gonçalo Silva
6f0caa1a53 Merge branch 'master' of https://github.com/rails/rails into performance_test 2011-03-28 04:20:49 +01:00
Gonçalo Silva
726b7ede54 improved detection and feedback of supported/unsupported metrics 2011-03-28 04:19:39 +01:00
Gonçalo Silva
09bd0eeefc fixed a couple of hidden bugs 2011-03-28 04:03:47 +01:00
Gonçalo Silva
c401ad9853 improved options handling in performance tests 2011-03-28 03:11:42 +01:00
Gonçalo Silva
983bd01f42 we need test-unit on mri 1.9 2011-03-28 03:08:08 +01:00
Gonçalo Silva
d6d059f280 added profiling and benchmarking capabilities to jruby (profiling is crippled because of a jruby bug) 2011-03-28 02:11:05 +01:00
Sebastian Martinez
245542ea29 Added new #update_column method.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-27 21:47:38 -03:00
Gonçalo Silva
e6cb3962bb benchmarking metrics are also implementation-specific 2011-03-28 01:32:56 +01:00
Gonçalo Silva
e17f608797 warn the user about unsupported benchmarking metrics he might have asked for 2011-03-28 01:32:32 +01:00
Xavier Noria
e6a8a3adaf let these heredocs flow with the code 2011-03-28 01:44:48 +02:00
Gonçalo Silva
ef988e12d8 removed duplication in rubinius' benchmark code 2011-03-28 00:33:36 +01:00
Gonçalo Silva
15bff5a86e fix a bug where the GC wasn't being triggered at the start of the MRI benchmarks 2011-03-28 00:33:07 +01:00
Gonçalo Silva
93a583eb18 :min_percent only makes sense in a RubyProf context 2011-03-28 00:32:21 +01:00
Gonçalo Silva
1a9b1edb49 remove deprecated documentation 2011-03-28 00:32:00 +01:00
Santiago Pastorino
b023bcf71b Make edge and dev options use edge mysql2 2011-03-27 19:37:18 -03:00
Sebastian Martinez
0e1fed537a Revert "Removed #update_attribute method. New #update_column method."
This reverts commit 45c233ef81.

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-27 18:55:30 -03:00
Xavier Noria
eea6a65488 Merge branch 'master' of git://github.com/lifo/docrails 2011-03-27 23:50:39 +02:00
Xavier Noria
6194c6d13b AR validations and callbacks guide: put update_attribute back 2011-03-27 23:49:11 +02:00
Prem Sichanugrist
884e39f69e Fix documentation typo 2011-03-28 04:58:48 +08:00
Prem Sichanugrist
7cbdfa8303 Add controller-specific force_ssl method to force web browser to use HTTPS protocol
This would become useful for site which sometime transferring sensitive information such as account information on particular controller or action.

This featured was requested by DHH.
2011-03-28 04:58:47 +08:00
Xavier Noria
84aab7aa53 s/with/when/ 2011-03-27 22:31:42 +02:00
Prem Sichanugrist
2c0c4d754e Add config.force_ssl configuration which will load Rack::SSL middleware if set to true
This will allow user to be able to force all requests to be under HTTPS protocol.

This commit was a request from DHH. Special thanks to Josh Peek as well for making `Rack::SSL`.
2011-03-27 13:27:23 -07:00
Xavier Noria
b2d94322e6 fixes a couple of regexps, the suite showed warnings about them
A couple of things worth mentioning here:

 - "{" is a metacharacter, should be escaped
   if it is meant to match a "{". The code
   worked, though, because the regexp engine
   is tolerant to this, but issued warnings.

 - gsub accepts a string as first argument.
   That's the best idiom to use when your
   pattern has no metacharacters, since gsub
   interprets the string as an exact substring
   to look for, rather than a regexp. The
   benefit is that your pattern is crystal
   clear and needs no backslashes.
2011-03-27 20:45:23 +02:00
David Heinemeier Hansson
cc6fa2f4d7 Fix alias_method, add test 2011-03-27 11:20:54 -07:00
Rolf Timmermans
512057d386 Merge remote-tracking branch 'upstream/master' into desc_tracker 2011-03-27 17:18:32 +02:00
Vijay Dev
7b9bdd9253 Merge branch 'master' of github.com:lifo/docrails 2011-03-27 18:58:34 +05:30
mhutchin
738e906a02 A little minor rephrasing for improved readability. 2011-03-27 02:34:02 -07:00
mhutchin
35129f5b99 Minor typo fix. 2011-03-27 01:40:49 -07:00
Aaron Patterson
a9d27c04ab cleaning up typecast test a little 2011-03-26 17:16:33 -07:00
Aaron Patterson
5013fe3a1d refactoring tz to a variable rather than repeating it 2011-03-26 17:04:54 -07:00
David Heinemeier Hansson
f8a05ad297 Allow FormHelper#form_for to specify the :method as a direct option instead of through the :html hash [DHH] 2011-03-26 14:45:00 -07:00
Gonçalo Silva
84fe2b8b42 added basic structure for jruby 2011-03-26 19:34:59 +00:00
Vijay Dev
2fc32636dc Merge branch 'master' of github.com:lifo/docrails 2011-03-27 00:21:25 +05:30
Aaron Patterson
dea3d2dd20 adding a test for attributes after type cast. thanks nragaz. ❤️ 2011-03-26 11:50:31 -07:00
David Heinemeier Hansson
cb3e96a447 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] 2011-03-26 10:28:39 -07:00
Gonçalo Silva
3872cc4a73 added support for profiling under rubinius 2011-03-26 15:51:44 +00:00
Sebastian Martinez
7c6807296b Updated guides for new #update_column. 2011-03-26 12:13:39 -03:00
Sebastian Martinez
45c233ef81 Removed #update_attribute method. New #update_column method.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-26 12:09:04 -03:00
Ryan Bigg
198f3883fa Proc objects for cache_path for caches_action no longer need controller object, nor to use send when calling routing helpers 2011-03-26 11:34:05 +11:00
Xavier Noria
eb8beb32b0 Merge branch 'master' of git://github.com/lifo/docrails 2011-03-26 00:13:37 +01:00
Sebastian Martinez
6ee5d9244c impact recent updates to #first! and #last! methods 2011-03-25 20:07:13 -03:00
Xavier Noria
9d9b873b95 removes unnecessary selfs, and mentions that first! and last! take no arguments in their API docs 2011-03-26 00:02:40 +01:00
Xavier Noria
6383f6704f Merge branch 'master' of git://github.com/lifo/docrails 2011-03-25 23:47:57 +01:00
Sebastian Martinez
a0946692c1 Update AR querying guide with #first! and #last! new methods 2011-03-25 19:34:45 -03:00
Pratik Naik
25be204e3c No arguments for first! and last! 2011-03-25 22:30:36 +00:00
Josh Susser
65dce01091 comment typo fix 2011-03-25 12:28:37 -07:00
Gonçalo Silva
278344b3fa fixed time and size units (should be seconds / bytes), fixed typo when counting memory allocations under rubinius 2011-03-25 19:10:47 +00:00
Aaron Patterson
7333f50abc fixing whitespace errors. 💣 2011-03-25 12:10:11 -07:00
Gonçalo Silva
417b2baf0f added gc info (runs, time) to rubinius' benchmarks 2011-03-25 18:01:39 +00:00
Gonçalo Silva
c58e063da0 added memory size and allocations to rubinius' benchmarks 2011-03-25 18:00:29 +00:00
Gonçalo Silva
cf29d90ef1 added time (wall, process, cpu) to rubinius' benchmarks 2011-03-25 17:59:22 +00:00
Gonçalo Silva
9e9090f887 added missing require 2011-03-25 17:27:26 +00:00
Gonçalo Silva
4fe86a3ea2 removed leftovers from the copy-paste from mri 2011-03-25 17:23:39 +00:00
Gonçalo Silva
b0beba2621 rubinius returns "rbx" for RUBY_ENGINE, not "rubinius" 2011-03-25 17:21:32 +00:00
Gonçalo Silva
995d543b64 added basic structure for Rubinius 2011-03-25 17:18:06 +00:00
Gonçalo Silva
2fa426c944 divide the ruby interpreter into mri and yarv for improved modularity 2011-03-25 03:26:43 +00:00
Gonçalo Silva
3ec79e4288 renamed "mri" to "ruby", for consistency with RUBY_ENGINE 2011-03-25 03:21:01 +00:00
Gonçalo Silva
18a81db6fc check whether the user is using a supported ruby interpreter for benchmarking 2011-03-25 02:46:57 +00:00
Gonçalo Silva
1151608921 using number_helper to pretty print some results 2011-03-25 02:39:43 +00:00
Gonçalo Silva
e57d264f37 extracted more generic methods, added a note for methods that need to be overridden by each implementation 2011-03-25 02:28:38 +00:00
Gonçalo Silva
c50df6351c initial separation of RubyProf-specific code 2011-03-25 01:50:07 +00:00
Gonçalo Silva
6e99bb6aca ruby-prof only makes sense in an MRI context 2011-03-25 00:02:25 +00:00
Gonçalo Silva
a6e22229b9 move "check for ruby-prof" from AD/testing/performance_test to AS/testing/performance, where it is actually required 2011-03-24 23:57:57 +00:00
Gonçalo Silva
23be2c6134 check if RubyProf's WALL_TIME and PROCESS_TIME are available before using them (similarly to other constants) 2011-03-24 23:38:17 +00:00
Josh Kalderimis
5170d210e8 correction to the outputted controller name in the diagnostics error template, test included
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-24 19:43:48 -03:00
John Mileham
28c73f0123 Use Arel to build subquery. Adapt tests to changed fixtures. 2011-03-24 15:09:24 -04:00
John Mileham
b44a0ec153 Merge branch 'master' of github.com:rails/rails into count_behavior 2011-03-24 15:03:08 -04:00
Gonçalo Silva
9887f23887 Merge branch 'master' of https://github.com/rails/rails 2011-03-24 17:21:17 +00:00
Josh Susser
5214e73850 add #first! and #last! to models & relations 2011-03-24 09:55:51 -07:00
Andrew White
9772de8d45 Fix filter :only and :except with implicit actions
The method_name argument is "default_render" for implicit actions
so use the action_name attribute to determine which callbacks to run.

[#5673 state:resolved]
2011-03-23 23:32:44 +00:00
Manfred Stienstra
5da9a74bd3 Add a failing test case for an implicit action with a before filter.
Signed-off-by: Andrew White <andyw@pixeltrix.co.uk>
2011-03-23 23:32:44 +00:00
Adam Meehan
c5908a8649 Fix before_type_cast for timezone aware attributes by caching converted value on write. Also remove read method reload arg on timezone attributes. 2011-03-23 15:38:51 -07:00
Murray Steele
54c963c89b Make clearing of HABTM join table contents happen in an after_destory callback.
The old method of redefining destroy meant that clearing the HABTM join table would happen as long as the call to destroy succeeded.  Which meant if there was a before_destroy that stopped the instance being destroyed using normal means (returning false, raising ActiveRecord::Rollback) rather than exceptional means the join table would be cleared even though the instance wasn't destroyed.  Doing it in an after_destroy hook avoids this and has the advantage of happening inside the DB transaction too.
2011-03-23 14:45:21 -07:00
Murray Steele
8ee81d21fb Failing test case to show that habtm join table contents are removed when a model is destroyed but the destruction is blocked by a before_destroy. 2011-03-23 14:45:21 -07:00
Xavier Noria
3b91b3726d Merge branch 'master' of git://github.com/lifo/docrails 2011-03-23 21:52:33 +01:00
Aditya Sanghi
3a7c7dc73d Fix test for prepend giving a false positive. [#5716 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-03-23 18:06:30 +01:00
Diego Carrion
a1edbf7206 parse dates to yaml in json arrays
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-22 21:09:54 -03:00
Diego Carrion
7004434ad8 test json decoding with time parsing disabled with all backends and respect ActiveSupport.parse_json_times when converting to yaml
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-22 21:09:54 -03:00
Santiago Pastorino
450f7cf01b use class_eval with a string when it's possible 2011-03-22 20:11:36 -03:00
Santiago Pastorino
baa237c974 Allow to read and write AR attributes with non valid identifiers 2011-03-22 20:02:32 -03:00
Santiago Pastorino
da6c7bd4b4 Do not in place modify what table_name returns 2011-03-22 19:36:16 -03:00
Dr Nic Williams
ee8ca49414 Update 'Getting Started on Windows' tip to go to one-click Rails Installer 2011-03-22 15:13:55 -07:00
Joshua Peek
ce52c6f4a7 Change static root to /public 2011-03-22 16:36:21 -05:00
Ryan Bigg
137ff0402a Caching guide: Capitalize 'Note' so that it's rendered as a proper note 2011-03-23 08:33:06 +11:00
Joshua Peek
8c26d0dba6 Use sprockets precompile 2011-03-22 16:24:01 -05:00
Joshua Peek
989103a233 Move app/javascripts and app/stylesheets under app/assets 2011-03-22 16:15:05 -05:00
Joshua Peek
628c31b353 Add sprockets md5s to asset tags 2011-03-22 15:43:40 -05:00
Joshua Peek
6aff1d0f6f Remove ensure_fresh_assets flag 2011-03-22 14:40:18 -05:00
Piotr Sarnacki
e06c448002 Install rb-fsevent gem if ENV[RB_FSEVENT] is set 2011-03-22 19:36:12 +01:00
Aaron Patterson
ed97c39517 adding missing require 2011-03-22 10:10:33 -07:00
Aaron Patterson
2ef6270f8f Merge branch 'master' into fuuu
* master:
  Do not show optional (.:format) block for wildcard route [#6605 state:resolved]
  pushing id insertion and prefetch primary keys down to Relation#insert
  use prepared statements to fetch the last insert id
  escaping binary data encoding when inserting to sqlite3. Thanks Naruse! [#6559 state:resolved]
  schemas set by set_table_name are respected by the mysql adapter. [#5322 state:resolved]
  Reapply extensions when using except and only
  SJIS is an alias to Windows-31J in ruby trunk. Use SHIFT_JIS for this test
  Improved resolver docs a bit
  [action_view] docs for FileSystemResolver
  [action_view] added custom patterns to template resolver
2011-03-22 09:34:33 -07:00
Prem Sichanugrist
2ddfdba9a0 Do not show optional (.:format) block for wildcard route [#6605 state:resolved]
This will make the output of `rake routes` to be correctly match to the behavior of the application, as the regular expression used to match the path is greedy and won't capture the format part by default
2011-03-22 09:19:40 -07:00
Aaron Patterson
15d3cc21f4 pushing id insertion and prefetch primary keys down to Relation#insert 2011-03-22 09:18:01 -07:00
Joshua Peek
cef10d8ec5 Assign sprockets static root 2011-03-22 11:15:24 -05:00
Ryan Bigg
5a44951186 Querying guide: mention that performing a where on an relation that contains an includes statement will generate a LEFT OUTER JOIN rather than an INNER JOIN or another query 2011-03-22 12:16:15 +11:00
Ryan Bigg
c24e5548fd Querying guide: mention that performing a where on an relation that contains an includes statement will generate a LEFT OUTER JOIN rather than an INNER JOIN or another query 2011-03-22 12:16:13 +11:00
Aaron Patterson
3378d77b04 use prepared statements to fetch the last insert id 2011-03-21 16:32:13 -07:00
Joshua Peek
10c7e61825 Need to load assets task file 2011-03-21 18:09:23 -05:00
Joshua Peek
77ad4ca058 Add sprockets task to compile assets 2011-03-21 18:05:56 -05:00
Joshua Peek
3e7985c9c1 Add sprockets environment to Application 2011-03-21 17:58:28 -05:00
Aaron Patterson
88636f7195 escaping binary data encoding when inserting to sqlite3. Thanks Naruse! [#6559 state:resolved] 2011-03-21 14:49:07 -07:00
Aaron Patterson
ea8fcfb729 schemas set by set_table_name are respected by the mysql adapter. [#5322 state:resolved] 2011-03-21 11:20:45 -07:00
Iain Hecker
96b9fc4400 Reapply extensions when using except and only 2011-03-21 10:29:45 -07:00
Aaron Patterson
55bf087da1 SJIS is an alias to Windows-31J in ruby trunk. Use SHIFT_JIS for this test 2011-03-21 10:00:30 -07:00
Gabriel Horner
6c309f04c9 Beef up Rails::Railtie::Configuration docs 2011-03-19 19:53:36 -04:00
José Valim
1413c9b1d5 Improved resolver docs a bit 2011-03-19 16:06:50 -07:00
Chris Kowalik
d76fadbd7d [action_view] docs for FileSystemResolver 2011-03-20 07:01:47 +08:00
Chris Kowalik
de1fe5e8a7 [action_view] added custom patterns to template resolver 2011-03-20 07:01:46 +08:00
Jon Leighton
6ab65bec61 Merge branch 'master' into nested_has_many_through 2011-03-18 23:15:01 +00:00
Jon Leighton
5b84aebd14 Add order clauses to fix some tests which were failing under 1.8 on oracle and postgres 2011-03-18 23:14:45 +00:00
Paco Guzman
f3666040a0 remove bank line 2011-03-18 11:29:52 +01:00
Santiago Pastorino
445241d713 define_attr_method should be able to define methods that returns nil 2011-03-17 23:17:20 -03:00
Aaron Patterson
4532b39f5f remove misleading comment 2011-03-17 10:31:12 -07:00
Aaron Patterson
00f0879367 dup strings on return so that in place modifications do not break anything. I am looking at you "compute_table_name" 2011-03-17 10:26:11 -07:00
Santiago Pastorino
c834a751d2 define_attr_method correctly defines methods with invalid identifiers 2011-03-16 21:20:44 -03:00
Santiago Pastorino
fda45f4fc4 Add a define_attr_method test 2011-03-16 21:08:02 -03:00
Santiago Pastorino
5232077517 Add test for define_attr_method using as name an invalid identifier 2011-03-16 21:01:49 -03:00
Santiago Pastorino
cb44e99de4 Add test for define_attribute_method using as name an invalid identifier 2011-03-16 21:01:04 -03:00
Jon Leighton
8aaf3c1e55 Merge branch 'master' into nested_has_many_through 2011-03-16 18:54:51 +00:00
Jon Leighton
9abc94c445 oracle, y u defy me 2011-03-16 18:54:34 +00:00
Josh Kalderimis
0eae625256 fixes an issue with number_to_human when converting values which are less than 1 but greater than -1 [#6576 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-16 15:11:00 -03:00
Vijay Dev
547407a9fb remove to from to to :) 2011-03-16 23:16:15 +05:30
Nicolas Cavigneaux
3edba71895 Add link to mailing-list 2011-03-16 13:04:39 +01:00
Andrew White
e8458d37c5 Fix typo in assertion message 2011-03-16 10:28:40 +00:00
Manuel Meurer
64fe0d4cba Remove incorrect comment that a default value of NULL cannot be set with change_column_default. 2011-03-16 11:01:43 +07:00
Norman Clarke
7bd70dcd6c Add messages to plain assertions.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-15 10:44:14 -03:00
Gabriel Horner
61781d84c1 doc :anchor option for #match in routes 2011-03-15 09:23:17 -04:00
Aaron Patterson
9f2706d770 use a list to represent the supported verbs for a route object 2011-03-14 18:26:30 -07:00
Aaron Patterson
9ba2d422f5 stop splatting arguments so that we can understand wtf is going on 2011-03-14 16:17:05 -07:00
Aaron Patterson
833a90594e RegexpWithNamedGroups is only used for path_info, so only apply to path info 2011-03-14 15:17:29 -07:00
Xavier Noria
21b12d89a6 Merge branch 'master' of git://github.com/lifo/docrails 2011-03-14 22:09:52 +01:00
Xavier Noria
a0826cceea be be -> be 2011-03-14 22:06:27 +01:00
Xavier Noria
de5e41f855 move the tips about :allow_(nil|blank) near their explanations, also no need to say these are options for all validators if they are not 2011-03-14 22:03:23 +01:00
Chris Kalafarski
377bd69e29 Removed some redundant Time#change time options from beginning_of_ methods in Date and Time 2011-03-13 20:22:32 -04:00
Jack Dempsey
dfa9e28113 silence @dummy_path not defined warnings 2011-03-14 02:54:44 +08:00
Jack Dempsey
88d8ca2ef9 use parens and silence ambiguous args warnings 2011-03-14 02:54:44 +08:00
Rolf Timmermans
d89a7967b5 Revert "Revert "It should be possible to use ActiveSupport::DescendantTracker without getting ActiveSupport::Dependencies for free.""
This reverts commit 9f5b1e1ed0.

Tests have been refactored so they pass in isolation.
2011-03-13 17:08:33 +01:00
Rolf Timmermans
76e4e2fa46 Refactored AS::DescendantsTracker test cases so they can be tested without AS::Dependencies. 2011-03-13 17:04:01 +01:00
Rolf Timmermans
56a0cba7be Missing dependency in MultiByte test. 2011-03-13 17:03:45 +01:00
Rolf Timmermans
e75774e216 Add missing dependency string inflection test. 2011-03-13 17:03:38 +01:00
Rolf Timmermans
36313430fa Missing dependency for duration test. 2011-03-13 17:03:31 +01:00
Anders Elfving
9b64399684 Adjust unique constraint comment to include info about the RecordNotUnique exception 2011-03-13 11:49:56 +01:00
Andrew White
47871b025e Remove invalid test
The test fails on PostgreSQL when trying to load the records as
the comments_count field is not included in the GROUP BY clause.
2011-03-13 08:43:19 +00:00
Manuel Meurer
deae670e9a Change ActionView::ViewPathSet to ActionView::PathSet 2011-03-13 15:14:51 +07:00
Lars Smit
c540b35441 Removed double texts 2011-03-13 09:07:23 +01:00
José Valim
9f5b1e1ed0 Revert "It should be possible to use ActiveSupport::DescendantTracker without getting ActiveSupport::Dependencies for free."
This reverts commit 46f6a2e388.

Caused failures on CI. rake test:isolated on activesupport directory show them.
2011-03-13 08:35:50 +01:00
Santiago Pastorino
157c37f558 Refactor length validation 2011-03-12 21:12:44 -02:00
Andriy Tyurnikov
f48d3d4df6 length validation for fixnums
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-12 21:12:44 -02:00
Chris Oliver
015192560b Fixed a bug when empty? was called on a grouped Relation that wasn't loaded
[#5829 state:resolved]

Signed-off-by: Andrew White <andyw@pixeltrix.co.uk>
2011-03-12 22:31:21 +00:00
Rolf Timmermans
1a3fe8ce42 Prevent callbacks in child classes from being executed more than once. 2011-03-13 01:35:29 +08:00
Rolf Timmermans
46f6a2e388 It should be possible to use ActiveSupport::DescendantTracker without getting ActiveSupport::Dependencies for free. 2011-03-13 01:33:10 +08:00
Mike Gehard
58de03f077 Add additional text to NotImplementedErrors [#6328 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-12 13:43:23 -02:00
Rolf Timmermans
63c8ea9a6a adds a couple of missing AS dependencies 2011-03-12 14:30:09 +01:00
Jon Leighton
37d93ea160 Fix tests under postgres - we should always put conditions in the WHERE part not in ON constraints because postgres requires that the table has been joined before the condition references it. 2011-03-12 09:32:20 +00:00
Jon Leighton
17ea204260 Merge branch 'master' into nested_has_many_through 2011-03-12 08:44:03 +00:00
Jon Leighton
02a43f9f45 Resolve some TODO comments which I decided did not need anything done 2011-03-12 08:42:57 +00:00
Aaron Patterson
acd4bfb537 Just define methods directly on the class rather than use the module
indirection.

clever--
2011-03-11 18:16:47 -08:00
Aaron Patterson
89c5b9aee7 do not automatically add format to routes that end in a slash 2011-03-11 18:06:22 -08:00
Pan Thomakos
72759f5867 Fixed special character encoding issue with MemCacheStore in Ruby 1.9.2. 2011-03-11 17:57:28 -08:00
Paco Guzman
0a51e43866 remove some blanks 2011-03-11 23:08:55 +01:00
José Valim
53794cf7b5 Add missing require 'thread' to BufferedLogger. 2011-03-11 13:29:39 -08:00
Samuel Kadolph
94031ef422 Add require 'date' to use Date.today in plugin template MIT-LICENSE 2011-03-12 03:27:42 +08:00
Jon Leighton
39a6f4f25d Simplify implementation of ThroughReflection#chain 2011-03-11 00:51:57 +00:00
Jon Leighton
e18679ab04 Abstract some common code from AssociationScope and JoinDependency::JoinAssociation into a JoinHelper module 2011-03-11 00:47:18 +00:00
Jon Leighton
aef3629c6e Refactor JoinAssociation 2011-03-10 23:55:29 +00:00
Prem Sichanugrist & Xavier Noria
68802d0fbe Filter sensitive query string parameters in the log [#6244 state:committed]
This provides more safety to applications that put secret information in the query string, such as API keys or SSO tokens.

Signed-off-by: Xavier Noria <fxn@hashref.com>
2011-03-11 00:16:18 +01:00
Jon Leighton
582edaa1ff Merge branch 'master' into nested_has_many_through 2011-03-10 19:35:20 +00:00
Jon Leighton
2d3d9e3531 Rename Reflection#through_reflection_chain and #through_options to Reflection#chain and Reflection#options as they now no longer relate solely to through associations. 2011-03-10 19:28:26 +00:00
Jon Leighton
6490d65234 Move the code which builds a scope for through associations into a generic AssociationScope class which is capable of building a scope for any association. 2011-03-10 19:04:00 +00:00
Mike Gehard
ee7c48678f Minor formatting changes and remove a comment 2011-03-10 10:08:30 -05:00
Vijay Dev
439ccdc3cf update plugin urls to reflect official maintainers 2011-03-10 19:58:55 +05:30
David Aaron Fendley
6fba542f44 Added note re: functional tests and HTTP methods. 2011-03-09 18:06:50 -06:00
Santiago Pastorino
51a269b228 Fix typo 2011-03-09 20:17:30 -02:00
Diego Carrion
8e73e589a8 publicise ActionMailer::MailHelper.format_paragraph
[#6550 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-09 18:36:39 -02:00
Diego Carrion
f65023cbda expose ActionMailer::MailHelper in the RDoc 2011-03-09 14:56:44 -03:00
Xavier Noria
ebe4fa5fbe move the conditional definition of Float#round down
Rails 3 cherry-picks as little as possible from Active Support. In particular
the framework requires the files where extensions are exactly defined, rather
than convenience entry points like float.rb and friends. Because of that, it
is better to define conditionally rather than require conditionally.
2011-03-09 18:51:54 +01:00
Xavier Noria
32b5c4b77a copy-edits 532b770 2011-03-09 18:43:55 +01:00
Andrei Kulakov
532b77077f Use Rubys own Float#round method in versions 1.9 and above 2011-03-10 01:30:51 +08:00
Andrew White
03cbd9672c Filter params that return nil for to_param and allow through false values 2011-03-09 14:44:25 +00:00
Jeff Kreeftmeijer
e05e997907 Add a note to discourage users from using presence validators with allow_(nil|blank) 2011-03-09 10:58:18 +01:00
Xavier Noria
f41dd99be7 revises links to the API websites of individual components (no longer maintained), and rewrites the section about after and around filters in the controller guide 2011-03-09 07:43:18 +01:00
Diego Carrion
c7cfdd01c1 refactored Engine.#find by giving an explicit name to a variable and reducing calls
[#6529 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-09 00:28:03 -02:00
Aaron Patterson
0c777bace2 stop being clever and just call methods on the Route object 2011-03-08 16:18:27 -08:00
Aaron Patterson
f975626dc1 test/unit in ruby trunk adds a new instance variable. YAY! 2011-03-08 14:09:44 -08:00
Mat Brown
fb34f8577c Rename conflicting ActionMailer::MailHelper#simple_format method
This was conflicting with ActionView::Helpers::TextHelper#simple_format
from within email templates.
2011-03-09 05:49:01 +08:00
Chris Kalafarski
092538045e The root route example was the only using double quotes; switched it to single quotes for consistency 2011-03-08 09:55:57 -05:00
Aaron Pfeifer
9798ee2619 Add better test scenario for around callback return results 2011-03-08 15:01:06 +08:00
Aaron Pfeifer
df615f127e Allow access to a callback event's return result from around callbacks 2011-03-08 15:01:05 +08:00
Aaron Patterson
1408b942d9 removing stubs. 1.9.3 implements Date.today in C so mocking the return value of Time.now does nothing 2011-03-07 15:44:39 -08:00
Aaron Patterson
33f222b9e1 fixing some tests on ruby 1.9.3 2011-03-07 14:01:51 -08:00
Xavier Noria
a0d7247d15 reorganizes the RDoc of Hash#to_param 2011-03-07 22:20:24 +01:00
Xavier Noria
89ecc0a5dc Merge branch 'master' of git://github.com/lifo/docrails 2011-03-07 22:11:47 +01:00
Jon Leighton
67b17d029a Merge branch 'master' into nested_has_many_through 2011-03-07 20:58:54 +00:00
Jon Leighton
bb063b2f1b Fix test_has_many_association_through_a_has_many_association_with_nonstandard_primary_keys 2011-03-07 20:58:32 +00:00
Vijay Dev
f99db5a6a8 formatting changes 2011-03-07 23:56:16 +05:30
Aaron Patterson
5968d7a658 do not test explicit equality of predicate methods, they should be allowed to return truthy or falsey objects 2011-03-07 09:36:07 -08:00
Aaron Patterson
a032212e7c refactor calls to to_param in expand_key method 2011-03-07 09:33:19 -08:00
Jon Leighton
532f915037 Referencing a table via the ON condition in a join should force that table to be eager-loaded via a JOIN rather than via subsequent queries. 2011-03-07 08:51:17 -08:00
Aaron Patterson
9cee693213 Merge branch 'master' of github.com:rails/rails
* 'master' of github.com:rails/rails: (44 commits)
  Fixed indentation in actionmailer base_test [#6538 state:committed]
  remove unused assigned variable
  removes merge conflicts
  removes Examples headers introduced in 9b96de6
  Revert "Fixed identation in actionmailer base_test"
  Report the correct value of nil.id in the exception message as different ruby implementations may have different values, for example Rubinius returns 53 for nil.id.
  Improve testing of cookies in functional tests: - cookies can be set using string or symbol keys - cookies are preserved across calls to get, post, etc. - cookie names and values are escaped - cookies can be cleared using @request.cookies.clear
  more style changes
  Some style changes
  style changes
  Revert "style changes"
  Raise ArgumentError if route name is invalid [#6517 state:resolved]
  style changes
  Allow model to be inherited from Hash [#6487 state:resolved]
  styles applied for usage
  added failing test for fields_for with a record object that inherits from Hash
  Fixed identation in actionmailer base_test
  wrong SQL statement
  commas to set off expressions that interrupt sentence flow
  typo changes
  ...
2011-03-07 08:50:50 -08:00
Jon Leighton
cee3f9b36d Referencing a table via the ON condition in a join should force that table to be eager-loaded via a JOIN rather than via subsequent queries. 2011-03-07 00:04:20 +00:00
Xavier Noria
2159e9eb64 Merge branch 'active_model_unused_variable' of https://github.com/pacoguzman/rails into pacoguzman-active_model_unused_variable 2011-03-07 00:44:57 +01:00
Jon Leighton
5dc1fb39dd Refactor ThroughAssociation#join_to to be much smaller, and independent of construct_owner_conditions. 2011-03-06 23:38:10 +00:00
Dalibor Nasevic
c528297d17 Fixed indentation in actionmailer base_test [#6538 state:committed]
Signed-off-by: Xavier Noria <fxn@hashref.com>
2011-03-07 00:37:45 +01:00
Dalibor Nasevic
55d2a211d3 Improved docs for Hash#to_param method 2011-03-06 23:54:18 +01:00
Paco Guzman
8e0affbd86 Configuration options are symbols 2011-03-06 22:35:26 +01:00
Paco Guzman
14c254aba3 Remove Example headers. Code just flows with the text. 6ce844a3 2011-03-06 22:34:01 +01:00
Paco Guzman
7e9d45cc7f remove unused assigned variable 2011-03-06 22:24:22 +01:00
Akira Matsuda
071ddb8281 more "SSL everywhere" for GitHub URLs
see: https://github.com/blog/738-sidejack-prevention-phase-2-ssl-everywhere
2011-03-07 06:18:32 +09:00
Akira Matsuda
5bed37779a "SSL everywhere" for GitHub URLs
see: https://github.com/blog/738-sidejack-prevention-phase-2-ssl-everywhere
2011-03-07 05:56:02 +09:00
Akira Matsuda
112c802579 s/a/an/ 2011-03-07 05:52:47 +09:00
Akira Matsuda
d91be36598 fix typos 2011-03-07 05:21:25 +09:00
Xavier Noria
3a621e7be4 removes merge conflicts 2011-03-06 20:34:56 +01:00
Jon Leighton
d02c326a8b Refactor ThroughAssociation#tables to just be a flat array of tables in the order that they should be joined together. 2011-03-06 18:14:39 +00:00
Xavier Noria
89d825d021 Merge branch 'master' of git://github.com/lifo/docrails 2011-03-06 17:52:30 +01:00
Xavier Noria
6ce844a3c1 removes Examples headers introduced in 9b96de6
Example headers are discouraged in the API guidelines.
Code just flows with the text. They may be good in
places where there's a lot of stuff and structure may
add clarity
2011-03-06 17:49:39 +01:00
Xavier Noria
8bbc5b4f5f Revert "Fixed identation in actionmailer base_test"
Please excuse the revert. Albeit the commit is totally
innocent, docrails has a strong no-code policy we need
to enforce. Please feel free to submit the fix as a
patch and assign it to me, I'll apply right away.

This reverts commit d8462510c5.
2011-03-06 17:42:42 +01:00
Andrew White
5e7ce47fb9 Report the correct value of nil.id in the exception message
as different ruby implementations may have different values,
for example Rubinius returns 53 for nil.id.

[#6444 state:resolved]
2011-03-06 15:23:31 +00:00
Andrew White
31f09f9dbc Improve testing of cookies in functional tests:
- cookies can be set using string or symbol keys
- cookies are preserved across calls to get, post, etc.
- cookie names and values are escaped
- cookies can be cleared using @request.cookies.clear

[#6272 state:resolved]
2011-03-06 12:49:44 +00:00
suchasurge
b99fb66fb7 more style changes 2011-03-06 10:44:52 +01:00
suchasurge
9b96de6f3d Some style changes 2011-03-06 10:26:24 +01:00
JudeArasu
ac59a2a1d6 style changes 2011-03-06 12:55:56 +05:30
JudeArasu
2cd3dcabe2 Revert "style changes"
This reverts commit 1d4826937e.
2011-03-06 12:53:23 +05:30
Andrew White
e00867bc43 Raise ArgumentError if route name is invalid [#6517 state:resolved] 2011-03-06 07:08:50 +00:00
JudeArasu
1d4826937e style changes 2011-03-06 11:38:18 +05:30
Alexander Uvarov
0509bf35f1 Allow model to be inherited from Hash [#6487 state:resolved]
Signed-off-by: Andrew White <andyw@pixeltrix.co.uk>
2011-03-06 05:28:35 +00:00
JudeArasu
e80db417ed styles applied for usage 2011-03-06 10:53:44 +05:30
Diego Carrion
dff73dec22 added failing test for fields_for with a record object that inherits from Hash
Signed-off-by: Andrew White <andyw@pixeltrix.co.uk>
2011-03-06 05:18:56 +00:00
Aaron Patterson
09d3e89cf0 use sort_by instead of sort() 2011-03-05 20:01:06 -08:00
Dalibor Nasevic
d8462510c5 Fixed identation in actionmailer base_test 2011-03-06 00:27:37 +01:00
Jon Leighton
28ed10d3f2 Merge branch 'master' into nested_has_many_through
Conflicts:
	activerecord/CHANGELOG
2011-03-05 22:58:48 +00:00
Jon Leighton
b7f1b3641a Use Base#type_condition in JoinAssociation 2011-03-05 22:32:49 +00:00
Jon Leighton
7fddb94262 Push source_type and polymorphic conditions out of ThroughAssociation and JoinDependency::JoinAssociation and into the reflection instead. 2011-03-05 22:07:30 +00:00
Jon Leighton
ddf83d14f1 Add a test for STI on the through where the through is nested, and change the code which support this 2011-03-05 20:10:24 +00:00
Aaron Patterson
74818a3543 use Arel::Table#alias rather than passing the :as parameter 2011-03-05 11:56:24 -08:00
Akira Matsuda
22faa2c86d wrong SQL statement 2011-03-06 03:29:23 +09:00
Xavier Noria
9092052cb0 merges rails 2011-03-05 12:06:43 +01:00
Xavier Noria
2076817629 revises the RDoc of Hash#reverse_merge 2011-03-05 11:57:32 +01:00
Xavier Noria
f6a5449d43 copy-edits 819762c
* simplifies some sentences
* use a more neutral language with less you/yours
2011-03-05 11:57:32 +01:00
Xavier Noria
5f99a899a8 copy-edits 108561f 2011-03-05 11:57:32 +01:00
JudeArasu
b12a4a9296 typo changes 2011-03-05 11:57:32 +01:00
R.T. Lechow
737abe4b4d Railties typos. 2011-03-05 11:56:35 +01:00
R.T. Lechow
87e9e3f9af Action Pack typos. 2011-03-05 11:56:35 +01:00
R.T. Lechow
a1b4d8e7b2 Active Record typos. 2011-03-05 11:56:34 +01:00
R.T. Lechow
273700cbd0 Active Support typos. 2011-03-05 11:56:34 +01:00
R.T. Lechow
48841dd6ae Active Resource typos. 2011-03-05 11:56:34 +01:00
R.T. Lechow
86c15d8b89 Active Model typos. 2011-03-05 11:56:34 +01:00
tashian
e95b965926 Properly escaped a + in the dynamic segments TIP 2011-03-05 11:56:33 +01:00
Jonathon D. Jones
3eca9d5b43 Adds link to Object.blank? from Object.present? 2011-03-05 11:56:33 +01:00
mjy
045ca30394 fixes a missmatched column in example 2011-03-05 11:56:33 +01:00
JudeArasu
d735672aa5 Spelling mistake 2011-03-05 11:56:33 +01:00
Dalibor Nasevic
3457db712e Correct spelling for Base64 in action_mailer 2011-03-05 11:56:33 +01:00
Dalibor Nasevic
3673a6981e Removed link to un-existing Issues page on Github 2011-03-05 11:56:33 +01:00
Lars Smit
9b01284c3e Added some new advice on applying patches 2011-03-05 11:56:32 +01:00
Ben Orenstein
67af97c4c1 Fix incorrect example. 2011-03-05 11:56:32 +01:00
Ben Orenstein
ea6a2b7c11 Fix incorrect word. 2011-03-05 11:56:32 +01:00
Rodrigo Navarro
3f97f056f9 Pointing out that dynamic_form plugin must be installed to be able to use error_messages and error_messages_for view helpers. 2011-03-05 11:56:32 +01:00
Ben Orenstein
eef713dd66 Clean up wording. 2011-03-05 11:56:31 +01:00
Vijay Dev
e15973ce7c use resources in place of map.resources 2011-03-05 11:56:31 +01:00
Ben Orenstein
f305c60816 Clarify comment by removing french reference ('a la'). Should improve readability for non-native english speakers. 2011-03-05 11:56:31 +01:00
Ben Orenstein
ac4c5e9722 Example descriptions and their examples were flipped. Fix. 2011-03-05 11:56:31 +01:00
Ben Orenstein
8f526b30f4 Warn people that these methods are deprecated. 2011-03-05 11:56:31 +01:00
Ben Orenstein
4c27ad0c23 Correct example that did not do what it claimed. Rework explanation. 2011-03-05 11:56:30 +01:00
Ilya Zayats
feec2250bb added information about TEST_DIR env variable 2011-03-05 11:56:30 +01:00
JudeArasu
34f5628a07 commas to set off expressions that interrupt sentence flow 2011-03-05 06:19:17 +05:30
JudeArasu
3463247da5 typo changes 2011-03-05 06:10:35 +05:30
JudeArasu
a48f46d4fc typo changes 2011-03-05 06:08:21 +05:30
Xavier Noria
3b10b8a201 implements ActiveRecord::Base.connection_config to be able to check the configuration of the current connection at runtime 2011-03-05 01:35:02 +01:00
Santiago Pastorino
28f1c21b50 Fix CI 2011-03-04 21:38:38 -02:00
Jon Leighton
8987cda2bb When preloading has_and_belongs_to_many associations, we should only instantiate one AR object per actual record in the database. (Even when IM is off.) 2011-03-04 15:16:07 -08:00
Jon Leighton
af27262ec3 Fix a couple of tests in join_model_test.rb which were failing when the identity map is turned off 2011-03-04 14:49:19 -08:00
Jon Leighton
4206eff189 Stop identity-mapping the through records in the preloader since I fixed the underlying problem in the habtm preloader. 2011-03-04 22:36:44 +00:00
Jon Leighton
b5b5558d2f Fix a couple of tests in join_model_test.rb which were failing when the identity map is turned off 2011-03-04 22:35:46 +00:00
Jon Leighton
73c0b390b3 When preloading has_and_belongs_to_many associations, we should only instantiate one AR object per actual record in the database. (Even when IM is off.) 2011-03-04 22:33:16 +00:00
Santiago Pastorino
056f05adcd Make CI test with and without IM 2011-03-04 19:03:47 -02:00
Jon Leighton
a5ef8b9fa0 Merge branch 'master' into nested_has_many_through 2011-03-04 20:36:11 +00:00
Diego Carrion
1f47061b48 reverted tests deleted by 080345baca, refactored implementations should not invalidate the validations
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-04 18:07:48 -02:00
Diego Carrion
7872cc992b refactored Time#<=> and DateTime#<=> by removing unnecessary calls without losing performance
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-04 16:50:24 -02:00
Alexander Uvarov
0db915efd1 Add an option to FormBuilder to omit hidden field with id
[#4551 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-04 16:38:08 -02:00
José Valim
f00a398456 log and readme should respect --quiet 2011-03-04 13:05:27 +01:00
Jon Leighton
735844db71 Merge branch 'master' into nested_has_many_through
Conflicts:
	activerecord/CHANGELOG
	activerecord/lib/active_record/association_preload.rb
	activerecord/lib/active_record/associations.rb
	activerecord/lib/active_record/associations/class_methods/join_dependency.rb
	activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb
	activerecord/lib/active_record/associations/has_many_association.rb
	activerecord/lib/active_record/associations/has_many_through_association.rb
	activerecord/lib/active_record/associations/has_one_association.rb
	activerecord/lib/active_record/associations/has_one_through_association.rb
	activerecord/lib/active_record/associations/through_association_scope.rb
	activerecord/lib/active_record/reflection.rb
	activerecord/test/cases/associations/has_many_through_associations_test.rb
	activerecord/test/cases/associations/has_one_through_associations_test.rb
	activerecord/test/cases/reflection_test.rb
	activerecord/test/cases/relations_test.rb
	activerecord/test/fixtures/memberships.yml
	activerecord/test/models/categorization.rb
	activerecord/test/models/category.rb
	activerecord/test/models/member.rb
	activerecord/test/models/reference.rb
	activerecord/test/models/tagging.rb
2011-03-04 09:30:27 +00:00
R.T. Lechow
c8dae23a2a Railties typos. 2011-03-04 01:01:50 -05:00
R.T. Lechow
12325cf970 Action Pack typos. 2011-03-04 01:01:48 -05:00
R.T. Lechow
238e6f0c6e Active Record typos. 2011-03-04 01:01:45 -05:00
R.T. Lechow
80e3beb24b Active Support typos. 2011-03-04 01:01:42 -05:00
R.T. Lechow
103c297ab3 Active Resource typos. 2011-03-04 01:01:39 -05:00
R.T. Lechow
fbed63aef0 Active Model typos. 2011-03-04 01:01:36 -05:00
John Mileham
d5994ee48a Change behavior of count(:limit => x, :offset => y) to limit/offset before counting. 2011-03-03 23:26:45 -05:00
Jonathon D. Jones
fcade9f4d2 Merge remote branch 'origin/master' 2011-03-03 18:11:01 -05:00
Jonathon D. Jones
108561f1cb Adds link to Object.blank? from Object.present? 2011-03-03 18:10:33 -05:00
tashian
f44e0e8271 Properly escaped a + in the dynamic segments TIP 2011-03-03 15:04:39 -08:00
mjy
3b7cf23417 fixes a missmatched column in example 2011-03-03 13:28:26 -05:00
JudeArasu
b4b7171d60 Spelling mistake 2011-03-03 23:20:28 +05:30
Dalibor Nasevic
80c0b00ba6 Correct spelling for Base64 in action_mailer 2011-03-03 01:03:25 +01:00
Aaron Patterson
1db4969dc9 only compute path.to_s once 2011-03-02 15:17:29 -08:00
Aaron Patterson
dc89e29f49 remove to_s implementation so that inspect is helpful 2011-03-02 15:17:13 -08:00
Aaron Patterson
b247c8d71a * LocalCache strategy is now a real middleware class, not an anonymous class
posing for pictures.
2011-03-02 14:05:06 -08:00
Dalibor Nasevic
b7cf1f4ccf No need of instance variable
[#6502 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-02 18:01:26 -02:00
Aaron Patterson
272ede9b9a require deprecation so that we can deprecate methods! 2011-03-02 10:42:43 -08:00
Aaron Patterson
72405efe64 anonymous classes have blank names on ruby 1.8 2011-03-02 10:23:04 -08:00
Aaron Patterson
1f2e7214aa make sure string keys are always looked up from the class cache 2011-03-02 10:11:28 -08:00
Aaron Patterson
9198372421 Ruby 1.8: Y U NO FUN? 2011-03-02 09:43:27 -08:00
Aaron Patterson
dd41387f34 use newer class cache api 2011-03-02 09:35:10 -08:00
Aaron Patterson
69e348013b adding deprecation noticies to deprecated class cache methods 2011-03-02 09:31:40 -08:00
Aaron Patterson
66245441d4 adding backwards compat for class cache references. <3<3 2011-03-02 09:18:05 -08:00
Cheah Chu Yeow
2ee5555744 Fix Action caching bug where an action that has a non-cacheable response always renders a nil response body. It now correctly renders the response body.
Note that only GET and HTTP 200 responses can be cached.

[#6480 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-02 13:11:07 -02:00
Dalibor Nasevic
e4cf28f3a0 Fixed typos in asset_host_test
[#6501 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-02 12:48:33 -02:00
Aaron Patterson
f345e2380c yo dawg, directly use the class cache rather than the cache of the cache 2011-03-01 17:43:45 -08:00
Aaron Patterson
7b6bfe84f3 refactor Reference to a ClassCache object, fix lazy lookup in Middleware so that anonymous classes are supported 2011-03-01 17:20:35 -08:00
Aaron Patterson
50ed1a25a4 initialize ivars 2011-03-01 17:20:35 -08:00
Alexander Uvarov
24faddd60c Move ActiveModel::AttributeMethods#attribute_methods_generated? to ActiveRecord, so it's flexible now
[#6428 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2011-03-01 20:22:45 +01:00
Aaron Patterson
fd26afc93b Enumerable gives us include?, so remove include? 2011-03-01 10:21:44 -08:00
Aaron Patterson
648fd60ecf prefer composition over inheritance with AD::MS 2011-03-01 10:14:09 -08:00
Aaron Patterson
e477fc1147 fixing test case test on 1.9.3dev 2011-03-01 10:14:09 -08:00
Sam Elliott
9cf3b1f671 Remove warnings about redefined test methods
[#6490 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-01 12:39:04 -02:00
Aaron Patterson
46bb424287 Revert "compute ext in initialize, and use an attr_reader"
This reverts commit 2dbb73bdda.

Conflicts:

	actionpack/lib/action_dispatch/middleware/static.rb
2011-02-28 19:47:09 -08:00
Aaron Patterson
f279422e33 no need to pass a regex to Regexp.compile 2011-02-28 18:03:06 -08:00
Aaron Patterson
2dbb73bdda compute ext in initialize, and use an attr_reader 2011-02-28 17:54:00 -08:00
Aaron Patterson
c563f71e53 Merge branch 'fuuu'
* fuuu:
  Move JoinDependency and friends from ActiveRecord::Associations::ClassMethods to just ActiveRecord::Associations
  Rewrote AssociationPreload.
2011-02-28 17:13:39 -08:00
Aaron Patterson
54fdd33f33 use a subclass of AS::TZ for testing html output 2011-02-28 16:30:14 -08:00
Dalibor Nasevic
4c9626664f Removed link to un-existing Issues page on Github 2011-03-01 01:16:30 +01:00
Aaron Patterson
19c763f783 reduce two method calls per request, 1 to method_missing and one to send 2011-02-28 15:47:25 -08:00
Jon Leighton
b171b9e73d Move JoinDependency and friends from ActiveRecord::Associations::ClassMethods to just ActiveRecord::Associations 2011-02-28 22:12:43 +00:00
Jon Leighton
d90b4e2615 Rewrote AssociationPreload. 2011-02-28 22:12:34 +00:00
Josh Kalderimis
7112cf5e02 Updated the AS guides with some information on the difference between Date.today and Date.current. 2011-02-28 14:05:49 -08:00
Josh Kalderimis
0f8d2794f2 updated Time, Date and DateTime current methods in AS to use Time.zone and not Time.zone_default.
[#6410 state:committed]
2011-02-28 14:05:49 -08:00
Xavier Noria
de9713186d revises a few details in public/index.html 2011-02-28 20:03:40 +01:00
Ben Orenstein
726599df98 Remove redundant to_sym call.
[#6483 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-28 16:43:12 -02:00
Aaron Patterson
a8dae084c9 skip this on oracle 2011-02-28 09:15:19 -08:00
Oriol Gual and Josep M. Bach
f42562f97b Make ActiveSupport::Configurable work with modules
[#6486 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-28 13:30:32 -02:00
Diego Carrion
a0629927b2 added activesupport/test/tmp to gitignore
[#6484 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-28 13:14:16 -02:00
Santiago Pastorino
53b17e9ad0 javascript_include_tag shouldn't raise if you register an expansion key with nil value 2011-02-28 11:52:00 -02:00
Santiago Pastorino
801e314006 Add tests for register expansion methods with key = [] 2011-02-28 11:30:12 -02:00
Lars Smit
819762c90f Added some new advice on applying patches 2011-02-28 12:17:26 +01:00
Ben Orenstein
b95f8be594 Fix incorrect example. 2011-02-27 20:22:55 -05:00
Santiago Pastorino
a00bed0c48 Revert "Properly interpolate i18n keys in modules [#5572 state:resolved]"
This breaks #6448, you should use :"module/class" as key for namespacing
[#6448 state:committed]

This reverts commit 8d30193b08.
2011-02-27 21:30:03 -02:00
Santiago Pastorino
acf0688fdd failing test for i18n key collision with namespaced models 2011-02-27 21:23:52 -02:00
Ben Orenstein
9bbbae06c5 Fix incorrect word. 2011-02-27 18:17:06 -05:00
Jeff Kreeftmeijer
86ad8a6c87 Make sure the Thor generator LoadError does not output --dev twice [#6431 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-27 18:53:18 -02:00
Rodrigo Navarro
6ff10c17aa Pointing out that dynamic_form plugin must be installed to be able to use error_messages and error_messages_for view helpers. 2011-02-27 10:03:50 -08:00
Ben Orenstein
9b35eeec62 Clean up wording. 2011-02-26 19:07:41 -05:00
Aaron Patterson
f3e9cbc695 use an attribute rather than a SQL literal 2011-02-26 16:05:15 -08:00
Vijay Dev
72ae724485 use resources in place of map.resources 2011-02-27 02:14:30 +05:30
Ben Orenstein
8f13a166ce Clarify comment by removing french reference ('a la'). Should improve readability for non-native english speakers. 2011-02-26 14:29:22 -05:00
Ben Orenstein
e872a8f2a5 Example descriptions and their examples were flipped. Fix. 2011-02-26 13:36:47 -05:00
Ben Orenstein
e331ec0952 Warn people that these methods are deprecated. 2011-02-26 13:28:40 -05:00
Ben Orenstein
8270dcd12e Correct example that did not do what it claimed. Rework explanation. 2011-02-26 12:59:27 -05:00
Ilya Zayats
6de3f1fb4e added information about TEST_DIR env variable 2011-02-26 07:49:50 +03:00
Aaron Patterson
54a2bf6601 removing limits and offsets from COUNT queries unless both are specified. [#6268 state:resolved] 2011-02-25 15:38:59 -08:00
Aaron Patterson
8fc54a2e81 only take the limit if there is a limit to take 2011-02-25 14:24:05 -08:00
Xavier Noria
2e60b00788 Merge branch 'master' of git://github.com/lifo/docrails 2011-02-25 20:53:55 +01:00
Prem Sichanugrist
515ea955b6 Always use ActionDispatch::ShowExceptions middleware [#6462 state:resolved]
This will make sure the application will raise `ActionController::RoutingError` in case "X-Cascade: pass" header was set, usually when there's no route match.
2011-02-25 10:03:53 -08:00
Prem Sichanugrist
439a74520d Make sure that we set env["action_dispatch.show_exceptions"]
This has been used by `show_exception` middleware even the setting wasn't get passed to `env` hash.
2011-02-25 10:03:40 -08:00
Vijay Dev
287bb6990c standardize all shell commands with the $ prefix 2011-02-25 02:59:37 +05:30
Eric Allam
13547c16d9 fixes: ActiveRecord::Base.scopes includes all scopes defined in all subclasses 2011-02-24 11:17:06 -08:00
Josep M. Bach
55105c4318 Fix missing inheritance from AR::Base in docs 2011-02-24 10:00:09 +01:00
Aaron Patterson
5f1fc0c8ac observers leak across tests, so rather than modify the object, we should just count the number of times the observer was called 2011-02-23 16:04:01 -08:00
Vinicius Baggio
e8a578224f Removing redundant File.expand_path from generators test
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-02-23 19:42:51 +01:00
Rodrigo Navarro
0b2412978f Fixing wrong class name. 2011-02-23 10:23:01 -08:00
Rodrigo Navarro
29399e00c9 ActiveModel::Validator#validate must receive have a record parameter. 2011-02-23 10:22:03 -08:00
Kamal Fariz Mahyuddin
6ba8caf3ee Fix observer callbacks firing multiple times on descendant instances 2011-02-22 16:25:19 -08:00
José Valim
3265bbb659 Fix tests on 1.8. 2011-02-22 22:51:02 +01:00
Prem Sichanugrist
839d06f5f2 We're in 2011, let's update our license
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-22 18:24:20 -02:00
Michael Koziarski
3d907a68d9 Prepend the CSRF filter to make it much more difficult to execute application code before it fires. 2011-02-23 09:00:41 +13:00
Aaron Patterson
2cce44fa7c expectations change when using IM. Change oracle tests to reflect that 2011-02-22 11:27:12 -08:00
Aaron Patterson
4bd8d2607c Relation will delegate to AR::Base which already uses the Dynamic finders, so eliminate duplicate calls 2011-02-22 11:07:51 -08:00
Xavier Noria
f8cfa454e5 Merge branch 'master' of git://github.com/lifo/docrails 2011-02-22 19:06:29 +01:00
Mateus Paixão
20f2785849 alteracao de HTML para HTTP 2011-02-22 10:37:59 -03:00
Aaron Patterson
b3fcabb3a5 adding a test case for custom locking 2011-02-21 16:12:02 -08:00
Mani Tadayon
14263fa74e Merge branch 'master' of github.com:lifo/docrails 2011-02-21 13:46:19 -08:00
Mani Tadayon
ae78e462bc Fix typo in i18n guide: 'explicitely' 2011-02-21 13:45:21 -08:00
Xavier Noria
0d41fa9562 copy-edits 8d96b89 2011-02-21 13:44:20 -08:00
Xavier Noria
5e69debd7a copy-edits 6d7a826 2011-02-21 13:44:20 -08:00
Xavier Noria
fa38214641 copy-edits 34316d8 2011-02-21 13:44:20 -08:00
Nicholas Rowe
1700329526 Docs: Update to_xml documentation to match as_json docuemntation 2011-02-21 13:44:20 -08:00
Rodrigo Navarro
26a50689c9 Adding new examples for update_all method 2011-02-21 13:44:20 -08:00
Rodrigo Navarro
b39766fda5 Adding examples 2011-02-21 13:44:20 -08:00
Andy Lindeman
2b6845b1ef Specifying :partial is required when passing additional options such as :layout 2011-02-21 13:44:20 -08:00
Vijay Dev
406f7ebe69 cleans up PS1. Sorry lifo :) 2011-02-21 13:44:20 -08:00
Vijay Dev
c86cdea1b8 minor rephrasing 2011-02-21 13:44:19 -08:00
Nicholas Rowe
fab5fe7f60 Documentation: Added small comments to Observering module 2011-02-21 13:44:19 -08:00
Nicholas Rowe
746a412055 Tpyo: fixing several cases of the the 2011-02-21 13:44:19 -08:00
Nicholas Rowe
2a816db446 Typo: fixing the the 2011-02-21 13:44:19 -08:00
Ben Orenstein
2394ad69a4 Edit a few lines for readability. 2011-02-21 13:44:19 -08:00
Brandon Tilley
1e2ecc4d6f Add info about I18n::Backend::Chain to I18n guide 2011-02-21 13:44:19 -08:00
Vijay Dev
9345e9cca2 session is reset on token mismatch 2011-02-21 13:44:19 -08:00
Ben Orenstein
308328fd7f Add a forgotten word. 2011-02-21 13:44:19 -08:00
Ben Orenstein
a40b7159d9 Improve clarity of example. Make it follow guidelines for output display. 2011-02-21 13:44:18 -08:00
Ben Orenstein
797af0faa5 Add a clearer example for with_options (lifted from the Active Support guide). 2011-02-21 13:44:18 -08:00
Jimmy Cuadra
74b44dfb86 improve language and examples in Railtie docs 2011-02-21 13:44:18 -08:00
Peer Allan
8f17a81cbd Clarification of ActiveRecord ActiveModel validation documentation 2011-02-21 13:44:18 -08:00
Aaron Patterson
442f8dbc69 Gem.cache is going to be deprecated, use source_index instead 2011-02-21 13:27:10 -08:00
Jon Leighton
52f8e4b9da Use proper objects to do the work to build the associations (adding methods, callbacks etc) rather than calling a whole bunch of methods with rather long names. 2011-02-21 10:16:15 -08:00
Jon Leighton
a5274bb52c Rename target_klass to klass 2011-02-21 10:16:14 -08:00
Jon Leighton
8b00da5258 Delegate through_reflection and source_reflection to reflection 2011-02-21 10:16:14 -08:00
Jon Leighton
32eef69dc1 Delegate Association#options to the reflection, and replace 'reflection.options' with 'options'. Also add through_options and source_options methods for through associations. 2011-02-21 10:16:14 -08:00
Jon Leighton
73ff0076b3 Singular associations no longer use a proxy, so no need to check for the proxy type on assignment. 2011-02-21 10:16:14 -08:00
Jon Leighton
1d85a73ceb Associations - where possible, call attributes methods rather than directly accessing the instance variables 2011-02-21 10:16:14 -08:00
Xavier Noria
f826e05835 Merge branch 'master' of git://github.com/lifo/docrails 2011-02-21 11:42:26 +01:00
Xavier Noria
b481574a33 copy-edits 8d96b89 2011-02-21 11:37:08 +01:00
Xavier Noria
9297027e08 copy-edits 6d7a826 2011-02-21 11:01:26 +01:00
Xavier Noria
843a5b9a3a copy-edits 34316d8 2011-02-21 11:00:03 +01:00
Mark Turner
cd12c36996 Added .rvmrc to gitignore 2011-02-21 17:19:13 +08:00
Nicholas Rowe
34316d8b7e Docs: Update to_xml documentation to match as_json docuemntation 2011-02-20 21:35:43 -05:00
Nicholas Rowe
b014f822e5 Merge branch 'master' of github.com:lifo/docrails 2011-02-20 21:06:03 -05:00
Nicholas Rowe
6d7a8267b9 Documentation: Added small comments to Observering module 2011-02-20 21:05:41 -05:00
Rodrigo Navarro
62fd334684 Adding new examples for update_all method 2011-02-20 22:22:52 -03:00
Rodrigo Navarro
4da0157aaf Adding examples 2011-02-20 22:03:29 -03:00
Andy Lindeman
bdf83b7dc3 Specifying :partial is required when passing additional options such as :layout 2011-02-20 13:52:41 -06:00
Vijay Dev
7d12f53e85 cleans up PS1. Sorry lifo :) 2011-02-20 21:37:39 +05:30
Vijay Dev
35cb9b7f33 minor rephrasing 2011-02-20 21:31:12 +05:30
Xavier Noria
6c30530b00 adds Range#cover? to the CHANGELOG 2011-02-20 11:01:07 +01:00
Xavier Noria
e2d54fb3f1 documents the backported Range#cover?, and related stuff 2011-02-20 10:52:49 +01:00
wycats
e984fd43d5 Allow tests to proceed as soon as the payload changes, instead of always having to wait for a timeout 2011-02-20 01:39:25 -08:00
wycats
89e6b19356 Add tests for an FSSM backend for the file system watcher using the FSSM polling support. 2011-02-20 01:10:34 -08:00
Nicholas Rowe
2a75c190d4 Tpyo: fixing several cases of the the 2011-02-19 23:47:12 -05:00
Nicholas Rowe
89b3bc4807 Typo: fixing the the 2011-02-19 23:46:30 -05:00
Diego Carrion
511bf2a050 refactored ActiveModel::Validations::InclusionValidator#validate_each
[#6455 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-19 23:24:38 -02:00
Diego Carrion
b0da0dd834 added Range#count? for Ruby 1.8
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-19 23:24:30 -02:00
Ben Orenstein
6052929e88 Edit a few lines for readability. 2011-02-19 18:07:07 -05:00
Brandon Tilley
fe5c2c2d21 Add info about I18n::Backend::Chain to I18n guide 2011-02-19 14:49:42 -08:00
Vijay Dev
7e8b075f73 session is reset on token mismatch 2011-02-20 01:18:03 +05:30
Ben Orenstein
cff0aebbc4 Add a forgotten word. 2011-02-19 13:04:22 -05:00
Ben Orenstein
262dd965df Improve clarity of example. Make it follow guidelines for output display. 2011-02-19 12:57:06 -05:00
Ben Orenstein
b3e5e25829 Add a clearer example for with_options (lifted from the Active Support guide). 2011-02-19 12:15:51 -05:00
Jimmy Cuadra
8af066b166 improve language and examples in Railtie docs 2011-02-18 22:20:04 -08:00
Peer Allan
8d96b89110 Clarification of ActiveRecord ActiveModel validation documentation 2011-02-18 20:51:56 -06:00
Aaron Patterson
289cc15f1a instance_methods includes public and protected, so reduce funcalls and object allocs 2011-02-18 17:32:08 -08:00
Aaron Patterson
8657826f41 oops, no need for puts! 2011-02-18 15:53:54 -08:00
Aaron Patterson
30679bc705 AR::AttributeMethods does not need to be included in an AR::Base class. 2011-02-18 15:51:39 -08:00
Xavier Noria
ce76cfc61f fixes a merge conflict 2011-02-19 00:42:51 +01:00
Emilio Tagua
18439e28e0 We really don't care about IM middleware order, the important is that it gets included. 2011-02-18 14:57:29 -08:00
Xavier Noria
f41bf6938f merges docrails 2011-02-18 23:22:15 +01:00
Xavier Noria
220cb107b6 removes indent from guides example 2011-02-18 23:13:29 +01:00
Xavier Noria
7c52da44ed Revert "Created a new Troubleshooting section in the migrations guide."
Mismatches between migrations and constants have nothing to do with
pluralization rules or model names. The mismatch happens between
the camelization of the filename minus timestamp, and the name of
the migration class itself.

This reverts commit 1c21f75f1b.
2011-02-18 23:03:54 +01:00
Xavier Noria
2acb5e348d removes unrealistic example (authentication plus gender?), that it is not needed anyway 2011-02-18 22:54:02 +01:00
Frederick Cheung
fbfa30a1ee Change validates inclusion to use cover? for Ranges in ruby 1.9 [#6453 state:committed]
Signed-off-by: Xavier Noria <fxn@hashref.com>
2011-02-18 21:32:28 +01:00
Nicholas Rowe
ad3e4e3af6 Clarify Example in ActiveRecord base 2011-02-18 14:43:53 -05:00
Emilio Tagua
00418ac96b Merge remote branch 'rails/master' into identity_map 2011-02-18 16:22:50 -03:00
Emilio Tagua
3927827dbe Don't use skip, just don't run anything, we don't have skip in Ruby 1.8 2011-02-18 16:20:15 -03:00
Emilio Tagua
3e5efb3708 Remove nbproject form gitignore. This shouldn't be here in the first place. 2011-02-18 16:07:58 -03:00
Emilio Tagua
d9eb007edf WeakHash is not used, remove it. 2011-02-18 16:05:24 -03:00
Emilio Tagua
8052623a3d No need to have reinit_with inside an InstanceMethods module. 2011-02-18 16:04:47 -03:00
Emilio Tagua
49f3525f19 Initialize @target instead asking if it is defined. 2011-02-18 15:55:55 -03:00
Jon Leighton
6975a41adf Remove test which was broken on 1.8. This test is now irrelevant since singular associations no longer return a proxy object. 2011-02-18 18:50:35 +00:00
Aaron Patterson
2e748feb80 just use the list of column names to generate attribute methods 2011-02-18 10:47:19 -08:00
Emilio Tagua
eb23b2247d Should use "=" instead "replace" after this commit: 1644663ba7 2011-02-18 15:44:23 -03:00
Emilio Tagua
d21a454327 No need to test agaisnt target. 2011-02-18 15:40:48 -03:00
Emilio Tagua
356086944d Reindent and remove wrong line left in merge by mistake. 2011-02-18 15:40:06 -03:00
Emilio Tagua
b8c2feb97e Use to_a instead :load in test, since :load changed. 2011-02-18 15:38:17 -03:00
Emilio Tagua
15a03ca9b0 No need to test against target anymore. 2011-02-18 15:38:00 -03:00
Emilio Tagua
0b702ba3de Merge remote branch 'rails/master' into identity_map
Conflicts:
	activerecord/lib/active_record/associations/association.rb
	activerecord/lib/active_record/fixtures.rb
2011-02-18 15:29:33 -03:00
Nicholas Rowe
7d9a80be93 Remove awkward phrasing from Ajax on Rails guide 2011-02-17 20:49:25 -05:00
Nicholas Rowe
9a9d895481 Fix Typos: remove several occurences of the the 2011-02-17 20:46:52 -05:00
Nicholas Rowe
a906deabc6 fix type: remove extra period 2011-02-17 20:34:22 -05:00
Kedar Mhaswade
1c21f75f1b Created a new Troubleshooting section in the migrations guide.
Added a bullet point there showing how the Uninitialized Constant
(missing migration class) error looks like.
2011-02-17 16:27:01 -08:00
Jon Leighton
1644663ba7 Split AssociationProxy into an Association class (and subclasses) which manages the association, and a CollectionProxy class which is *only* a proxy. Singular associations no longer have a proxy. See CHANGELOG for more. 2011-02-18 00:00:13 +00:00
Jon Leighton
1d9f26ed47 Add :nodoc: to ThroughAssociation and HasOneAssociation 2011-02-18 00:00:13 +00:00
Jon Leighton
91fd651056 Allow building and then later saving has_many :through records, such that the join record is automatically saved too. This requires the :inverse_of option to be set on the source association in the join model. See the CHANGELOG for details. [#4329 state:resolved] 2011-02-18 00:00:13 +00:00
Jon Leighton
f0b9805029 Ensure that association_ids uses the correct attribute where the association is a has_many :through with a :primary_key option on the source reflection. [#6376 state:resolved] 2011-02-18 00:00:13 +00:00
genlinux
23a5be74ce commas to set off expressions that interrupt sentence flow 2011-02-17 22:40:58 +05:30
Ben Orenstein
b131cfba05 Remove unused line in test setup.
[#6442 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-17 14:38:51 -02:00
Brian Durand
017012b43a Add description of transaction callbacks to ActiveRecord callbacks guide. 2011-02-17 10:18:56 -06:00
Brian Durand
fead0fc448 update caching guide with the changes to ActiveSupport::Cache from the 3.0.0 release. 2011-02-17 10:14:22 -06:00
Vijay Dev
465dd379e4 fix typo 2011-02-17 17:19:51 +05:30
Vijay Dev
ed630dfc72 fix typo 2011-02-17 16:59:03 +05:30
Aaron Patterson
9c023cc4d2 explicitly allowing lolqueries 2011-02-16 15:11:48 -08:00
Jimmy Cuadra
bd7d8665a0 add note about observer config for rails apps
ActiveModel::Observer and ActiveRecord::Observer have similar
documentation, but a Rails user looking at the ActiveModel version
might not realize that a change to config/application.rb is
required to activate the observer. This change adds a note to
that effect, pointing to the AR version from the AM version.
2011-02-16 14:15:48 -08:00
Aaron Patterson
ceb2f0f216 use the arel table rather than generating strings 2011-02-16 11:46:55 -08:00
Aaron Patterson
1dea7b5a61 no need for Array.wrap 2011-02-16 11:22:30 -08:00
Aaron Patterson
2e2e58a6a3 fixing whitespace problems 2011-02-16 11:08:01 -08:00
Steven Fenigstein
9b188c5bfe removed an unnecessary second query when passing an ActiveRecord::Relation to a where clause. And added ability to use subselects in where clauses. 2011-02-16 09:54:09 -08:00
Timothy N. Tsvetkov
c6fac7b449 Fixed issue #6363, avoid to pluralized already pluralized names and singularize a single in generators, for example stadia is a valid plural for stadium. But calling pluralize for stadia will return stadias which sematically is not corrent in this case
[#6363 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-16 15:09:06 -02:00
Dan Pickett
1754bd9b20 handle double pluralization for irregular plurals
[#6363]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-16 15:08:25 -02:00
Ben Orenstein
2eed9286ce Remove unused code.
[#6437 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-16 13:20:04 -02:00
Aaron Patterson
8276a24020 fixture methods can be overridden and super() is useful 2011-02-15 15:52:27 -08:00
Aaron Patterson
8c4c07e4cb fixing variable names to reflect reality 2011-02-15 15:35:10 -08:00
Aaron Patterson
13e72db770 this is in the AR namespace, so AR must exist 2011-02-15 15:05:52 -08:00
Joel Nimety
ef57334210 GcTime incorrectly checks GC.respond_to?(:total_time), it should check GC::Profiler.respond_to?(:total_time)
[#6435 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-15 20:13:06 -02:00
Xavier Noria
5444ed56ab Revert "Fix error: docrails is a fork, not a branch."
Reason: Calling docrails a "branch" is fine, no need to change the terminology. It is a remote in my machine, and it has been called branch since the very beginning: http://weblog.rubyonrails.org/2008/5/2/help-improve-rails-documentation-on-git-branch

This reverts commit 35a266edfd.
2011-02-15 22:17:25 +01:00
Timothy N. Tsvetkov
09ccdc3737 Optimization for postgres adapter for add_column method. Set default and not null in one query 2011-02-15 10:52:14 -08:00
Aaron Patterson
f83218561e fixing variable names, removing FixtureFile instances from test ivars 2011-02-15 10:48:01 -08:00
Aaron Patterson
f0b1173965 removing unused variable 2011-02-15 10:07:19 -08:00
Steve Schwartz
f4ddb4da89 Added RDoc info for accepted options for simple_format in TextHelper. 2011-02-15 12:58:57 -05:00
Ben Orenstein
35a266edfd Fix error: docrails is a fork, not a branch. 2011-02-15 11:51:07 -05:00
Emilio Tagua
90a850aea4 Fix expected queries in relation tests. 2011-02-15 12:43:15 -03:00
Emilio Tagua
c13b7c4a0f Don't shadow outer local variable. 2011-02-15 12:41:57 -03:00
Emilio Tagua
f1778eb44a Run tests without IdentityMap when IM=false is given. 2011-02-15 12:40:41 -03:00
Emilio Tagua
ca75091fc7 Remove identity map from benchmark script. 2011-02-15 12:06:44 -03:00
Emilio Tagua
8ee0b44148 Merge remote branch 'rails/master' into identity_map
Conflicts:
	activerecord/examples/performance.rb
	activerecord/lib/active_record/association_preload.rb
	activerecord/lib/active_record/associations.rb
	activerecord/lib/active_record/associations/association_proxy.rb
	activerecord/lib/active_record/autosave_association.rb
	activerecord/lib/active_record/base.rb
	activerecord/lib/active_record/nested_attributes.rb
	activerecord/test/cases/relations_test.rb
2011-02-15 12:01:04 -03:00
Ken Mazaika
1bedee5631 ActiveResource validation tests did not test ActiveModel validations. Adjust the test to be done the Rails3 way.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-15 12:04:42 -02:00
Sergii Boiko
471327169d fixed broken link to postgresql docs
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-15 12:01:15 -02:00
Ben Orenstein
25e3d2caf4 Correct bad wording in description. 2011-02-14 20:41:32 -05:00
Aaron Patterson
c9f1ab5365 bad tests are bad 2011-02-14 17:10:14 -08:00
Aaron Patterson
02fc45a057 remove accidental raise! 2011-02-14 16:48:18 -08:00
Aaron Patterson
e4dac4750d removing irrelevant test 2011-02-14 16:01:47 -08:00
Aaron Patterson
fab9c2eaaa Merge branch 'fixtures'
* fixtures:
  remove unused methods
  extract database activity out of Fixtures instances
  extract rows that should be inserted to a method
  fixtures will return a list of tables that may be effected, delete existing fixtures will delete those tables
2011-02-14 14:55:25 -08:00
Aaron Patterson
f9ea47736e remove unused methods 2011-02-14 14:55:01 -08:00
Aaron Patterson
fd81c700ec extract database activity out of Fixtures instances 2011-02-14 14:53:42 -08:00
Aaron Patterson
ca05016765 extract rows that should be inserted to a method 2011-02-14 12:01:22 -08:00
Aaron Patterson
0123ceb9cd Merge remote branch 'jonleighton/association_fixes'
* jonleighton/association_fixes:
  Add a transaction wrapper in add_to_target. This means that #build will now also use a transaction. IMO this is reasonable given that the before_add and after_add callbacks might do anything, and this great consistency allows us to abstract out the duplicate code from #build and #create.
  Inline ensure_owner_is_persisted! as it is only called from one place
  @target should always be an array
  Rename add_record_to_target_with_callbacks to add_to_target
  Don't pass the block through build_record
  Move create and create! next to build
  Get rid of create_record as it is not only used in one place
  Get rid of AssociationCollection#save_record
  Fix test/cases/connection_pool_test.rb for sqlite3 in-memory db
  Add interpolation of association conditions back in, in the form of proc { ... } rather than instance_eval-ing strings
2011-02-14 11:51:56 -08:00
Aaron Patterson
2487aab99a fixtures will return a list of tables that may be effected, delete existing fixtures will delete those tables 2011-02-14 11:25:19 -08:00
Aaron Patterson
6f4e3ffd0f HabtmFixtures class is no longer needed 2011-02-14 10:07:05 -08:00
Andrew White
ccc678b49e Add test to prevent regression on namespace root nested in a resource
[#6389 state:resolved]
2011-02-14 06:12:22 +00:00
Andrew White
460a341682 Fix named route helper for routes nested inside deeply nested resources
[#6416 state:resolved]
2011-02-14 02:56:09 +00:00
Jon Leighton
b9ea751d0e Add a transaction wrapper in add_to_target. This means that #build will now also use a transaction. IMO this is reasonable given that the before_add and after_add callbacks might do anything, and this great consistency allows us to abstract out the duplicate code from #build and #create. 2011-02-14 01:40:31 +00:00
Jon Leighton
5d6d669bfe Inline ensure_owner_is_persisted! as it is only called from one place 2011-02-14 01:40:31 +00:00
Jon Leighton
c9b685e681 @target should always be an array 2011-02-14 01:40:31 +00:00
Jon Leighton
db03308451 Rename add_record_to_target_with_callbacks to add_to_target 2011-02-14 01:40:31 +00:00
Jon Leighton
641a3068ea Don't pass the block through build_record 2011-02-14 01:40:31 +00:00
Jon Leighton
686418c657 Move create and create! next to build 2011-02-14 01:40:31 +00:00
Jon Leighton
b93d2189c4 Get rid of create_record as it is not only used in one place 2011-02-14 01:40:31 +00:00
Jon Leighton
7ce7ae0c8b Get rid of AssociationCollection#save_record 2011-02-14 01:40:31 +00:00
Jon Leighton
eab5fb49f8 Fix test/cases/connection_pool_test.rb for sqlite3 in-memory db 2011-02-14 01:40:31 +00:00
Jon Leighton
a7e19b30ca Add interpolation of association conditions back in, in the form of proc { ... } rather than instance_eval-ing strings 2011-02-14 01:40:31 +00:00
Andrew White
fd7605826a Add notes on how to override the default :id constraint [#5994 state:resolved] 2011-02-14 01:01:20 +00:00
Dan Neumann
a1cc07c35e Added --sandbox option to rails console explanation. 2011-02-13 18:14:05 -06:00
Andrew White
48fe62ee57 Remove incorrect assert_recognizes example 2011-02-14 00:09:05 +00:00
Dan Neumann
f7a31ce1cd Added simple demonstration of has_many :through 2011-02-13 17:50:39 -06:00
Andrew White
af4fab7d2e Remove incorrect assert_recognizes example 2011-02-13 23:25:57 +00:00
Andrew White
385be358cf Fix assert_recognizes with block constraints [#5805 state:resolved] 2011-02-13 23:24:46 +00:00
Mike Gehard
0617d3e3c6 change plugins guide to favor gem based plugins, clean up to reflect the state of Rails3 plugins, remove information not compatible with Rails3. 2011-02-13 14:21:17 -07:00
Santiago Pastorino
9143032a10 Add missing require 2011-02-13 02:38:31 -02:00
Santiago Pastorino
944d314244 Add Date#rfc3339 and Date#iso8601 to AS 2011-02-13 02:10:13 -02:00
Ernie Miller
fbd917f50a Remove Relation#& alias for Relation#merge 2011-02-12 17:23:19 -08:00
Brian Lopez
7eb554bdb1 switch over to Mysql2::Client#ping for the mysql2 connection check 2011-02-12 16:59:13 -08:00
Santiago Pastorino
0e9c7a265f Make gem "ruby-debug19" require ruby-debug 2011-02-12 22:44:12 -02:00
Xavier Noria
69f07dad62 the shell prompt for non-root sessions is "$" by convention 2011-02-13 01:40:32 +01:00
Wojciech Wnętrzak
22e14ea573 added proper require for ruby-debug19 gem to generated Gemfile
[#6419 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-12 22:39:06 -02:00
Xavier Noria
bc6554f63c Revert "Add note about running bundle install as root. Solves issue with '#' not being rendered, and it's more clear for beginners."
Reason: Running bundle as root is not recommended.

This reverts commit 0d40e2c397.
2011-02-13 01:37:37 +01:00
Josh Kalderimis
33cc36678b Allow for the format of time_tag in AP to be changed via an option argument.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-12 22:22:30 -02:00
Sjoerd Andringa
95a5bd87cb Added time_tag helper to AP for HTML5 time tag [#5919 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-12 22:22:18 -02:00
Ernie Miller
d72add9c20 Fix table name collision due to incorrect alias count on certain joins.
[#6423 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-12 19:52:12 -02:00
Josh Kalderimis
e2b99eb1a7 Applied changes to stylesheet_link_tag from javascript_include_tag which corrects issues with ordering and duplicates. 2011-02-13 05:50:25 +08:00
Josh Kalderimis
1363bb8f72 This corrects two issues with javascript_include_tag, the order at which they are expanded, and removing duplicates.
When individual js assets are specified, they will override the order of the same asset specified in an expansion.

[#5938 state:resolved]
2011-02-13 05:50:24 +08:00
Carlos Antonio da Silva
ad5b4d980a Remove duplicated action pack tests added to fix issue with fields_for, nested attributes and erb
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-12 16:40:41 -02:00
Corey Ward
0d40e2c397 Add note about running bundle install as root. Solves issue with '#' not being rendered, and it's more clear for beginners. 2011-02-12 08:12:24 -08:00
Tom Stuart
829de9d98e Add block support to button_tag helper
As per the HTML 4.01 spec:

  Buttons created with the BUTTON element function just like buttons
  created with the INPUT element, but they offer richer rendering
  possibilities: the BUTTON element may have content. For example, a
  BUTTON element that contains an image functions like and may resemble
  an INPUT element whose type is set to "image", but the BUTTON element
  type allows content.

Since rich content is the main purpose of the <button> element, it makes
sense for the button_tag helper to accept a block.

http://www.w3.org/TR/html401/interact/forms.html#edef-BUTTON
http://dev.w3.org/html5/spec/the-button-element.html#the-button-element

Signed-off-by: Santiago Pastorino and Emilio Tagua <santiago+emilioe@wyeworks.com>
2011-02-12 13:52:00 -02:00
Tom Stuart
03749d6c88 Make type="submit" the default for button_tag helper
"submit" is the default value of the <button> element's type attribute
according to the HTML 4.01 and the HTML5 draft specs, so if button_tag
is going to have a default, type="submit" is a more sensible choice than
type="button".

http://www.w3.org/TR/html401/interact/forms.html#adef-type-BUTTON
http://dev.w3.org/html5/spec/the-button-element.html#attr-button-type

Signed-off-by: Santiago Pastorino and Emilio Tagua <santiago+emilioe@wyeworks.com>
2011-02-12 13:51:02 -02:00
Josh Kalderimis
e8c870726a Updated the json date regex to recognize xmlschema formatted date times during json decoding. [#3031 state:resolved]
Signed-off-by: Santiago Pastorino and Emilio Tagua <santiago+emilioe@wyeworks.com>
2011-02-12 13:30:30 -02:00
Aaron Patterson
5b0695a8cb key habtm fixtures off table name 2011-02-11 17:53:55 -08:00
Aaron Patterson
2b353acac3 Fixture class no longer needs a reference to the database connection 2011-02-11 17:45:09 -08:00
Aaron Patterson
bc3c3453d4 convert fixtures to a list of hashes to insert 2011-02-11 17:20:53 -08:00
Aaron Patterson
55a4fb5e70 fixture should quack like a hash 2011-02-11 17:14:23 -08:00
Aaron Patterson
a5b61269f3 Fixtures class constantizes this value, so no need to do it twice 2011-02-11 17:02:53 -08:00
Aaron Patterson
24166c2603 database quoting should take care of this, no need to gsub 2011-02-11 16:52:23 -08:00
Aaron Patterson
0ebbf6be8a calculate model class on construction 2011-02-11 16:35:15 -08:00
Aaron Patterson
61fc309479 clear cache for all connections when resetting 2011-02-11 16:26:48 -08:00
Aaron Patterson
e0802fa176 avoid side effects from method calls, localize ivar assignment 2011-02-11 16:22:38 -08:00
Aaron Patterson
af5b1db965 create fixtures always returns a list, so build a hash from the list 2011-02-11 16:18:37 -08:00
Aaron Patterson
6344246654 create_fixtures() should always return a list 2011-02-11 16:09:34 -08:00
Aaron Patterson
ca938c0fc9 fixing variable names 2011-02-11 15:37:05 -08:00
Aaron Patterson
77a6e25584 use hash defaults to dry up ||= calls 2011-02-11 15:01:51 -08:00
Aaron Patterson
fb09d02542 refactor fixtures to do less work in the constructor 2011-02-11 14:33:03 -08:00
Aaron Patterson
83dd6e1e62 favor composition over inheritence. use AS::OrderedHash rather than omap 2011-02-11 10:03:45 -08:00
Josh Kalderimis
b17d8d727f Fixes an issue when decoding a json string which looks like a date but is invalid. This DateTime parse error is now caught and the original string is instead passed back [#6286 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-11 13:54:57 -02:00
Carlos Antonio da Silva
f23bf7dbdb Add missing deprecation require
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-11 13:29:23 -02:00
José Valim
28185ebc2e Remove misleading reference to polymorphic_url. 2011-02-11 05:51:13 -08:00
Aaron Patterson
339ad0d002 fixing tests on 1.8, using a list of lists because order is important 2011-02-10 14:17:09 -08:00
Aaron Patterson
61b69338b2 simplify bind parameter logging 2011-02-10 13:54:29 -08:00
Aaron Patterson
2f49cd91b7 bind parameters are logged to debug log 2011-02-10 13:34:33 -08:00
jonnii
46ebbcd56b Change fenomenal to phenomenal. 2011-02-10 12:22:19 -08:00
Vijay Dev
0db9de6cf6 updated reference to remote_form_for 2011-02-11 00:17:03 +05:30
Vijay Dev
f68287f0be fix typos, minor edits 2011-02-10 23:37:55 +05:30
Aaron Patterson
028016ede3 test cases for bind parameter logging 2011-02-10 09:56:50 -08:00
Josh Kalderimis
1814298d75 Removed Array#safe_join in AS core_ext and moved it to a view helper with the same same. This also changes how safe_join works, if items or the separator are not html_safe they are html_escape'd, a html_safe string is always returned.
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-02-10 16:51:30 +01:00
José Valim
89a5f1463d Revert "Removed Array#safe_join in AS core_ext and moved it to a view helper with the same same."
Applied the wrong version.

This reverts commit 98c0c5db50.
2011-02-10 16:50:35 +01:00
Josh Kalderimis
98c0c5db50 Removed Array#safe_join in AS core_ext and moved it to a view helper with the same same. 2011-02-10 23:47:54 +08:00
Josh Kalderimis
1a73407b85 Corrected the html_safe implementation for Array. Moved the html safe version of join to its own method (safe_join) as not to degrade the performance of join for unrelated html_safe use. [#6298 state:resolved] 2011-02-10 23:47:54 +08:00
Paul Hieromnimon
f7221f5c75 Initial html_safe implemention for Array 2011-02-10 23:47:53 +08:00
Gabriel Horner
b3dad5deb9 add some docs for ActionController::Renderers 2011-02-10 00:16:06 -05:00
Aaron Patterson
c560c8b2ba log method takes an option list of bind values 2011-02-09 15:15:37 -08:00
Aaron Patterson
37efb517cb fanout unsubscribe only accepted one argument, so taking *args here is probably bad 2011-02-09 14:33:56 -08:00
Aaron Patterson
3e02b3702e just use an attr_accessor so we do not pay ||= on every notification call 2011-02-09 14:02:38 -08:00
Aaron Patterson
e50d43a201 fixing indentation 2011-02-09 13:47:32 -08:00
Aaron Patterson
3d0579fc03 speed up notification publishing by writing the delegate method 2011-02-09 13:46:47 -08:00
Aaron Patterson
5548e47adb rawr, mysql, mysql2, why do you hate me. :'( 2011-02-09 13:35:56 -08:00
Josh Bassett
056be15212 Fixed a bug where ActiveResource::HttpMock would not replace an existing response when passing a block to the respond_to method.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-09 19:25:53 -02:00
Tsutomu Kuroda
ad31549ab3 Override attributes_protected_by_default when has_secure_password is called.
attr_protected should not be called, because it nullifies the
mass assignment protection that has been set by attr_accessible.

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-09 18:35:15 -02:00
Josh Kalderimis
9d8fdfec38 removed some duplication from LH issue 5505 regarding AR touch and optimistic locking [#5505 state:resolved]
Signed-off-by: Santiago Pastorino and José Ignacio Costa <santiago+jose@wyeworks.com>
2011-02-09 18:28:15 -02:00
Franck Verrot
8bc464c809 The optimistic lock column should be increased when calling touch
Signed-off-by: Santiago Pastorino and José Ignacio Costa <santiago+jose@wyeworks.com>
2011-02-09 18:27:40 -02:00
Aaron Patterson
d3b2596884 use parenthesis so limit works on all dbs 2011-02-09 11:51:09 -08:00
Xavier Noria
cb1f8413de now that the API guidelines are a guide, it is enough to assert that the names of Rails components have a space, no need to say it was checked with David in the past 2011-02-09 20:05:28 +01:00
Aaron Patterson
4083e0ea2a removing text-format in favor of a more simple solution 2011-02-09 10:11:29 -08:00
Raimonds Simanovskis
c567ccbb17 bugfix for serialized_attributes to be class specific
previously serialized_attributes were kept as class attribute of ActiveRecord::Base - if some attribute was defined as serialized in one subclass then it was serialized in all other subclasses as well (if it had the same name)
2011-02-09 09:19:56 -08:00
Aaron Patterson
f48d32c0cf implementing include? on AM::Errors 2011-02-09 09:19:56 -08:00
Piotr Sarnacki
39310f7930 text-format requires text-hyphen, which needs ruby 1.8 2011-02-09 17:57:42 +01:00
Aaron Patterson
51d84c1d33 we do not need message to be an array 2011-02-09 08:42:13 -08:00
Ken Collins
56fb3b1594 Allow limit values to accept an ARel SQL literal. 2011-02-09 08:33:40 -08:00
Aaron Patterson
c6b4ef082f use map rather than array concatenation 2011-02-09 08:32:43 -08:00
Aaron Patterson
307e6b2b74 favor composition over inheritence 2011-02-09 08:32:43 -08:00
Aaron Patterson
ed6e09c1b1 use 1 call to concat rather than calling << n times 2011-02-09 08:32:43 -08:00
John Paul Ashenfelter
04eaacca96 replaced MODEL.human_name with MODEL.model_name.human now that .human_name is deprecated 2011-02-09 11:23:42 -05:00
Piotr Sarnacki
e6369bc9e9 Application's assets should have higher priority than engine's ones
[#6388 state:resolved]
2011-02-09 12:19:20 +01:00
Eric Allam
d729e5f97e Failing test for #6388 2011-02-09 12:19:08 +01:00
Santiago Pastorino and Emilio Tagua
0faa7ee2a0 Add missing require 2011-02-09 08:36:44 -02:00
Josh Kalderimis
3eb25fb880 fix for AS Gzip returning a UTF-8 string in Ruby 1.9 when it is actually binary [#6386 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-02-09 10:27:01 +01:00
Aaron Patterson
5046120b97 comma limits do not make sense on oracle or pg 2011-02-08 16:54:07 -08:00
Aaron Patterson
c9182597ca reduce string append funcalls 2011-02-08 16:18:37 -08:00
Aaron Patterson
b45a90f9b0 redcloth does not install on 1.9.3 2011-02-08 16:01:36 -08:00
Aaron Patterson
1c6f4562d7 primary keys should not be cleared on cache clear, fixing oracle tests 2011-02-08 16:01:16 -08:00
Michael Koziarski
11061f410e Make rails.js include the CSRF token in the X-CSRF-Token header with every ajax request. 2011-02-08 14:57:34 -08:00
Michael Koziarski
ae19e4141f Change the CSRF whitelisting to only apply to get requests
Unfortunately the previous method of browser detection and XHR whitelisting is unable to prevent requests issued from some Flash animations and Java applets.  To ease the work required to include the CSRF token in ajax requests rails now supports providing the token in a custom http header:

 X-CSRF-Token: ...

This fixes CVE-2011-0447
2011-02-08 14:57:08 -08:00
Aaron Patterson
0b58a7ff42 limit() should sanitize limit values
This fixes CVE-2011-0448
2011-02-08 14:21:12 -08:00
José Valim
6b1018526f Use Mime::Type references. 2011-02-08 14:14:26 -08:00
José Valim
b93c590297 Ensure render is case sensitive even on systems with case-insensitive filesystems.
This fixes CVE-2011-0449
2011-02-08 14:04:19 -08:00
Michael Koziarski
3ddd7f7ec9 Be sure to javascript_escape the email address to prevent apostrophes inadvertently causing javascript errors.
This fixes CVE-2011-0446
2011-02-08 13:56:08 -08:00
Vijay Dev
435bf4ca4b minor fixes in generators 2011-02-09 03:18:12 +05:30
Aaron Patterson
8ce57652b2 ignore max identifier length queries from pg 2011-02-08 13:38:05 -08:00
Santiago Pastorino
ee0b92ec7a fields_for with inline blocks and nested attributes already persisted does not render properly
[#6381 state:committed]
2011-02-08 18:04:12 -02:00
Carlos Antonio da Silva
631e23ec6c Add tests showing the LH issue #6381: fields_for with inline blocks and nested attributes already persisted
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-08 18:04:12 -02:00
Aaron Patterson
cd440236ad this test requires the job model, so we should require it 2011-02-08 11:31:46 -08:00
Aaron Patterson
51414a0893 use === so that regular expressions are not required 2011-02-08 10:48:01 -08:00
Aaron Patterson
1df3b65acc use === so that regular expressions are not required 2011-02-08 10:42:03 -08:00
Jan
9643243204 make set_table_name take effect immediately 2011-02-08 10:31:09 -08:00
Aaron Patterson
ac86923fca no more faker, rbench, or addressable 2011-02-07 19:53:22 -08:00
Aaron Patterson
ea25224046 cleaning up some warnings on 1.9.3 2011-02-07 16:44:27 -08:00
Aaron Patterson
08ef06dbf1 just return the record from insert_record, use truthiness for comparisons 2011-02-07 16:25:22 -08:00
Aaron Patterson
2b4de6621f require tag since we need it for this test 2011-02-07 16:09:33 -08:00
Jon Leighton
4f7bdc8f74 Documentation for recent refinements to association deletion 2011-02-07 23:35:05 +00:00
Jon Leighton
e62b576472 Refactor the implementations of AssociatioCollection#delete and #destroy to be more consistent with each other, and to stop passing blocks around, thus making the execution easier to follow. 2011-02-07 23:35:05 +00:00
Jon Leighton
d9870d92f7 This string should continue 2011-02-07 23:35:05 +00:00
Jon Leighton
52f09eac5b Correctly update counter caches on deletion for has_many :through [#2824 state:resolved]. Also fixed a bunch of other counter cache bugs in the process, as once I fixed this one others started appearing like nobody's business. 2011-02-07 23:35:05 +00:00
Jon Leighton
05bcb8cecc Support the :dependent option on has_many :through associations. For historical and practical reasons, :delete_all is the default deletion strategy employed by association.delete(*records), despite the fact that the default strategy is :nullify for regular has_many. Also, this only works at all if the source reflection is a belongs_to. For other situations, you should directly modify the through association. 2011-02-07 23:35:05 +00:00
Jon Leighton
d55406d2e9 Make record.association.destroy(*records) on habtm and hm:t only delete records in the join table. This is to make the destroy method more consistent across the different types of associations. For more details see the CHANGELOG entry. 2011-02-07 23:35:05 +00:00
Aaron Patterson
5f1ea2a26b we do not use this method, so delete 2011-02-07 15:28:49 -08:00
Aaron Patterson
30bba95a04 update ignored SQL for oracle 2011-02-07 15:12:21 -08:00
Aaron Patterson
1193709cd6 removing some freedom patches. use notification system to count sql queries 2011-02-07 14:35:11 -08:00
Aaron Patterson
9f773d66b5 mysql2 should log these sql statements 2011-02-07 14:35:11 -08:00
Aaron Patterson
60da34b4be notifier should be saved and re-set, not deleted 2011-02-07 14:35:11 -08:00
Santiago Pastorino
933adce8f4 Use map + flatten here 2011-02-07 19:15:06 -02:00
Aaron Patterson
0de661d6c7 the connection pool caches table_exists? calls 2011-02-07 09:26:52 -08:00
Nathaniel Bibler
285fdbae2b Fixed broken, memoized attributes method example
[#6245 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-07 14:44:37 -02:00
Kevin Skoglund
77582075a6 Add note that validates_length_of will incorrectly pluralize min. length 1 2011-02-07 09:25:22 -05:00
Timothy N. Tsvetkov
7a77425901 Updated form rails guide for new place of authenticity_token option
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-07 10:50:58 -02:00
Akira Matsuda
65e08cfb4f do not to_s where you are testing that a string value is stored for the before_type_cast
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-07 09:52:24 -02:00
Akira Matsuda
40aefb9301 avoid nil.dup
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-07 09:51:51 -02:00
Paul Annesley
58dccf305a ActiveRecord :default_timezone is :utc in Rails, as set by active_record/railtie.rb 2011-02-06 16:04:29 -08:00
wycats
1fd9d978a7 Add initial FileWatcher implementation. The Backend is just an abstract implementation, which will be inherited by backends that do the heavy lifting. 2011-02-06 13:42:22 -08:00
Dan Pickett
3026843dc1 put authenticity_token option in parity w/ remote
[#6228 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-06 19:04:52 -02:00
John Hawthorn
a3f5d7159d fix db:fixtures:load with FIXTURES specified [#6061 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-06 18:45:42 -02:00
Vijay Dev
cc2b2719d8 fix minor typo 2011-02-07 01:34:12 +05:30
Andre Arko
10cab35d3b Allow page_cache_directory to be set as a Pathname
For example, page_cache_directory = Rails.root.join("public/cache")

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-06 17:55:38 -02:00
Carl Lerche
cf9324e590 Find all validators for multiple attributes 2011-02-05 20:27:02 -08:00
Carl Lerche
cd13fbd8d8 Optionally pass in the attribute being validated to an instance method validator 2011-02-05 16:44:35 -08:00
Carl Lerche
e9e9ed6b60 Be able to pass a validator method to #validates 2011-02-05 16:33:00 -08:00
Carl Lerche
ed7614aa7d Provide a way to specify alternate option keys for validates 2011-02-05 16:00:57 -08:00
Carl Lerche
7176ade35b Do not require that validation attributes be specified as symbols 2011-02-05 15:37:38 -08:00
Henry Phan
742f5f4a5d Add CSS fix for WebKit/Mac rendering issue. 2011-02-05 13:09:35 -08:00
Timothy N. Tsvetkov
b9309b47cd Added tests for form_for and an authenticity_token option. Added docs for for_for and authenticity_token option. Added section to form helpers guide about forms for external resources and new authenticity_token option for form_tag and form_for helpers.
[#6228 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-05 18:58:32 -02:00
Santiago Pastorino
5af31f37fb Update jQuery UJS 2011-02-05 18:57:32 -02:00
Xavier Noria
8b5dc9caa5 Merge branch 'master' of git://github.com/lifo/docrails 2011-02-05 19:47:08 +01:00
Gabriel Horner
277327bb7f improve routing docs, mostly for #match 2011-02-05 13:12:49 -05:00
Brian Morearty
c56e314866 Updates to ActiveRecord::Timestamp documentation.
Change ActiveRecord::Base.xyz to config.active_record.xyz in docs.

Remove <tt> from code samples.

Update skip_time_zone_conversion_for_attributes code sample: put the call in the model class.

Clarify that skip_time_zone_conversion_for_attributes skips converion when reading.
2011-02-05 09:07:00 -08:00
Aaron Patterson
59f7780a34 adjust query counts to be consistent across databases, make sure database log the same things 2011-02-04 18:14:59 -08:00
Aaron Patterson
acccb72cb1 column cache now lives on the connection pool 2011-02-04 18:14:59 -08:00
Aaron Patterson
c94651f8c8 almost fisted 2011-02-04 18:14:59 -08:00
Aaron Patterson
0cd42864e3 making sure primary key is set on the columns 2011-02-04 18:14:59 -08:00
Aaron Patterson
5f3cf4244d connection pool can cache column, table, and primary key information 2011-02-04 18:14:59 -08:00
Santiago Pastorino
78d23edf9a Remove stupid mistake 2011-02-04 21:49:56 -02:00
Santiago Pastorino
da2d24f7cf git am is better here 2011-02-04 21:36:10 -02:00
Ben Orenstein
4b2889e771 Correct migration name the test is looking to match.
[#6375 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-04 20:25:13 -02:00
Edward Faulkner
909588d964 Fixing ordering of HABTM association deletion [#6191 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-04 19:39:59 -02:00
Aaron Patterson
df07760486 introduce a fake AR adapter for mocking database return values 2011-02-04 13:34:57 -08:00
german
adbae9aab8 fixed bug with nested resources within shallow scope
[#6372 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-04 17:07:51 -02:00
Brian Morearty
3a29bfae2c Change Time.zone= docs.
Update the example to show how to reset the current thread's
Time.zone upon exiting a request.
2011-02-04 09:10:07 -08:00
Kevin Skoglund
94175c0e39 Improve regex in rake db:migrate status [#5940 state:resolved]
[#5940 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-04 12:59:06 -02:00
Gabriel Horner
ac15647bf0 keep options titles consistent to "Options" 2011-02-03 23:51:06 -05:00
Aaron Patterson
89962d82f1 refactor a bunch of return / if to a case / when 2011-02-03 16:00:59 -08:00
Aaron Patterson
dde8933d60 add_limit_offset! is deprecated 2011-02-03 15:54:31 -08:00
Aaron Patterson
a88071e92a just use the superclass implementation 2011-02-03 15:48:34 -08:00
Aaron Patterson
7423a71fc0 allow AR caches to be cleared, clear them on class reloading 2011-02-03 15:35:44 -08:00
Santiago Pastorino
082326deb5 module_eval is not needed here 2011-02-03 20:47:02 -02:00
Santiago Pastorino
6f4d9989dd method_defined?, define_method and send accepts a string as argument 2011-02-03 20:37:12 -02:00
Franco Brusatti
d3cfee1182 removing generation of id in submit helper
[#6369 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-03 20:24:14 -02:00
Aaron Patterson
23a3ba4260 Revert "ARel only requires the connection from the AR class. Simply return the AR class rather than jump through hoops and store ivars"
This reverts commit d65e3b481e.
2011-02-03 14:04:21 -08:00
Ken Collins
95d5d9b6c4 The type_cast_calculated_value method will trust DB types before casting to a BigDecimal.
[#6365 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-03 20:00:51 -02:00
Santiago Pastorino
092a4e296d just < 1.9 is fine and 1.9.1 is not supported 2011-02-03 19:27:43 -02:00
Gabriel Horner
c0b4db0c28 fix OrderedHash#each* methods to return Enumerators when called without a block [#6366 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-03 19:26:36 -02:00
Caleb Land
bca070ef2d allow spaces and other characters in attribute names [#4725 state:resolved]
* define the dynamically defined methods with
  'define_method' instead of def
* wrap some string injected method names in quotes

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-03 19:05:17 -02:00
Aaron Patterson
d65e3b481e ARel only requires the connection from the AR class. Simply return the AR class rather than jump through hoops and store ivars 2011-02-03 11:50:43 -08:00
Aaron Patterson
1a15fda021 reduce cache misses on STI subclasses 2011-02-03 11:12:07 -08:00
Aaron Patterson
a5d8f0be00 this method should be private 2011-02-03 09:09:27 -08:00
Guillermo Álvarez
351331fb34 Make serialized columns with explicit object_type return a new instance of the object instead of nil 2011-02-03 09:08:45 -08:00
John Firebaugh
080345baca Ruby 1.8.7+ provides to_date/to_datetime, AS just makes them public.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-03 13:12:03 -02:00
John Firebaugh
bf0395837f Preserve fractional seconds in DateTime#to_time
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-03 13:11:56 -02:00
Anton Astashov
c1c6f29214 Add a test for 'render :layout'
To make sure it will show block contents if it is placed after 'render
:partial'

[#5557 state:resolved]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-03 12:55:32 -02:00
Tim Pope
e89ba63b88 Drop remaining script/plugin sources references
[#3742 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-03 00:33:30 -02:00
Santiago Pastorino
434aa09560 Fix tests providing valid JSON 2011-02-02 20:53:03 -02:00
Xavier Noria
e99e859a04 revises a metal example 2011-02-02 23:27:27 +01:00
Xavier Noria
33643bcf53 copy-edits 2446b13 2011-02-02 23:04:12 +01:00
Stephen Celis
a0757e00f3 Protocol-relative URL support.
[#5774 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-02 19:09:44 -02:00
Xavier Noria
a96a9a4948 Merge branch 'master' of git://github.com/lifo/docrails 2011-02-02 22:04:11 +01:00
Maxime RETY
68e3fb8109 Fix JSON decoding of newline character with Yaml backend [#3479 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-02 18:57:48 -02:00
Aaron Patterson
8bfa8e7cbe this method should never return nil 2011-02-02 10:25:53 -08:00
Aaron Patterson
3fc598095e just require mysql2 2011-02-02 10:25:53 -08:00
Aaron Patterson
95b9d71023 using mysql2 from git 2011-02-02 10:25:53 -08:00
Santiago Pastorino
12b2f8b040 Delete blank lines in migration generator 2011-02-02 16:20:03 -02:00
Aaron Patterson
70b9db173e adding mysql2 adapter 2011-02-02 10:17:39 -08:00
Raimonds Simanovskis
9e23835cb8 fix for test_read_attributes_before_type_cast_on_datetime - Oracle adapter also returns Time value 2011-02-02 09:06:42 -08:00
Gabriel Horner
9a0f43d3c1 OrderedHash#each* methods return self like Hash does [#6364 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-02 13:40:36 -02:00
Bernerd Schaefer
2446b1307e Provide documentation for ActionController::Metal 2011-02-02 16:02:28 +01:00
Franck Verrot
8dcacd0cc7 Refactor clear_timestamp_attributes to use the newly created all_timestamp_attributes_in_model
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-02 12:45:25 -02:00
Franck Verrot
a5b03e9c7a Implement and test private method all_timestamp_attributes_in_model
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-02 12:45:14 -02:00
Franck Verrot
47315760bc Test timestamp_attributes_for_update_in_model that was already in place
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-02 12:45:03 -02:00
Franck Verrot
5178e64175 Added timestamp_attributes_for_create_in_model
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-02 12:44:53 -02:00
Franck Verrot
598b32c581 Test private method all_timestamp_attributes
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-02 12:44:41 -02:00
Franck Verrot
253f5a15f4 Test private method timestamp_attributes_for_update
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-02 12:44:25 -02:00
Franck Verrot
6d40d527e8 Test private method timestamp_attributes_for_create
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-02 12:44:05 -02:00
Michał Łomnicki
4e39072017 Configurable generation of add_index for references columns
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-01 22:50:51 -02:00
Fred Wu
19e68b4909 Fixed the SelectorAssertions documentation url. 2011-02-02 11:24:01 +11:00
Aaron Patterson
5b42e96602 make sure de-serialization happens on object instantiation 2011-02-01 15:23:55 -08:00
Aaron Patterson
a0fac71922 store the serialized column values in the @attributes hash 2011-02-01 14:25:47 -08:00
Aaron Patterson
ebe485fd8e serialize can take an arbitrary code object 2011-02-01 14:25:47 -08:00
Aaron Patterson
ee34b4cf34 share column cache among subclasses, only look up columns per AR::Base subclass once 2011-02-01 14:25:46 -08:00
Aaron Patterson
a6cf6ec98b move the coders to the serialized_attributes hash 2011-02-01 14:25:46 -08:00
Aaron Patterson
69600a9f97 avoid column lookup on subclasses, keep column info cached as table_name => column_list 2011-02-01 14:25:46 -08:00
Aaron Patterson
3cc2b77dc1 adding a YAML Column coder for YAML serialization to db columns 2011-02-01 14:25:46 -08:00
Aaron Patterson
0171de00b7 moving AR::ConnectionAdapters::Column to its own file 2011-02-01 14:25:46 -08:00
Aaron Patterson
65f11ff789 column will use coder to typecase value when it is available 2011-02-01 14:25:46 -08:00
Aaron Patterson
a7c2f6be30 coders can be assigned to columns 2011-02-01 14:25:46 -08:00
Aaron Patterson
6d5e3b86d5 namespace test so we can dry up constant lookup 2011-02-01 14:25:46 -08:00
Aaron Patterson
2f62084d42 dry up our case / when statements 2011-02-01 14:25:46 -08:00
Santiago Pastorino
86dc5987b2 add test to check class is being escaped in form_class 2011-02-01 19:17:31 -02:00
Andrei Bocan
15ad707852 Allow customization of form class for button_to
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-01 19:09:00 -02:00
Santiago Pastorino
6dc4538c95 Update to jQuery 1.5
Check out http://blog.jquery.com/2011/01/31/jquery-15-released/
for more information.
2011-02-01 18:44:44 -02:00
Santiago Pastorino
451ad38bb2 scope is always a Relation 2011-02-01 17:20:24 -02:00
Saimon Moore
c2aca3ddd7 Ensure I18n setup is only executed once if triggered on eager loading [#6353 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-01 15:36:09 -02:00
Saimon Moore
b1ca339b53 Additionally trigger i18n configuration setup before any eager loading [#6353 state:resolved]
This handles the case where config.cache_classes is true and classes
are loaded before the I18n load path has had a chance to be populated.

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-01 15:35:48 -02:00
Akira Matsuda
cb9fa52832 auto_link: avoid recognizing full width chars as a part of URI scheme
fixes regression by 133ada6ab0

[#5503 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-01 14:04:42 -02:00
Akira Matsuda
8a85f64abf Accept 'postgres' as a PostgreSQL driver name in dbconsole for non-AR ORMs like DataMapper and Sequel
[#6180 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-01 13:20:53 -02:00
Akira Matsuda
5dd803e9b1 Accept String value for render_partial :as option
[#6222 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-01 13:01:54 -02:00
Glenn Vanderburg
6bd9fac1e3 Propagate association extensions to scopes called on the association.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-01 12:38:58 -02:00
Akira Matsuda
817e370136 Make before_type_cast available for datetime fields
[#3973 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-01 12:21:18 -02:00
Paco Guzman
5a6f651a6a FIX not using _on_create or _on_update callbacks only _create and _update 2011-02-01 08:37:43 +01:00
geemus
ed2eb6fa87 updating Gemfile with more contemporary example
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-01-31 21:12:52 -02:00
Aaron Patterson
4ccf8319bb expand mulasgn for enhancing readability 2011-01-31 14:03:28 -08:00
Akira Matsuda
2e11213d62 "rails dbconsole t" must not load "production" but "test"
[#6293 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-01-31 19:48:58 -02:00
John Firebaugh
57bc25c5f8 Use run_callbacks; the generated _run_<name>_callbacks method is not a public interface.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-01-31 19:45:53 -02:00
Paul Yoder
cb3e6c3665 small edit on options extraction documentation 2011-01-31 13:48:58 -06:00
Pratik Naik
9666b6a625 Run BulkAlterTableMigrationsTest only when the adapter supports them 2011-01-31 14:10:51 +00:00
Pratik Naik
30176f28a4 Add :bulk => true option to change_table 2011-01-31 13:21:25 +00:00
Jon Leighton
9db4c07e0b Make use of helpers in AssociationReflection 2011-01-30 11:58:09 +00:00
Jon Leighton
3fa61ccb9e Has many through - It is not necessary to manually merge in the conditions hash for the through record, because the creation is done directly on the through association, which will already handle setting the conditions. 2011-01-30 11:58:09 +00:00
Jon Leighton
c5e912a8b3 @join_table_name is no longer used 2011-01-30 11:58:09 +00:00
Jon Leighton
59d54c3eba Make AssociationCollection#include? a bit more readable 2011-01-30 11:58:08 +00:00
Jon Leighton
0645fd2c80 Don't use method_missing when we don't have to 2011-01-30 11:58:08 +00:00
Jon Leighton
2e24cf7cc2 AssociationCollection#clear can basically just use #delete_all, except it should return self. 2011-01-30 11:58:08 +00:00
Jon Leighton
88df88095c AssociationCollection#to_ary should definitely dup the target! Also changed #replace which was previously incorrect, but the test passed due to the fact that to_a was not duping. 2011-01-30 11:58:08 +00:00
Jon Leighton
1da1ac159f Just use primary_key here, AR::Relation will resolve the ambiguity before it is converted to SQL 2011-01-30 11:58:08 +00:00
Jon Leighton
140b269fb7 Call sum on the scope directly, rather than relying on method_missing and calculate 2011-01-30 11:58:08 +00:00
Jon Leighton
ca7785847e Condense first_or_last a bit more 2011-01-30 11:58:08 +00:00
Jon Leighton
fdee153ff8 Get rid of separate reset_target! and reset_scopes_cache! methods 2011-01-30 11:58:08 +00:00
Jon Leighton
5dd3dadcdd target is always an array 2011-01-30 11:58:08 +00:00
Jon Leighton
47309826e4 load_target will return the target. it also will not load if loaded? is true. 2011-01-30 11:58:08 +00:00
Jon Leighton
b7bcc7e190 DRY up first/last and hence make last benefit from the bugfix in first 2011-01-30 11:58:08 +00:00
Jon Leighton
e8d7152a89 Use scoped.find directly rather than having a find_by_sql method 2011-01-30 11:58:07 +00:00
Jon Leighton
1a4bbaf106 Use scoped.first and scoped.last instead of find(:first, ...) and find(:last, ...) 2011-01-30 11:58:07 +00:00
Jon Leighton
1e7cf6c7e9 Try to make fetch_first_or_last_using_find? more readable 2011-01-30 11:58:07 +00:00
Jon Leighton
db503c4142 load_target returns the target 2011-01-30 11:56:41 +00:00
Jon Leighton
aa86420be2 Rename AssociationProxy#loaded to loaded! as it mutates the association 2011-01-30 11:56:41 +00:00
Jon Leighton
de05e2fb15 Abstract load_target conditional logic 2011-01-30 11:56:41 +00:00
Jon Leighton
d392c67d2c Remove unused methods conditions, sql_conditions and sanitize_sql 2011-01-30 11:56:41 +00:00
Jon Leighton
dbb6fa723e Don't pass around conditions as strings in ThroughAssociation 2011-01-30 11:56:41 +00:00
Jon Leighton
d85ee50eda Indent methods under private/protected sections 2011-01-30 11:56:41 +00:00
Jon Leighton
15601c52e7 Let's be less blasé about method visibility on association proxies 2011-01-30 11:56:41 +00:00
Jon Leighton
63c73dd021 We shouldn't be using scoped.scoping { ... } to build associated records, as this can affect validations/callbacks/etc inside the record itself [#6252 state:resolved] 2011-01-30 11:56:41 +00:00
Jonathan Dance + Gabriel Horner
d1ef543794 explain different ways to use match() 2011-01-29 17:29:06 -05:00
Jonathan Dance + Gabriel Horner
fab16fded9 organize and expand on options for routing methods 2011-01-29 17:29:06 -05:00
misfo
ef48408a7b corrected the location of status code symbols 2011-01-29 16:03:40 -06:00
misfo
5e35ceee7d corrected a mistake in the documentation for assert_migration 2011-01-29 15:42:56 -06:00
Mikel Lindsaar
8adfede96e Merge branch 'fix-gitignore' of https://github.com/telemachus/rails into telemachus-fix-gitignore 2011-01-30 00:06:03 +11:00
Philip Arndt
99f751ffef Test non zero exit code and that a message still appears when generating inside an existing Rails directory. 2011-01-29 16:51:42 +08:00
Philip Arndt
a812cb6707 Dir.chdir is not useful in this test, that was for another one I am planning to do. 2011-01-29 16:51:41 +08:00
Philip Arndt
34fef7e258 Added test to ensure non zero exit codes when generating an application with a reserved name.
Unfortunately, I can't find out how to suppress its output so we see ....Invalid application name test. Please give a name which does not match one of the reserved rails words.....................................
2011-01-29 16:51:41 +08:00
Philip Arndt
d6fd5821da Exit with non-zero to signal failure. 2011-01-29 16:51:40 +08:00
Philip Arndt
e0b16debd1 Use exit(1) instead of exit(false) 2011-01-29 16:51:40 +08:00
Philip Arndt
dcc72b2079 Use Thor's self.exit_on_failure? to exit whenever accessing the generators from the CLI and a Thor::Error is raised. 2011-01-29 16:51:39 +08:00
Philip Arndt
36f570dbd2 Apply exit code 1 when commands don't succeed so that other libraries can properly detect the failure. 2011-01-29 16:51:38 +08:00
Jesse Storimer
38d31b0ef0 Correct docs for after_find and after_initialize 2011-01-28 23:40:42 -05:00
Aaron Patterson
740bc35d32 always return the identity function from type_cast_code 2011-01-28 18:04:22 -08:00
Aaron Patterson
72c1818941 use an identity conversion to avoid conditional codes 2011-01-28 17:39:38 -08:00
Jonathan Dance + Gabriel Horner
38d728fb94 add cross-references and documentation for scope 2011-01-28 19:25:12 -05:00
Jonathan Dance + Gabriel Horner
49744bdaee fix cross-references in HttpHelper methods 2011-01-28 19:25:12 -05:00
Akira Matsuda
78ecb2485e make the example code a bit more accurate 2011-01-29 09:02:54 +09:00
Akira Matsuda
8f24471989 Fix indentation 2011-01-29 08:15:31 +09:00
Alexey Nayden
fa779c5357 Fixing incorrectly writtent testcase 2011-01-28 15:06:02 -08:00
Alexey Nayden
e92c2ffd8e Nested attributes and in-memory changed values #first and #[] behaviour consistency fix 2011-01-28 15:06:01 -08:00
Alexey Nayden
2884482c34 test_first_and_array_index_zero_methods_return_the_same_value_when_nested_attributes_are_set_to_update_existing_record added 2011-01-28 15:06:01 -08:00
Aaron Patterson
c87fb22a06 make sure we play nicely when syck is activated 2011-01-28 15:00:52 -08:00
brainopia
eb33bd944d Psych correctly gets visitor for SafeBuffer from superclass 2011-01-28 14:32:53 -08:00
brainopia
452dba72f5 Remove unneeded yaml_as declaration 2011-01-28 14:31:36 -08:00
Aaron Patterson
c29eef7da7 load psych by default if possible 2011-01-28 14:24:11 -08:00
Santiago Pastorino
e19a7729d1 Bump mail version up 2011-01-28 17:45:11 -02:00
Akira Matsuda
018a88cf7e missing parentheses 2011-01-29 00:56:07 +09:00
Keith Wansbrough
7ada0fb598 Refer to the correct action - it's the update action, in the special case where we want to render the edit view. 2011-01-27 11:39:47 -08:00
Matt Jankowski
cc9301f459 clarify what the "they" that are is and what the "are" in question is 2011-01-27 12:25:22 -05:00
Paul Yoder
d8919d3151 Deleted extra "a" in method comment 2011-01-27 09:27:35 -06:00
Neeraj Singh
806e6f80dc render_to_string must ensure that response_body
is nil

[ #5875 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2011-01-25 20:14:03 +01:00
Neeraj Singh
c1145d9281 If I want to set respond_body to nil then it
should be nil and not [nil]. If anything other
than nil then wrap it in array

Signed-off-by: José Valim <jose.valim@gmail.com>
2011-01-25 20:13:56 +01:00
Doug Fales
7927fc2ff7 A patch so that http status codes are still included in logs even during an exception [#6333 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-01-25 20:12:22 +01:00
Vijay Dev
7af3b3988c Revert "fix csrf_meta_tag"
This reverts commit 6641bf877a.
2011-01-24 02:32:53 +05:30
Vijay Dev
340c7d182e filter_parameter_logging => config.filter_parameters 2011-01-23 20:29:03 +05:30
Vijay Dev
6641bf877a fix csrf_meta_tag 2011-01-23 20:22:17 +05:30
Aaron Patterson
59f3218463 load and prefer psych as the YAML parser when it is available 2011-01-21 17:53:28 -08:00
Aaron Patterson
3d6e223b84 use spec compliant YAML 2011-01-21 15:43:34 -08:00
Aaron Patterson
b5cc277763 psych does not emit a space after the tag 2011-01-21 15:13:30 -08:00
Aaron Patterson
370bcd1a01 use ! " " YAML string literal syntax rather than removing both quotes 2011-01-21 14:09:59 -08:00
Aaron Patterson
7642b7531d prefering psych as the yaml parser if possible, fixing assertions for YAML 1.1 compatibility 2011-01-21 11:16:40 -08:00
Aaron Patterson
2570c85cb7 fixing psych support in big decimal, fixing tests to support YAML 1.1 2011-01-21 11:16:40 -08:00
brainopia
8491f16e12 Add tld_length option when using domain :all in cookies
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-01-21 13:13:51 +01:00
brainopia
91a4193ee0 Support list of possible domains for cookies
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-01-21 13:13:43 +01:00
Xavier Noria
02319b7982 Merge branch 'master' of github.com:rails/rails 2011-01-20 10:34:17 +01:00
Xavier Noria
236f1f52cd Merge branch 'master' of git://github.com/lifo/docrails 2011-01-20 10:33:38 +01:00
Jamis Buck
bc9b1075ae Revert "make TestCaseTest work for pre-1.9 rubies, too"
This reverts commit 7938039548.
2011-01-19 15:55:32 -07:00
Jamis Buck
1de1dc02d7 Revert "scrub instance variables from test cases on teardown"
This reverts commit 79a06225ef.
2011-01-19 15:55:30 -07:00
Jamis Buck
41f76946d0 Revert "rein in GC during tests by making them run (at most) once per second"
This reverts commit 16a23a184e.
2011-01-19 15:55:23 -07:00
José Valim
262b2ea8cd Solve SystemStackError when changing locale inside ActionMailer [#5329 state:resolved] 2011-01-19 23:42:10 +01:00
Frank Fischer
b247f39442 Added a testcase for bug [#5329]
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-01-19 23:24:57 +01:00
Tobias Bühlmann
94e0f1db1c use name instead of title in example 2011-01-19 22:03:54 +01:00
Matt Buck
2373eedc88 Make all references to engines lowercase in docs. 2011-01-19 14:30:28 -06:00
Jamis Buck
16a23a184e rein in GC during tests by making them run (at most) once per second
this can provide a significant performance boost during testing, by
preventing the GC from running too frequently.
2011-01-19 10:57:30 -07:00
Jamis Buck
79a06225ef scrub instance variables from test cases on teardown
this prevents test state from accumulating, resulting in leaked
objects and slow tests due to overactive GC.
2011-01-19 10:57:23 -07:00
Jamis Buck
7938039548 make TestCaseTest work for pre-1.9 rubies, too 2011-01-19 10:57:16 -07:00
Aaron Patterson
a282301a77 we have a method for setting preloaded records, so use it 2011-01-18 16:33:18 -08:00
Aaron Patterson
c107849a99 reduce objects, reduce loops and function calls while building the conditional 2011-01-18 15:52:57 -08:00
Aaron Patterson
f3a5995bbf keys will always be strings in the id => record map 2011-01-18 15:52:57 -08:00
Aaron Patterson
9e42f1b416 reduce method calls and loops when dealing with custom conditions 2011-01-18 15:52:57 -08:00
Aaron Patterson
ba62a87b8b ony bother with record map keys when we need them 2011-01-18 15:52:57 -08:00
Aaron Patterson
4bc9bacd94 refactor elaborate group_by in to a normal group_by 2011-01-18 15:52:57 -08:00
Aaron Patterson
36d6678690 removing usesless variable assignments 2011-01-18 15:52:56 -08:00
Nick Sutterer
7091d800b8 fixed a missing require that causes trouble when using AS in a non-rails env. 2011-01-18 23:28:51 +01:00
Aaron Patterson
54de7048a5 Merge branch 'template_error' into merge
* template_error:
  Ensure original exception message is present in both Template::Error#message and Template::Error#inspect.
  ActiveSupport::Deprecation.silence no longer needed.
2011-01-18 10:52:37 -08:00
Aaron Patterson
e6881217ed fixing bug where 1.8 hangs while running pg tests 2011-01-18 10:49:50 -08:00
Christos Trochalakis
7dab186fde Issue one Cache#read command instead of two in the case of a fragment cache hit 2011-01-18 09:52:11 -08:00
Aaron Patterson
11fe2161ce remove unnecessary module_eval 2011-01-18 09:36:33 -08:00
John Firebaugh
cc446eee99 Class.__subclasses__ was removed from Rubinius.
https://github.com/evanphx/rubinius/issues/issue/11
2fccbb5dad
2011-01-18 15:02:41 +08:00
Michael Koziarski
199d1abeb2 Use the derived request_method from AD::Request rather than the raw REQUEST_METHOD from rack.
This takes _method into account so the log shows the method which ActionController sees.
2011-01-18 14:43:54 +13:00
Mikel Lindsaar
6854358964 Removing unused method argument 2011-01-18 12:06:21 +11:00
Mikel Lindsaar
b141fa6280 Cleaning up style, concat inside method calls is ugly 2011-01-18 12:06:21 +11:00
Mikel Lindsaar
3b584aee95 Fixing redundant escape in regex 2011-01-18 12:06:21 +11:00
Mikel Lindsaar
ad8dc5ab89 Should use standard ruby signature for respond_to 2011-01-18 12:06:20 +11:00
Mikel Lindsaar
b72cd29e53 Fixing spelling 2011-01-18 12:06:20 +11:00
Aaron Patterson
9d549986dd remove useless conditional 2011-01-17 16:42:34 -08:00
Aaron Patterson
d780d1f508 ordering can change depending on ruby version, so parse the JSON and verify data structure equality 2011-01-17 16:06:55 -08:00
Jaime Iniesta
4b7dad2df3 ActiveRecord#save(false) is now deprecated, now it is save(:validate => false) 2011-01-18 00:35:07 +01:00
Aaron Patterson
6a8f7f0e04 minitest added @__io__, so we should ignore it too 2011-01-17 14:53:44 -08:00
Aaron Patterson
1333020448 fixing space errors 2011-01-17 14:45:24 -08:00
Aaron Patterson
990e6a1b3a fixing wrong test 2011-01-17 14:43:29 -08:00
Aaron Patterson
9702159373 removing more unused variables 2011-01-17 14:33:34 -08:00
Aaron Patterson
fdfabc99e8 fixing unused variable warnings 2011-01-17 14:22:17 -08:00
Jon Leighton
7a3f05f43d Add CHANGELOG entry for the addition of create_association! methods on has_one and belongs_to 2011-01-16 13:43:54 -08:00
Jon Leighton
d1521719c5 Removed support for accessing attributes on a has_and_belongs_to_many join table. This has been documented as deprecated behaviour since April 2006. Please use has_many :through instead. A deprecation warning will be added to the 3-0-stable branch for the 3.0.4 release. 2011-01-16 13:43:54 -08:00
Jon Leighton
c4458b3602 Rename some variables 2011-01-16 13:43:54 -08:00
Jon Leighton
8aedd722e1 Use self.target= in HasOneThroughAssociation too 2011-01-16 13:43:54 -08:00
Jon Leighton
b7594a0756 find_target can also go into SingularAssociation 2011-01-16 13:43:53 -08:00
Jon Leighton
f1a15c2197 Abstract a bit more into SingularAssociation 2011-01-16 13:43:53 -08:00
Jon Leighton
115eedbb41 Use self.target= rather than @target= as the former automatically sets loaded 2011-01-16 13:43:53 -08:00
Jon Leighton
ef79b91784 Abstract common code from BelongsToAssociation and HasOneAssociation into SingularAssociation 2011-01-16 13:43:53 -08:00
Jon Leighton
bf24fe810c belongs_to records should be initialized within the association scope 2011-01-16 13:43:53 -08:00
Jon Leighton
3ef693724c Document the new create_association! method on one-to-one associations 2011-01-16 13:43:53 -08:00
Jon Leighton
52c47556b7 Add create_association! for belongs_to 2011-01-16 13:43:53 -08:00
Aaron Patterson
8f88a28416 change sqlite3-ruby => sqlite3 in the generators 2011-01-16 13:29:08 -08:00
Aaron Patterson
421e06f090 updating gem dependency for sqlite3 2011-01-16 12:55:28 -08:00
Vijay Dev
77e1a99970 minor edits 2011-01-17 00:16:00 +05:30
Xavier Noria
15e71347f6 updates AR's CHANGELOG with changes in 9e64dfa and ad343d7 2011-01-16 18:55:35 +01:00
Vijay Dev
3c6c240431 Document the LANGUAGE option for generating guides 2011-01-15 23:50:03 +05:30
Vijay Dev
100ab5bd43 Documented the except and only conditions in the guides. Took the cue from Jordi Ramero's commit (b31ef7ee83) 2011-01-15 23:39:44 +05:30
Daniel Schierbeck
1a051259b4 Properly indent code example block 2011-01-15 17:54:02 +01:00
Santiago Pastorino
bbcdc864a6 README.rdoc is a template 2011-01-15 04:13:43 -02:00
Alexey Nayden
a9163b547c Complex struct encoding fix
[#6077 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-01-15 00:06:26 -02:00
Alexey Nayden
d2c17dbd11 Complex struct encoding test
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-01-15 00:06:17 -02:00
Santiago Pastorino
d75ff73a72 plugin new generator should generate config/routes.rb file for full engines 2011-01-14 23:34:10 -02:00
Aaron Patterson
0aef847927 push !loaded? conditional up 2011-01-14 17:08:27 -08:00
Aaron Patterson
b8ed2d5ddf return early in case the left or right side lists are empty 2011-01-14 17:03:15 -08:00
Aaron Patterson
75e29e871e only find_target can raise the exception, so isolate the rescue around that call 2011-01-14 16:57:14 -08:00
Aaron Patterson
f548054700 we always have a target, so stop checking 2011-01-14 16:54:02 -08:00
Aaron Patterson
f5d2cb9cac we should use [] instead of Array.new 2011-01-14 16:50:26 -08:00
Aaron Patterson
17687e4f96 @target is always a list, so stop doing is_a? checks 2011-01-14 16:47:31 -08:00
Aaron Patterson
2afd6c75f1 move complex logic to it's own method 2011-01-14 16:46:02 -08:00
Jordi Romero
b31ef7ee83 document ActiveRecord's except and only
Document methods that allow easily override arel queries
2011-01-15 01:17:53 +01:00
brainopia
da82b0a746 Remove reference to ActiveRecord from ActiveModel comments 2011-01-15 03:10:10 +03:00
Aaron Patterson
a0a69b045a loaded? will not raise an AR::RecordNotFound exception, so move the rescue inside the conditional 2011-01-14 15:58:59 -08:00
Aaron Patterson
c326969745 reduce funcalls by using falsey objects 2011-01-14 14:45:46 -08:00
Aaron Patterson
dc11a77ab7 write the delegate method directly to avoid delegate callstack overhead 2011-01-14 14:40:11 -08:00
Aaron Patterson
ef4ffed660 reduce some lasigns 2011-01-14 14:30:47 -08:00
Aaron Patterson
2947197421 use rake to create test databases for us 2011-01-14 14:07:16 -08:00
Aaron Patterson
f30a3106f3 transactional fixtures must be set to false for this test 2011-01-14 13:45:30 -08:00
Aaron Patterson
92499b3c7e Arel::Table.engine will be deprecated, so stop using it 2011-01-14 13:11:24 -08:00
Aaron Patterson
1e9685f159 preheat the table cache in arel 2011-01-14 11:16:31 -08:00
Santiago Pastorino
3755ae04a1 Add missing require 2011-01-14 17:11:15 -02:00
Aaron Patterson
7bf7ab5c68 use rack-test from git 2011-01-14 10:14:10 -08:00
Vijay Dev
93c208a630 use new AR api 2011-01-14 22:51:15 +05:30
Peter Aronoff
9141c1fa6d Minor fix to gitignore syntax 2011-01-14 12:01:39 -05:00
Vijay Dev
31767b0032 ends_width => ends_with 2011-01-14 22:10:22 +05:30
Matt Buck
5f5e3b7e23 Copy-edit and format Rails::Engine docs. 2011-01-14 02:34:59 -06:00
Santiago Pastorino
9a57a2279e sorry, the CI cannot lie to us anymore (Part II) 2011-01-13 10:55:41 -02:00
Neeraj Singh
b461fe76f4 editing comments regarding rescuable optoin in AS callbacks 2011-01-12 22:37:34 -05:00
Aaron Patterson
3165dca28c include_in_memory? should check against @target list in case of new records. [#6257 state:resolved] 2011-01-12 18:07:53 -08:00
Aaron Patterson
f2beb56c8b fixing whitespace errors 2011-01-12 18:07:53 -08:00
Santiago Pastorino
1de47a0d56 button_tag should escape it content 2011-01-12 22:05:52 -02:00
Santiago Pastorino
20897a6c2c Allow generators nested in more than one level 2011-01-12 21:42:56 -02:00
Aaron Patterson
c76c699f30 turn off deprecation silencing 2011-01-12 15:28:57 -08:00
Aaron Patterson
e1beb7d287 use array maths rather than *args 2011-01-12 15:15:45 -08:00
Aaron Patterson
8f9944d5bc just use return value of load_target 2011-01-12 14:29:17 -08:00
Aaron Patterson
e9980f17fd just call methods on return value of load_target 2011-01-12 14:27:08 -08:00
Aaron Patterson
bc993c690b default return value is nil 2011-01-12 14:27:08 -08:00
Aaron Patterson
49696e0a62 @loaded is defined in initialize, so we should not need this 2011-01-12 14:27:08 -08:00
Aaron Patterson
8bee98fe3a just use respond_to? and super rather than aliasing around methods 2011-01-12 14:27:08 -08:00
Xavier Noria
c07961ee54 fixes a comment in the generated app Gemfile 2011-01-12 21:22:38 +01:00
Xavier Noria
8b293e99ff Merge branch 'master' of github.com:rails/rails 2011-01-12 21:19:10 +01:00
Xavier Noria
5bc98c9510 defines a :doc group in the project's Rakefile, just for the sake of clarity 2011-01-12 21:15:57 +01:00
Xavier Noria
1f28d1011e adds a sample gem call for RedCloth in the generated app Gemfile 2011-01-12 21:14:34 +01:00
Xavier Noria
74188cbff4 upgrades RedCloth dependency to ~> 4.2, adds RedCloth to the project's Rakefile, removes gem call from the guides generator (use bundle exec if needed) 2011-01-12 21:12:44 +01:00
Xavier Noria
37bd45f893 upgrades to RDoc ~> 3.4 and removes the gem call in root Rakefile (use bundle exec if needed) 2011-01-12 20:59:31 +01:00
Aaron Patterson
31293ba9d3 remove locales external to the system before assertion 2011-01-12 11:15:11 -08:00
Aaron Patterson
16ae08fff0 use raise to create exceptions and to set the backtrace 2011-01-12 11:15:11 -08:00
Aaron Patterson
1d9c555297 reraising should be in the rescue block 2011-01-12 11:15:10 -08:00
Santiago Pastorino
daada51d10 Reuse the view_context from the controller, this make the test environment more similar to the code applications uses 2011-01-12 16:47:56 -02:00
Aaron Patterson
6ddabaa90c sorry, the CI cannot lie to us anymore 2011-01-12 09:47:04 -08:00
Josh Kalderimis
199e220e88 Fixed various isolated test missing requires within AS.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-01-12 12:37:28 -02:00
Josh Kalderimis
de18b85969 In AS, only inflector/methods is need in proxy_wrappers.rb, as well as date, date_time, and time conversions.rb. This fixes an issue when requiring json and AS saying that i18n is also required.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-01-12 12:37:01 -02:00
Santiago Pastorino
de5852f1a6 CI should run isolated tests 2011-01-12 12:36:14 -02:00
Santiago Pastorino
6062d434f1 Allow view in AV::TestCase to access it's controller helpers methods 2011-01-12 12:14:00 -02:00
Aaron Patterson
f8700038af adding a test for no method error 2011-01-11 17:57:02 -08:00
Aaron Patterson
fcd8925f23 use underlying _read_attribute method rather than causing NoMethodErrors 2011-01-11 15:39:26 -08:00
Aaron Patterson
5696d948ed kill unused variable warnings 2011-01-11 15:29:35 -08:00
Aaron Patterson
8c71e8b18f lazily instantiate AR objects in order to avoid NoMethodErrors 2011-01-11 15:16:09 -08:00
Jon Leighton
af96018c91 test_with_polymorphic_and_condition works without the conditions methods in BelongsToPolymorphicAssociation because the conditions are added straight to the association_scope as of a few days ago 2011-01-11 13:45:09 -08:00
Jon Leighton
552df9b933 Support for create_association! for has_one associations 2011-01-11 13:45:09 -08:00
Jon Leighton
d88caa6e4a Refactor the code for singular association constructors. This will allow me to define a create_association! method in a minute. 2011-01-11 13:45:09 -08:00
Jon Leighton
f4a88e810f It's not necessary to pass the association proxy class around now 2011-01-11 13:45:09 -08:00
Jon Leighton
681ab53ba1 Get rid of set_association_target and association_loaded? as the parts of the code that need that can now just use association_proxy(:name).loaded?/target= 2011-01-11 13:45:08 -08:00
Jon Leighton
42b2e4f85b We can use the association_proxy method directly in HasOneThroughAssociation now 2011-01-11 13:45:08 -08:00
Jon Leighton
3b797c8c86 DRY up the code which instantiates the association proxy 2011-01-11 13:45:08 -08:00
Jon Leighton
4754018272 find_target can be inherited 2011-01-11 13:45:07 -08:00
Jon Leighton
9086b02ba5 Document the recent changes to association assignment 2011-01-11 13:45:07 -08:00
Jon Leighton
6055bbedaa Raise ActiveRecord::RecordNotSaved if an AssociationCollection fails to be replaced 2011-01-11 13:45:07 -08:00
Jon Leighton
1d6e218428 When assigning a has_one, if anything fails, the assignment should be rolled back entirely 2011-01-11 13:45:07 -08:00
Jon Leighton
4e19ec566c In a number of places in the tests, we only need to turn off transactional fixtures when the DB does not support savepoints. This speeds the test run up by about 8-9% on my computer, when running rake test_sqlite3_mem :) 2011-01-11 13:45:07 -08:00
Jon Leighton
29452abb84 SQLite3 has supported savepoints since version 3.6.8, we should use this! 2011-01-11 13:45:07 -08:00
Jon Leighton
7f7b480098 When assigning a has_one, if the new record fails to save, raise an error 2011-01-11 13:45:07 -08:00
Jon Leighton
1bc71ed960 When assigning a has_one, if the existing record fails to be removed from the association, raise an error 2011-01-11 13:45:06 -08:00
Jon Leighton
c47c541402 Have a separate test connection directory for sqlite3 in-memory so that the tests can be run without having to specifically rename the connection file (which then causes git to pick up the changes) 2011-01-11 13:45:06 -08:00
Jon Leighton
80df74bf51 Enable the sqlite3 in-memory test connection to work 2011-01-11 13:45:06 -08:00
Jon Leighton
c6e10b0f60 has_one should always remove the old record (properly), even if not saving the new record, so we don't get the database into a pickle 2011-01-11 13:45:06 -08:00
Jon Leighton
665880c080 Return value is irrelevant here as the RHS of the assignment is always returned by methods ending in '=' 2011-01-11 13:45:06 -08:00
Jon Leighton
15adcc3927 Remove incorrect documentation about build_assoc on has_one. This is proven, for example, by test_successful_build_association in has_one_associations_test.rb 2011-01-11 13:45:06 -08:00
Jon Leighton
00dc8f77a2 For a singular association, it should be build_association, rather than association.build (as association may be nil) 2011-01-11 13:45:06 -08:00
Jon Leighton
1390a44328 Correctly indent the bullet points under 'One-to-one associations', so that the lines are not broken in the generated rdoc html 2011-01-11 13:45:05 -08:00
Aaron Patterson
f6b71dea15 avoid splatting arrays by using concat 2011-01-11 13:45:05 -08:00
Santiago Pastorino
a61e3acef2 html_safe.to_str makes no sense 2011-01-11 18:57:35 -02:00
Ernie Miller
7d4d745730 Fix polymorphic belongs_to associationproxy raising errors when loading target. 2011-01-11 09:19:19 -08:00
Aaron Patterson
a60ea74222 only use one array when collecting split up queries 2011-01-10 17:30:40 -08:00
Aaron Patterson
1cc556dc52 adding to_d to BigDecimal 2011-01-10 15:51:37 -08:00
Raimonds Simanovskis
f4f4964ce0 Always return decimal average of integer fields
In previous version if database adapter (e.g. SQLite and Oracle) returned non-String calculated values then type_cast_using_column converted decimal average value of intefer field to integer value. Now operation parameter is always checked to decide which conversion of calculated value should be done.
2011-01-10 15:51:32 -08:00
Aaron Patterson
0616585619 use SQLite3::VERSION rather than the deprecated class 2011-01-10 11:40:19 -08:00
Krekoten' Marjan
366e7854ac Refactor to handle the X-Cascade without having to raise an exception 2011-01-09 16:08:54 -08:00
Kevin Moore
3e2465521b Aligning master changelog w/ 3-0-stable 2011-01-09 16:07:25 -08:00
Jakub Kuźma
5106ce88e4 authenticity_token option for form_tag [#2988 state:resolved] 2011-01-09 15:55:26 -08:00
John Allison
5d1d9bfb05 Improve select helpers by allowing a selected value of false. This is useful when using a select helper with a boolean attribute, and the attribute is false. (e.g. f.select :allow_comments) 2011-01-09 15:45:55 -08:00
Katrina Owen
4690bee301 Adding postgresql template option when executing db:test:clone_structure
Specify the template to use in config/database.yml, e.g.

  test:
    adapter: postgresql
    template: template_postgis

If no template is specified, postgresql defaults to template1
2011-01-09 15:35:47 -08:00
Rizwan Reza
18605adec3 HTML5 button_tag helper
This tag is similar in nature to submit_tag, but allows more control.
It also doesn't submit if submit type isn't used, allowing JavaScript to
control the flow where required.

For more information: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#the-button-element
2011-01-09 15:22:23 -08:00
Santiago Pastorino
2b2b50660b Bump up bcrypt-ruby dependency to 2.1.4 2011-01-09 19:04:43 -02:00
Santiago Pastorino
75e89ed68e Initialize these options as false if they are not given 2011-01-09 16:54:03 -02:00
John Firebaugh
726a66a7a4 Expand and clarify AS::Callbacks docs. 2011-01-09 10:00:15 -08:00
Santiago Pastorino
14198d84a9 Remove InstanceTagMethods module and define the methods inside the InstanceTag class 2011-01-09 13:35:38 -02:00
Aaron Patterson
12f5158f09 remove unused string substitution 2011-01-08 20:15:15 -08:00
Aaron Patterson
3b677aa006 use select_all because not all database adapters support bind values 2011-01-08 19:59:31 -08:00
Vijay Dev
4d29816fda fixed query output 2011-01-09 02:24:30 +05:30
Vijay Dev
bc6e1a154a fix template url 2011-01-08 23:35:36 +05:30
Aaron Patterson
ec960c3730 join the cult of cargo. reduce the number of NoMethodErrors in the system 2011-01-07 18:45:30 -08:00
Aaron Patterson
36d7bd1898 stop creating intermediate AR objects, just construct AR objects from a list of hashes 2011-01-07 18:45:17 -08:00
Aaron Patterson
84f81f5779 no need for to_sym 2011-01-07 16:50:44 -08:00
Aaron Patterson
33ebf9bd56 String#insert() mutates the string, so no need for lasgn 2011-01-07 16:27:34 -08:00
Aaron Patterson
1e2ab564f9 fewer funcalls to the cached attributes variable 2011-01-07 16:27:34 -08:00
Jeremy Kemper
63ed6ca998 Add test for e0e3adf 2011-01-07 16:25:25 -08:00
Jon Leighton
82b0ce9c97 Refactor HasOneAssociation#replace 2011-01-07 15:03:16 -08:00
Jon Leighton
5b28e52542 Don't not remove double negatives 2011-01-07 15:03:16 -08:00
Jon Leighton
d23c332e02 Clean up create, create! and build in HasOneAssociation 2011-01-07 15:03:15 -08:00
Jon Leighton
5ecf692248 merge_with_conditions is not necessary because the conditions will already be in the scope_for_create hash in the scope 2011-01-07 15:03:15 -08:00
Jon Leighton
45d0d18bae Not really worth having the HasAssociation module for just a single method 2011-01-07 15:03:15 -08:00
Jon Leighton
770e6893b9 Construct an actual ActiveRecord::Relation object for the association scope, rather than a hash which is passed to apply_finder_options. This allows more flexibility in how the scope is created, for example because scope.where(a, b) and scope.where(a).where(b) mean different things. 2011-01-07 15:03:15 -08:00
Jon Leighton
441118458d Use encode_with for marshalling 2011-01-07 15:03:15 -08:00
Aaron Patterson
2efd780dcb send() will raise an ArgumentError, so we should leverage ruby 2011-01-07 14:30:20 -08:00
Aaron Patterson
6e63e7a874 no need for parens 2011-01-07 14:10:46 -08:00
Aaron Patterson
344a2d5adc use a hash for caching aggregations rather than ivars 2011-01-07 13:53:34 -08:00
Aaron Patterson
f3d92f0756 method is never called with arguments 2011-01-07 13:41:38 -08:00
Aaron Patterson
2ee4c8d90b only rescue from Mysql::Error exceptions [#6236 state:resolved] 2011-01-07 11:48:29 -08:00
Aaron Patterson
839f3bf682 just use a hash for doing association caching 2011-01-07 11:28:11 -08:00
Aaron Patterson
8a1c533780 no need for self 2011-01-06 15:15:36 -08:00
Nick Sutterer
7773c32400 corrected docs for Hash#to_xml and added examples. 2011-01-06 17:57:09 +01:00
Nick Sutterer
54f3aa8633 added tests for XmlMini#to_tag. 2011-01-06 17:56:22 +01:00
Ryan Bigg
f612069ae1 Fix documentation for validates_uniqueness_of to NOT have a :scope argument as the prime example. Show scope examples after prime example. 2011-01-06 20:10:01 +10:00
Ryan Bigg
a41d33431f config guide: add basic description for disable_dependency_loading initializer 2011-01-06 20:10:00 +10:00
Ryan Bigg
27717655ad Re-add "Using initializer files" section to configuring guide 2011-01-06 20:10:00 +10:00
Aaron Patterson
eba8411652 adding an encode_with method for Psych dump/load methods 2011-01-05 14:59:19 -08:00
Aaron Patterson
97bc74c746 make sure new objects can round trip 2011-01-05 14:03:13 -08:00
Aaron Patterson
6d74710828 make sure that Psych can roundtrip an AR object 2011-01-05 14:01:47 -08:00
Vijay Dev
75bfb4761c fixes rubycentral url and a minor AR change 2011-01-06 03:24:34 +05:30
Aaron Patterson
9731c862ec AR internals expect a normal hash, otherwise there are serialization incompatibilities 2011-01-05 13:50:08 -08:00
Aaron Patterson
64c82f9ec6 only define log_level reader once, make sure to initialize @log_level 2011-01-05 11:19:09 -08:00
Aaron Patterson
c7dce2c7b2 no need to specify self 2011-01-05 11:08:21 -08:00
Aaron Patterson
102255330b no need to send a symbol to send() 2011-01-05 10:50:46 -08:00
Aaron Patterson
90171ad833 avoid creating so many Arel::Table objects 2011-01-05 10:29:06 -08:00
Aaron Patterson
9f1b0b32e2 use attr_reader and alias methods to access instance variables 2011-01-05 09:58:25 -08:00
Aaron Patterson
8bdc191994 we have a method for this, so let's use it 2011-01-05 09:51:09 -08:00
Aaron Patterson
e468a62dc8 use arel ast construction rather than generating strings 2011-01-05 09:47:13 -08:00
Aaron Patterson
35a225535f use arel to construct AST rather than generate strings 2011-01-05 09:23:30 -08:00
Hemant Kumar
8de5595e4d fix difference between behaviour of blank and empty
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-01-05 13:18:10 +01:00
Aaron Patterson
5c66677987 make our yaml output consistent 2011-01-04 17:29:40 -08:00
Aaron Patterson
7bd32e4d1d add Psych::SyntaxError to the list of rescued YAML exceptions 2011-01-04 16:52:47 -08:00
Aaron Patterson
3f4143eedb fixing merge errors 2011-01-04 15:16:56 -08:00
Aaron Patterson
3f7e097464 Merge remote branch 'rsim/require_deprecation'
* rsim/require_deprecation:
  require ActiveSupport deprecatation file before using deprecate method in database_statements
2011-01-04 15:09:22 -08:00
Aaron Patterson
c08fccf980 Merge remote branch 'rsim/habtm_select_fix'
* rsim/habtm_select_fix:
  Explicitly select * from has_and_belongs_to_many association tables, simplify exists? query
2011-01-04 15:08:28 -08:00
Aaron Patterson
4fabad7cf1 test that the custom ordered hash can be round-tripped 2011-01-04 15:07:15 -08:00
Aaron Patterson
a84b84efac require Psych if possible, use Psych output when enabled 2011-01-04 15:07:15 -08:00
Aaron Patterson
b1dc9c004e use dots for method calls 2011-01-04 15:07:15 -08:00
Pratik Naik
a8a704b07c Bump rack-test version 2011-01-04 19:30:52 +00:00
Prem Sichanugrist
4805ec1449 Add test cases for model and migration generators which use change method. 2011-01-04 11:17:07 -08:00
Prem Sichanugrist
ad343d7263 Use Rails 3.1 change method in 'add_' migration generator 2011-01-04 11:16:52 -08:00
Prem Sichanugrist
9e64dfad0d Use Rails 3.1 change method in model generator 2011-01-04 11:16:52 -08:00
Raimonds Simanovskis
9c1c551f25 Explicitly select * from has_and_belongs_to_many association tables, simplify exists? query
Previous version (after commit 3103296a61) was generating wrong SQL for Oracle when calling exists? method on HABTM association.
2011-01-04 17:06:33 +02:00
Raimonds Simanovskis
1d758d9086 require ActiveSupport deprecatation file before using deprecate method in database_statements
otherwise when using external ActiveRecord adapters (e.g. Oracle) database_statements might be loaded before active_support/core_ext/module/deprecation which results in NoMethodError (commit 60cf65def8 added "deprecate" call to database_statements.rb)
2011-01-04 11:21:03 +02:00
Jon Leighton
40afcade0d Remove undocumented feature from has_one where you could pass false as the second parameter to build_assoc or create_assoc, and the existing associated object would be untouched (the foreign key would not be nullified, and it would not be deleted). If you want behaviour similar to this you can do the following things:
* Use :dependent => :nullify (or don't specify :dependent) if you want to prevent the existing associated object from being deleted
* Use has_many if you actually want multiple associated objects
* Explicitly set the foreign key if, for some reason, you really need to have multiple objects associated with the same has_one. E.g.

    previous = obj.assoc
    obj.create_assoc
    previous.update_attributes(:obj_id => obj.id)
2011-01-03 16:24:32 -08:00
Jon Leighton
2120da7f73 ActiveRecord::Relation#primary_key should return a string, just like ActiveRecord::Base.primary_key does. 2011-01-03 16:24:32 -08:00
Jon Leighton
0619dc2319 Implement deprecated version of AssociationReflection#primary_key_name, which has been renamed to #foreign_key. Also bumping the deprecation_horizon in Active Support to 3.1. 2011-01-03 16:24:32 -08:00
Jon Leighton
a9bed985cf When preloading a belongs_to, the target should still be set (to nil) if there is no foreign key present. And the loaded flag should be set on the association proxy. This then allows us to remove the foreign_key_present? check from BelongsToAssociation#find_target. Also added a test for the same thing on polymorphic associations. 2011-01-03 16:24:32 -08:00
Jon Leighton
99a8d8430f Create the association scope directly rather than going through with_scope 2011-01-03 16:24:32 -08:00
Jon Leighton
1313d386da Make Relation#create_with always merge rather than overwrite, not just when merging two relations. If you wish to overwrite, you can do relation.create_with(nil), or for a specific attribute, relation.create_with(:attr => nil). 2011-01-03 16:24:32 -08:00
Jon Leighton
31d101879f Use the association directly in other places too 2011-01-03 16:24:32 -08:00
Jon Leighton
3103296a61 Let AssociationCollection#find use #scoped to do its finding. Note that I am removing test_polymorphic_has_many_going_through_join_model_with_disabled_include, since this specifies different behaviour for an association than for a regular scope. It seems reasonable to expect scopes and association proxies to behave in roughly the same way rather than having subtle differences. 2011-01-03 16:24:31 -08:00
Jon Leighton
d6289aadce Fix test_any in relations_test.rb, which was failing when relations_test.rb is run on its own (it passes when the entire suite is run). This is a hacky fix for a problem I didn't quite get to the bottom of, so I'd welcome a better solution... 2011-01-03 16:24:31 -08:00
Jon Leighton
4e194ed1e6 Rename AssociationProxy#foreign_key_present to foreign_key_present? 2011-01-03 16:24:31 -08:00
Jon Leighton
a0be389d39 Allow assignment on has_one :through where the owner is a new record [#5137 state:resolved]
This required changing the code to keep the association proxy for a belongs_to around, despite its target being nil. Which in turn required various changes to the way that stale target checking is handled, in order to support various edge cases (loaded target is nil then foreign key added, foreign key is changed and then changed back, etc). A side effect is that the code is nicer and more succinct.

Note that I am removing test_no_unexpected_aliasing since that is basically checking that the proxy for a belongs_to *does* change, which is the exact opposite of the intention of this commit. Also adding various tests for various edge cases and related things.

Phew, long commit message!
2011-01-03 16:24:31 -08:00
Jon Leighton
c47f802d0e Have a proper AssociationReflection#foreign_type method rather than using options[:foreign_type] 2011-01-03 16:24:31 -08:00
Jon Leighton
d18a27031f Add documentation for the :foreign_type option on belongs_to 2011-01-03 16:24:30 -08:00
Jon Leighton
16065b4f19 Some basic tests for the :foreign_type option on belongs_to, which was previously completely untested. 2011-01-03 16:24:30 -08:00
Aaron Patterson
60cf65def8 herp derpricating add_limit_offset! 2011-01-03 15:59:13 -08:00
Robert Pankowecki (Gavdi)
b9ce3419e5 User id instead of quoted_id to prevent double quoting. Fixes failing test for bug #6036. 2011-01-04 01:21:26 +08:00
Robert Pankowecki (Gavdi)
febdf5a5a9 Added one more failing test for bug #6036 2011-01-04 01:21:25 +08:00
Karel Minarik
1877faa7ac [FIX] Renamed ENV['LANG'] for generating translated guides to ENV['LANGUAGE'] so there's no mixup with OS env vars 2011-01-02 22:09:09 +01:00
Vijay Dev
a388c10f96 Fix typos and JavaScript case. 2011-01-03 02:08:08 +05:30
Xavier Noria
99424eb099 Revert "Update CHANGELOGs to include 3.0.3 changes"
Reason: Sorry, CHANGELOGs can only be edited in master.
If you provide a patch I'll apply it myself. Thanks!

This reverts commit 1f8ecb85d7.
2011-01-02 00:20:59 +01:00
Vijay Dev
231e6b7e66 Merge branch 'master' of github.com:lifo/docrails 2011-01-02 02:54:36 +05:30
Vijay Dev
ebb732a7ec fix typos 2011-01-02 02:53:15 +05:30
Prem Sichanugrist
1f8ecb85d7 Update CHANGELOGs to include 3.0.3 changes 2011-01-02 03:35:38 +07:00
Prem Sichanugrist
fd1daf9a8e Make sure that generator's default banner is showing its namespace
This will make `rails g rspec:install --help` shows "rails generate rspec:install [options]" and not "rails generate install  [options]"
2011-01-01 11:58:09 -08:00
Aaron Patterson
5c7fd87665 Merge remote branch 'jonleighton/association_fixes' into fuuu
* jonleighton/association_fixes:
  Rename AssociationReflection#primary_key_name to foreign_key, since the options key which it relates to is :foreign_key
  Support for :counter_cache on polymorphic belongs_to
  Refactor BelongsToAssociation to allow BelongsToPolymorphicAssociation to inherit from it
  Specify the STI type condition using SQL IN rather than a whole load of ORs. Required a fix to ActiveRecord::Relation#merge for properly merging create_with_value. This also fixes a situation where the type condition was appearing twice in the resultant SQL query.
  Verify that when has_many associated objects are destroyed via :dependent => :destroy, when the parent is destroyed, the callbacks are run
  Get rid of extra_conditions param from configure_dependency_for_has_many. I can't see a particularly plausible argument for this being used by plugins, and if they really want they can just redefine the callback or whatever. Note also that before my recent commit the extra_conditions param was completely ignored for :dependent => :destroy.
  And owner_quoted_id can go too
  Now we can drop-kick AssociationReflection#dependent_conditions into oblivion.
  Refactor configure_dependency_for_has_many to use AssociationCollection#delete_all. It was necessary to change test_before_destroy in lifecycle_test.rb so that it checks topic.replies.size *before* doing the destroy, as afterwards it will now (correctly) be 0.
2011-01-01 11:43:53 -08:00
Karel Minarik
56221faecd Added support for generating translated guides (stored in source/<LANG>) via setting the LANG environment variable 2011-01-01 18:01:11 +01:00
Santiago Pastorino
171172f324 render :template is faster than render :file 2011-01-01 13:44:34 -02:00
Santiago Pastorino
9bc879d42a This is not needed anymore 2011-01-01 13:20:00 -02:00
Jon Leighton
1267598881 Rename AssociationReflection#primary_key_name to foreign_key, since the options key which it relates to is :foreign_key 2010-12-31 20:00:45 +00:00
Jon Leighton
3c400627eb Support for :counter_cache on polymorphic belongs_to 2010-12-31 20:00:44 +00:00
Jon Leighton
bea4065d3c Refactor BelongsToAssociation to allow BelongsToPolymorphicAssociation to inherit from it 2010-12-31 20:00:44 +00:00
Jon Leighton
62b084f807 Specify the STI type condition using SQL IN rather than a whole load of ORs. Required a fix to ActiveRecord::Relation#merge for properly merging create_with_value. This also fixes a situation where the type condition was appearing twice in the resultant SQL query. 2010-12-31 20:00:44 +00:00
Jon Leighton
2bf3186803 Verify that when has_many associated objects are destroyed via :dependent => :destroy, when the parent is destroyed, the callbacks are run 2010-12-31 20:00:44 +00:00
Jon Leighton
f7a15d0e03 Get rid of extra_conditions param from configure_dependency_for_has_many. I can't see a particularly plausible argument for this being used by plugins, and if they really want they can just redefine the callback or whatever. Note also that before my recent commit the extra_conditions param was completely ignored for :dependent => :destroy. 2010-12-31 20:00:44 +00:00
Jon Leighton
6db9085159 And owner_quoted_id can go too 2010-12-31 20:00:44 +00:00
Jon Leighton
b0bb911fa1 Now we can drop-kick AssociationReflection#dependent_conditions into oblivion. 2010-12-31 20:00:44 +00:00
Jon Leighton
38fbfa6390 Refactor configure_dependency_for_has_many to use AssociationCollection#delete_all. It was necessary to change test_before_destroy in lifecycle_test.rb so that it checks topic.replies.size *before* doing the destroy, as afterwards it will now (correctly) be 0. 2010-12-31 20:00:44 +00:00
Piotr Sarnacki
27ea0481bb Recreate symlink in layouts for tests 2010-12-31 14:22:27 +01:00
Piotr Sarnacki
484d2aaed7 Do not take gems' i18n locales while testing locales paths 2010-12-31 13:56:07 +01:00
Piotr Sarnacki
8e5d91062f Don't be so picky on MissingTemplate error details, this fails randomly on 1.8.7 because of not ordered hash 2010-12-31 11:17:37 +01:00
Nick Sutterer
4c44f0468a added tests for the MissingTemplate exception message. 2010-12-31 10:41:19 +01:00
Xavier Noria
65d389955f Merge branch 'master' of git://github.com/lifo/docrails 2010-12-31 10:22:34 +01:00
Ryan Bigg
224e2d478a Routing guide: clarify what the :as option does for scopes 2010-12-31 17:50:37 +10:00
Ryan Bigg
9aef64f7a3 Routing guide: move scope documentation down to where it is referenced more plainly 2010-12-31 17:45:03 +10:00
Ryan Bigg
eaf67ca9c3 Routing guide: improve documentation for the scope method, demonstrating use of named parameters 2010-12-31 17:38:38 +10:00
Timothy N. Tsvetkov
e5b84fd723 ActionController::Base.helpers.sanitize ignores case in protocol
[#6044 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-12-30 22:43:43 -02:00
Pratik Naik
573fd39e22 Make sure Model#touch doesn't try to update non existing columns 2010-12-30 18:42:18 +00:00
Xavier Noria
eb1e727544 contrib_guide.gsub!("aptitude", "apt-get")
It turns out aptitude has been removed from Ubuntu 10.10
and while you can manually install it, apt-get is the
blessed package manager. Google for "aptitude removed
from Ubuntu" for more details. Thanks to Rafael Mendonça
França for pointing this out.
2010-12-30 07:13:04 +01:00
Nick Sutterer
db24701abe process_action accepts multiple args, even with Callbacks. 2010-12-29 16:37:10 -08:00
Xavier Noria
69765aad8b Merge branch 'master' of git://github.com/lifo/docrails 2010-12-29 23:46:03 +01:00
Pratik Naik
0ac66caac5 Fix Duration#to_json 2010-12-29 22:20:14 +00:00
David Heinemeier Hansson
43433b3fb4 Instance methods shouldnt be added until you actually call has_secure_password 2010-12-29 10:18:14 -08:00
Pratik Naik
fd1cf13f74 Make serialized fixtures work again 2010-12-29 16:15:45 +00:00
Cheah Chu Yeow
6f58b9ad53 Fix typo in ActionPack changelog. 2010-12-29 19:36:00 +08:00
Cheah Chu Yeow
a21a3d1f44 Remove link to outdated Github tag comparison in ActionPack changelog. 2010-12-29 19:35:33 +08:00
Xavier Noria
83e1938916 renames the contrib guide in the index 2010-12-29 11:42:11 +01:00
Xavier Noria
5fc02dbd03 since a lot of people use Ubuntu, document specific aptitude calls for some C dependencies in the contrib guide 2010-12-29 11:38:54 +01:00
Santiago Pastorino
bf22b287a4 Do not use primary key on insertion when it's nil 2010-12-29 01:22:43 -02:00
Ryan Bigg
60447d8b00 Routing guide: mention that routes are matched from the top down in a note. 2010-12-29 10:57:59 +10:00
Neeraj Singh
27d0d4fffd while defining callbacks option :rescuable => true
can be passed. There were no tests for this case.

This patch adds a test for :rescuable => true
option.
2010-12-29 05:32:23 +08:00
Vijay Dev
dd166c60c4 fixed incorrect spacing from 9836854671 2010-12-29 02:09:47 +05:30
Vijay Dev
9836854671 fixed examples & minor typos 2010-12-29 02:07:22 +05:30
Xavier Noria
6b43a3a627 complete revision of the Contributing to Ruby on Rails guide
* adds instructions for PostgreSQL
* adds references to mysql2 here and there
* puts documentation contributions on par with code contributions
* adds a section about Rails Contributors
* documents C dependencies for Nokogiri and the database libs
* everything double-checked and revised step by step
* adds a section about warnings in the test suite
* removes section about the Rails wiki
* title and filename renamed
* overall rewording
2010-12-28 20:36:42 +01:00
Santiago Pastorino
eb2ebe7680 Simplify inspect implementation
After 304d38c053 we don't need the
new_record? check anymore.
2010-12-28 15:45:35 -02:00
Karel Minarik
9f75545e5d Added information about invoking migrations in non-default environments to NOTE box in the "Getting Started" guide
Reason: When the guide already mentions "default environment", I think it is more then appropriate to tell the whole story.
2010-12-28 17:30:13 +01:00
Karel Minarik
cb4b5c8ad3 Adding information and link to guide on customizing generators into "Getting Started" guide. 2010-12-28 16:38:50 +01:00
Santiago Pastorino
304d38c053 Allow primary_key to be an attribute when the model is a new record 2010-12-28 10:11:27 -02:00
Karel Minarik
8031b7e42b Fixed incorrect instructions for calling the rails command explicitely in the "Getting Started" guide 2010-12-28 10:25:55 +01:00
Karel Minarik
e2c2c2983a Added TIP box with information about the --database switch for the application generator in the "Getting Started" guide 2010-12-28 09:25:18 +01:00
Karel Minarik
8e8c13ab1e Fixed incorrect command for displaying options for new application Generator in Getting Started guide 2010-12-28 08:45:09 +01:00
Ryan Bigg
bb99c944d3 There's a couple -> There are a couple 2010-12-28 17:32:41 +10:00
Ryan Bigg
777a1f125d Init guide: begin down the rabbit warren that is active_record/railtie 2010-12-28 16:01:16 +10:00
Ryan Bigg
591c011238 Init: finish coverage of railties/lib/rails.rb 2010-12-28 15:10:13 +10:00
Ryan Bigg
8447754343 init guide: Cover the action_dispatch/railtie require from rails.rb 2010-12-28 15:06:26 +10:00
Ryan Bigg
02bb7e9b98 Remove old initialization guide text. Too much has changed for all of this to be useful. 2010-12-28 14:22:42 +10:00
Ryan Bigg
5196333d6c init guide: cover active_support/railtie.rb 2010-12-28 14:19:49 +10:00
Ryan Bigg
61e6a9f9d4 Init guide: Segue between rails/version and active_support/railtie requires 2010-12-28 14:19:05 +10:00
Ryan Bigg
0dd5433b98 Cover the inherited method from Rails::Railtie being used when I18n::Railtie is loaded. 2010-12-28 14:13:43 +10:00
Ryan Bigg
6777b7a886 Init guide: finish covering the process of the i18n_railtie.rb file. 2010-12-28 14:04:19 +10:00
Ryan Bigg
7b7537317c init guide: active_support/railtie does not require itself, actually requires i18n_railtie 2010-12-28 14:04:02 +10:00
Ryan Bigg
2f57353023 Init guide: finish covering initializers for i18n_railtie, moving on to covering after_initialize 2010-12-28 13:23:50 +10:00
Ryan Bigg
01febdadea init guide: active_support/inflector/methods is loaded by active_support/autoload first. 2010-12-28 13:22:28 +10:00
Aaron Patterson
897b56bb2f I N C E P T I O N: flatten_deeper works around a bug in Ruby 1.8.2. 2010-12-27 12:47:30 -07:00
José Valim
ecc83c1e6e Clean up PathSet. 2010-12-27 10:15:54 +01:00
Ryan Bigg
62dd85cc83 Init guide: cover Railtie::Configuration and begin to cover the Initializer class and friends. 2010-12-27 19:14:44 +10:00
José Valim
6b099975fa No need to symbolize these. 2010-12-27 09:30:36 +01:00
José Valim
51a7d9acdd Final tidy up on templates inheritance. 2010-12-27 09:14:13 +01:00
wycats
e03e1fdbc8 Speed up template inheritance and remove template inheritance option 2010-12-26 23:56:09 -08:00
wycats
7c568fda6b A bunch of cleanup on the inherited template patch 2010-12-26 23:44:51 -08:00
artemave
6c5a3bb312 all tests pass 2010-12-26 22:32:15 -08:00
artemave
ce21ea7832 #948 make template inheritance optional 2010-12-26 22:32:15 -08:00
artemave
ddd85ef9c6 #948 template_inheritance 2010-12-26 22:32:15 -08:00
Aaron Patterson
9bac649fa4 try not to make so many funcalls 2010-12-26 20:22:13 -07:00
Aaron Patterson
67da590979 make our hash of klasses and ids actually have classes for keys 2010-12-26 20:15:09 -07:00
Ryan Bigg
a78e5bcfe4 Init guide: Cover the config variable set up which is referenced in i18n_railtie 2010-12-27 13:02:51 +10:00
Aaron Patterson
7e91ad3f89 stop calling deprecated apis 2010-12-26 19:56:18 -07:00
Jon Leighton
9f5c18ce07 Refactor we_can_set_the_inverse_on_this? to use a less bizarre name amongst other things 2010-12-26 16:27:12 -07:00
Xavier Noria
57420dffb6 small rewording of my entry in the credits 2010-12-26 21:27:00 +01:00
Xavier Noria
71775807c1 no docs credits are written in first person, thanks to Vijay Dev for spotting this 2010-12-26 21:15:33 +01:00
Jon Leighton
b0498372a1 Add a HasAssociation module for common code for has_* associations 2010-12-26 19:38:04 +00:00
Jon Leighton
0c272471fe Remove AssociationProxy#dependent? - it's badly named and only used in one place 2010-12-26 19:38:04 +00:00
Jon Leighton
e8ada11aac Associations: DRY up the code which is generating conditions, and make it all use arel rather than SQL strings 2010-12-26 19:38:04 +00:00
Jon Leighton
f2230c06ed Fix dodgy tests which were effectively asserting nil == nil 2010-12-26 19:38:04 +00:00
Jon Leighton
7021b6b851 Remove custom_select param from construct_select, as it isn't used 2010-12-26 19:38:04 +00:00
Jon Leighton
d7a659334c Remove construct_from from ThroughAssociationScope - it's not called from anywhere 2010-12-26 19:38:04 +00:00
Jon Leighton
93861d19e3 Set the create scope to an empty hash in ThroughAssociationScope. For reasoning please see the inline code comments. 2010-12-26 18:46:58 +00:00
Jon Leighton
ac67eee4e6 Use conditionals and implicit returns rather than explicit returns and postfix ifs (it's easier to read) 2010-12-26 18:46:58 +00:00
Jon Leighton
739ea1fbfe Remove has_cached_counter? and cached_counter_attribute_name from HasManyThroughAssociation, as the exact same methods are inherited from HasManyAssociation 2010-12-26 18:46:58 +00:00
Jon Leighton
99db97a322 Remove pointless use of 'private' 2010-12-26 18:46:58 +00:00
Jon Leighton
3eef0977e1 Use the through association proxy for operations on the through record, so that those operations are automatically scoped and therefore construct_join_attributes does not need to use construct_owner_attributes. 2010-12-26 18:46:58 +00:00
Jon Leighton
b5c30f9dac Remove target_obsolete? which is not called from anywhere 2010-12-26 18:46:58 +00:00
Jon Leighton
c6e0433ca3 scoped.where_values_hash is never nil 2010-12-26 18:46:58 +00:00
Vijay Dev
50a2edbce6 fix spacing 2010-12-26 23:00:03 +05:30
Vijay Dev
e856318497 changed template gist to reflect Rails 3 and documented the add_source method to source gems from different locations 2010-12-26 22:57:45 +05:30
Vijay Dev
603e0f155d use new routes in templates 2010-12-26 22:10:56 +05:30
Santiago Pastorino
57f5fe1850 Update JQuery UJS 2010-12-26 08:34:47 -02:00
Santiago Pastorino
e9a04320d7 Update Prototype UJS 2010-12-26 08:28:13 -02:00
Akira Matsuda
a329e7d9af use https to fetch files from GitHub
see: https://github.com/blog/738-sidejack-prevention-phase-2-ssl-everywhere

[#6223 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-12-26 08:20:36 -02:00
Aaron Patterson
d767252d72 refactor to use group_by 2010-12-25 16:47:59 -07:00
Aaron Patterson
bde643fbec arel will deal with casting the ids, so we can delete this 2010-12-25 16:42:49 -07:00
Aaron Patterson
75ac9c4271 use arel to determine selection column 2010-12-25 16:38:59 -07:00
Aaron Patterson
33b5a2637f refactoring method selection 2010-12-25 16:36:07 -07:00
Aaron Patterson
5b918bb97c using arel to compile sql statements 2010-12-25 16:19:59 -07:00
Aaron Patterson
0a609eea50 use sql literal factory method 2010-12-25 15:25:11 -07:00
Aaron Patterson
a6fe244e9b take more advantage of arel sql compiler 2010-12-25 15:23:45 -07:00
Aaron Patterson
3fe9951fcc refactoring AST building 2010-12-25 14:34:13 -07:00
Aaron Patterson
f855090a78 use arel to compile SQL statements 2010-12-25 14:31:22 -07:00
Vijay Dev
9ed385fe17 fix formatting 2010-12-26 00:09:08 +05:30
Vijay Dev
2801efbc3b use all and first instead of find(:all) and find(:first) 2010-12-25 23:59:57 +05:30
Vijay Dev
c6b9e47d5c use new routes 2010-12-25 23:27:15 +05:30
Vijay Dev
8618ef7537 highlighted find(array of keys) behaviour when one or more record is not found 2010-12-25 22:07:31 +05:30
Vijay Dev
b30293f2f6 minor edit 2010-12-25 22:04:05 +05:30
Aaron Patterson
ec13305b21 stop redifining methods on every call to set_primary_key 2010-12-24 22:15:41 -07:00
Aaron Patterson
23b03baba6 use the sql literal factory method 2010-12-24 16:01:07 -07:00
Aaron Patterson
0fbf829b1e stop the recursive insanity 2010-12-24 15:59:02 -07:00
Aaron Patterson
34d79fad85 setting the primary key on the update manager 2010-12-24 15:59:02 -07:00
Vijay Dev
fdfa7dc648 fixed comment - same as 592f600 2010-12-25 01:52:28 +05:30
Vijay Dev
c6adc64e00 Merge branch 'master' of github.com:lifo/docrails 2010-12-25 01:31:00 +05:30
Vijay Dev
5cefa00d91 removed dup link to 'getting started' 2010-12-25 01:30:51 +05:30
Akira Matsuda
4e50c6c08a .erb => .html.erb 2010-12-25 04:58:11 +09:00
Vijay Dev
866647fdb1 Merge branch 'master' of github.com:lifo/docrails 2010-12-25 01:21:55 +05:30
Vijay Dev
592f6004e1 fixed comment in w3c_validator 2010-12-25 01:19:33 +05:30
Akira Matsuda
0a1f5f7511 for ... in => each ... do 2010-12-25 04:46:41 +09:00
Vijay Dev
f17e1b2f7f clean up plugin references 2010-12-25 01:04:10 +05:30
Vijay Dev
caca58e4da fixed typos and cut down the spaces 2010-12-25 00:56:39 +05:30
Vijay Dev
517b37146a minor edits 2010-12-25 00:38:03 +05:30
Santiago Pastorino
2cbf948f25 Bump up rack-cache 2010-12-24 14:38:18 -02:00
Moiz Raja
e38cacb8ee correct links to rack articles 2010-12-23 22:51:12 -08:00
Xavier Noria
8cdb758081 Merge branch 'master' of github.com:rails/rails 2010-12-24 01:55:35 +01:00
Xavier Noria
3822673151 Merge branch 'master' of git://github.com/lifo/docrails 2010-12-24 01:55:12 +01:00
Ryan Bigg
d1e95e12b4 Revert "Query guide: arel_table, eq and eq_any" along with other commits that added documentation involving the arel_table method
This reverts commit 578f9711fd.

Conflicts:

	railties/guides/source/active_record_querying.textile
2010-12-24 10:47:38 +10:00
oleg dashevskii
6974c595fd Verify that there is no unwanted implicit readonly set on Model.has_many_through.find(id) [#5442 state:resolved] 2010-12-23 15:19:18 -08:00
Jon Leighton
fb3a8c51b4 Raise an error for associations which try to go :through a polymorphic association [#6212 state:resolved] 2010-12-23 15:19:18 -08:00
Jon Leighton
1c07b84df9 If a has_many goes :through a belongs_to, and the foreign key of the belongs_to changes, then the has_many should be considered stale. 2010-12-23 15:19:18 -08:00
Jon Leighton
2d9626fc74 Improved strategy for updating a belongs_to association when the foreign key changes. Rather than resetting each affected association when the foreign key changes, we should lazily check for 'staleness' (where fk does not match target id) when the association is accessed. 2010-12-23 15:19:18 -08:00
Jon Leighton
3f17ed407c Test to verify that #2189 (count with has_many :through and a named_scope) is fixed 2010-12-23 15:19:18 -08:00
Jon Leighton
1619c2435b Revert "Optimize <association>_ids for hm:t with belongs_to source". The optimisation has too many edge cases, such as when the reflection, source reflection, or through reflection has conditions, orders, etc. [#6153 state:resolved]
This reverts commit 373b053dc8.

Conflicts:

	activerecord/lib/active_record/associations.rb
2010-12-23 15:19:18 -08:00
Jon Leighton
4e13625818 Test demonstrating problem with foo.association_ids where it's a has_many :through with :conditions, with a belongs_to as the source reflection 2010-12-23 15:19:18 -08:00
Jon Leighton
ff7bde62c8 When a has_many association is not :uniq, appending the same record multiple times should append it to the @target multiple times [#5964 state:resolved] 2010-12-23 15:19:17 -08:00
Michał Łomnicki
030480ac1f Fix behaviour of foo.has_many_through_association.select('custom select') [#6089 state:resolved] 2010-12-23 15:19:17 -08:00
Szymon Nowak
85683f2a79 Fix creation of has_many through records with custom primary_key option on belongs_to [#2990 state:resolved] 2010-12-23 15:19:17 -08:00
Will Bryant
b79823832e Verify that has_one :through preload respects the :conditions [#2976 state:resolved] 2010-12-23 15:19:17 -08:00
Jon Leighton
c6db37e69b Don't allow a has_one association to go :through a collection association [#2976 state:resolved] 2010-12-23 15:19:17 -08:00
Ryan Bigg
e4314e7d3f Query guide: visists => visits 2010-12-24 07:23:12 +10:00
Vijay Dev
06e2f7cd17 minor convention edit 2010-12-24 00:34:07 +05:30
Vijay Dev
f1eb69c5b2 fixing typo that crept in 2c8938f 2010-12-24 00:24:26 +05:30
Vijay Dev
5683d6883b It's JavaScript :) 2010-12-24 00:19:41 +05:30
Vijay Dev
2c8938fcba fixed inject example and some minor edits 2010-12-24 00:03:51 +05:30
José Valim
d6efd3cfc2 Don't deprecate to_prepare. 2010-12-23 19:21:14 +01:00
José Valim
819b8cae40 Clean up callbacks should also be called on exceptions. 2010-12-23 19:17:02 +01:00
Vijay Dev
bb707cf737 indentation fix 2010-12-23 23:34:28 +05:30
Aaron Patterson
df3cfa6aae avoid duping and new objects 2010-12-23 07:33:28 -08:00
Raimonds Simanovskis
2b795050de fixed retrieval of primary key value in Ralation#insert method
previously primary key value was always assigned nil which caused Oracle enhanced adapter failing tests
2010-12-23 23:22:00 +08:00
Raimonds Simanovskis
d9c8c47e3d Fix for default_scope tests to ensure comparing of equally sorted lists
This is additional fix for commit
ebc47465a5 Respect the default_scope on a join model when reading a through association
which otherwise was failing on Oracle (as it returned fixture comments in different order).
2010-12-23 23:19:59 +08:00
Rizwan Reza
9dfa06acb4 Edits to caching/fragments. 2010-12-23 16:29:40 +03:30
Rizwan Reza
0997d5a12d More minor edits. 2010-12-23 16:13:36 +03:30
Rizwan Reza
5fb2f0c07f Revised documentation for cache_helper. 2010-12-23 16:06:53 +03:30
Ryan Bigg
890105f4f1 Query guide: add or conditions 2010-12-23 22:15:08 +10:00
Ryan Bigg
8713bb6ab8 Query guide: cover further ARel methods 2010-12-23 18:36:39 +10:00
Ryan Bigg
6271f3f16b Query guide: Document "in" methods 2010-12-23 16:39:10 +10:00
Ryan Bigg
578f9711fd Query guide: arel_table, eq and eq_any 2010-12-23 16:06:29 +10:00
Ryan Bigg
cef17cd705 Query guide: specify what type of objects scopes return 2010-12-23 15:44:12 +10:00
Ryan Bigg
0795c3a15e Query guide: Ordering, selecting and so on shouldn't be nested in conditions as they are modifiers, not conditions in the prime sense of the word. 2010-12-23 15:05:17 +10:00
Ryan Bigg
c3748190f4 Query Guide: update Changelog 2010-12-23 14:59:22 +10:00
Ryan Bigg
226a2a90ed Query guide: class methods are still available on associations 2010-12-23 14:58:33 +10:00
Ryan Bigg
0644e38c42 Query guide: scopes with arguments should be instead defined as class methods. 2010-12-23 14:57:53 +10:00
Ryan Bigg
b4b2574a12 Query guide: fix indentation 2010-12-23 14:55:42 +10:00
Ryan Bigg
f411451ed5 Remove comma [samuelkadoph] 2010-12-23 14:53:26 +10:00
Ryan Bigg
28b1642561 Query guide: lambdas must be used when working with scopes 2010-12-23 14:50:40 +10:00
Ryan Bigg
5b19579ab3 Init guide: further revision, covering rails/plugin.rb and friends 2010-12-23 14:36:24 +10:00
Ryan Bigg
f183668ff9 Querying guide: Add mention of the scope method 2010-12-23 14:36:24 +10:00
Aaron Patterson
c7f81f14df arel can escape the id, so avoid using the database connection 2010-12-22 19:20:08 -08:00
Aaron Patterson
83ffb82fb9 Arel::Table#[] always returns an attribute, so no need for || 2010-12-22 19:17:44 -08:00
Aaron Patterson
35f5938c91 probably should use the some_ids variable here. o_O 2010-12-22 18:30:18 -08:00
Aaron Patterson
3e64336647 removing SQL interpolation, please use scoping and attribute conditionals as a replacement 2010-12-22 18:23:38 -08:00
Aaron Patterson
6ca921a98c use arel to compile SQL rather than build strings 2010-12-22 18:23:37 -08:00
Aaron Patterson
2de9b858a0 to_sym stuff before passing it to arel 2010-12-22 18:23:37 -08:00
Aaron Patterson
186a1b1144 build an AST rather than build SQL strings 2010-12-22 18:23:37 -08:00
Santiago Pastorino
5853583f9b Allow registering javascript/stylesheet_expansions to existing symbols 2010-12-22 21:53:24 -02:00
Xavier Noria
0b5222fa45 API guidelines: RDoc markup documentation has been moved in RDoc 3 2010-12-23 00:23:22 +01:00
Xavier Noria
8a3132b8a9 Merge branch 'master' of git://github.com/lifo/docrails 2010-12-23 00:15:10 +01:00
Xavier Noria
55f2e9f898 removes binary? hack for RDoc, API requires RDoc 3 and horo 1.0.3 2010-12-23 00:05:38 +01:00
Vijay Dev
15ce225ab0 fix typo 2010-12-22 23:47:23 +05:30
Vijay Dev
90ef676c7f remove duplication of links 2010-12-22 23:47:09 +05:30
Piotr Sarnacki
09195f10bd Do not use the same hash instance for expansions [#6114 state:resolved]
Using the same hash instance makes using the same expansions for
both javascripts and stylesheets.
2010-12-22 09:44:46 +01:00
Piotr Sarnacki
b613145284 Fix activesupport tests. These classes are not used anywhere 2010-12-22 09:44:46 +01:00
Piotr Sarnacki
1a2c427991 Ensure that uncountable are removed after test 2010-12-22 09:44:46 +01:00
John Paul Ashenfelter
9b4622a483 Added a word boundary to uncountable inflection regex for #singularize so short inflections like ors do not affect larger words like sponsors [#6093 state:resolved] 2010-12-22 09:44:46 +01:00
Lee Reilly
b78d288a55 Merge branch 'master' of github.com:lifo/docrails 2010-12-21 19:50:27 -08:00
Lee Reilly
55b01e65e2 No example given on how to render JSON data despite the heading 'Rendering XML and JSON data'; added relevant code. 2010-12-21 19:49:42 -08:00
John Firebaugh
0b0e6f13c0 Typo (request -> response) 2010-12-21 19:32:34 -08:00
John Firebaugh
d4afde9ab0 Expand ActionDispatch::Reloader docs 2010-12-21 19:26:33 -08:00
Santiago Pastorino
baebe7d0d5 Avoid Bundler Resolver bug until they solve the issue 2010-12-21 20:30:33 -02:00
Neeraj Singh
3c1a0a8b62 expand on set_callback method to explain that in
some cases an implicit :before is assumed
2010-12-21 15:45:50 -05:00
Aaron Patterson
87ae85d536 returning id (for some yet to be discovered reason) 2010-12-20 19:47:15 -08:00
Aaron Patterson
207f266cca define_attr_method must serialize nil correctly 2010-12-20 19:47:15 -08:00
Aaron Patterson
099a210c83 if there is no base name, we cannot determine a primary key 2010-12-20 19:47:15 -08:00
Ryan Bigg
68ebd332d0 Config guide: Complete sentence about the Rack::SendFile middleware. 2010-12-21 13:45:38 +10:00
Aaron Patterson
0516806760 remove some lasigns 2010-12-20 19:32:14 -08:00
Ryan Bigg
4da4087fd8 Further re-working of the initialization guide 2010-12-21 10:40:15 +10:00
Ryan Bigg
1cacb08b21 Improve documentation on ActiveSupport::Deprecation. 2010-12-21 10:40:15 +10:00
Ryan Bigg
8373c735c7 config guide: mention ActiveSupport::Deprecation configuration options. 2010-12-21 10:40:14 +10:00
Aaron Patterson
3ce3c21997 no use for set, no need to to_ary, reduce extra objects 2010-12-20 14:40:07 -08:00
Aaron Patterson
6e14feb978 use array arithmetic rather than create sets 2010-12-20 14:24:04 -08:00
Jon Leighton
37b67df7e4 Avoid Symbol#to_proc for performance reasons in Ruby 1.8 2010-12-20 13:56:04 -08:00
Jon Leighton
834e5336a5 has_many associations with :dependent => :delete_all should update the counter cache when deleting records 2010-12-20 13:56:04 -08:00
Jon Leighton
57b9009893 Refactor delete_records in HasManyAssociation 2010-12-20 13:56:04 -08:00
Jon Leighton
b8153fd5a1 Fix problem where wrong keys are used in JoinAssociation when an association goes :through a belongs_to [#2801 state:resolved] 2010-12-20 13:56:04 -08:00
Jon Leighton
9863d8a5f6 Remove unnecessary overloaded methods create, create! and create_record from HasAndBelongsToManyAssociation 2010-12-20 13:56:04 -08:00
Jon Leighton
7f5fcc0785 Refactor create_record and build_record in AssociationCollection 2010-12-20 13:56:04 -08:00
Jon Leighton
ffa57671bb Delete create, create! and create_record from HasManyThroughAssociation in exchange for more generic versions in AssociationCollection 2010-12-20 13:56:04 -08:00
Jon Leighton
379c02267b Specify insert_record with NotImplementedError in AssociationCollection, to indicate that subclasses should implement it. Also add save_record to reduce duplication. 2010-12-20 13:56:03 -08:00
Xavier Noria
880f8419c4 Merge branch 'master' of git://github.com/lifo/docrails 2010-12-20 20:13:34 +01:00
Emilio Tagua
348c0ec7c6 Should save without validation if autosave is enabled. 2010-12-20 11:31:13 -03:00
Emilio Tagua
02fc6fbccd Merge remote branch 'rails/master' into identity_map
Conflicts:
	activerecord/lib/active_record/associations/association_proxy.rb
	activerecord/lib/active_record/autosave_association.rb
	activerecord/lib/active_record/base.rb
	activerecord/lib/active_record/persistence.rb
2010-12-20 11:23:07 -03:00
José Valim
0cbfd6c28d Small changes on AD::Reloader. 2010-12-20 12:43:02 +01:00
John Firebaugh
e683ab7c39 Use AD::Reloader.to_cleanup for reloading [#2873 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-12-20 12:43:02 +01:00
John Firebaugh
435bccda93 Replace AD::Callbacks.to_prepare with AD::Reloader.to_prepare
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-12-20 12:43:02 +01:00
John Firebaugh
0f7c970e4f Introduce ActionDispatch::Reloader
Based on the implementation on the 2-3-stable branch, patches by Hongli
Lai <hongli@phusion.nl>, and helpful suggestions from José Valim.

Hongli Lai's patches included locking around the request cycle; this is
now handled by Rack::Lock (https://github.com/rack/rack/issues/issue/87/).

[#2873]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-12-20 12:43:02 +01:00
Piotr Sarnacki
d4f995301b More love for engines tests 2010-12-19 23:36:29 +01:00
John Firebaugh
916c25aeee Use assert_body 2010-12-19 22:39:21 +01:00
Santiago Pastorino
ab2bde45f8 Remove require AS::Concern from places where is already in 2010-12-19 19:15:26 -02:00
Vijay Dev
6909fb6cff indentation fixes 2010-12-20 02:34:08 +05:30
Santiago Pastorino
5fb42ac478 Tests and docs which explain the use of validate with a block and without arguments 2010-12-19 18:50:18 -02:00
Vijay Dev
4038a6bc0f minor fixesin READMEs 2010-12-20 01:07:33 +05:30
Vijay Dev
4197fad841 fix typos 2010-12-20 00:07:43 +05:30
Vijay Dev
eaad8610ee minor example fix for Rails 3 2010-12-19 23:37:22 +05:30
Santiago Pastorino
08ccd29b5b Remove weak_passwords list and the length/strong password validator, leave that up to the programmer 2010-12-19 15:01:29 -02:00
Piotr Sarnacki
37e643120a Temporary fix for railties test for newest rack changes 2010-12-19 17:57:36 +01:00
Santiago Pastorino
13e5a26dbb Fix indentation 2010-12-19 14:00:09 -02:00
Santiago Pastorino
7b875953b8 Use Concern in Rails::Railtie::Configurable 2010-12-19 14:00:09 -02:00
Santiago Pastorino
f249d07c44 Add missing require 2010-12-19 14:00:08 -02:00
Vijay Dev
cc3d6a8571 minor corrections 2010-12-19 21:28:33 +05:30
Piotr Sarnacki
c29a4485a2 Refactoring of application's task in engine.rake 2010-12-19 15:59:55 +01:00
Piotr Sarnacki
b50024f2ff Do not load all application's task in generated engine 2010-12-19 15:12:13 +01:00
José Valim
6d80f3a1ba Use class_attribute to ensure weak_passwords are inheritable. 2010-12-19 13:31:48 +01:00
Vijay Dev
6b65cd57ca deleting trailing whitespaces 2010-12-19 17:57:20 +05:30
Mikel Lindsaar
6c217f98db Add set_weak_passwords call in alignment with set_table_name. 2010-12-19 21:36:47 +11:00
Mikel Lindsaar
fa14df08a8 Fix incorrect docs 2010-12-19 20:54:15 +11:00
Mikel Lindsaar
a39a333769 Added ability to specify which passwords you want as weak passwords 2010-12-19 20:39:54 +11:00
José Valim
863de37b05 'unsecure' => 'insecure' 2010-12-19 09:37:08 +01:00
José Valim
432556b923 Make password messages translatable. 2010-12-19 09:34:31 +01:00
José Valim
b8f6dd8cbb Add missing require and remove extra module. 2010-12-19 09:31:26 +01:00
José Valim
d592fa946d Avoid warnings and fix small typo on SecurePassword. 2010-12-19 09:28:15 +01:00
Will
aebbbc78cc Fix respond_with example code so it makes sense 2010-12-19 14:16:54 +11:00
Will
1a6c4c86ea Correct deprecated AR usage in ActionController::MimeResponds documentation 2010-12-19 14:14:02 +11:00
David Heinemeier Hansson
bd9dc4ff23 BCrypt does its own salting, lovely! 2010-12-18 19:09:07 -08:00
David Heinemeier Hansson
39b5ea6e01 Switch from SHA2 to BCrypt (easy Windows compatibility is coming shortly with new compiled gem) 2010-12-18 15:39:32 -08:00
David Heinemeier Hansson
bcf4e4f2b0 Added ActiveRecord::Base#has_secure_password (via ActiveModel::SecurePassword) to encapsulate dead-simple password usage with SHA2 encryption and salting 2010-12-18 13:38:05 -08:00
Piotr Sarnacki
d9b732fcad Fix tests in railties 2010-12-18 21:47:27 +01:00
Piotr Sarnacki
4eb0d580a2 Use gemspec instead of gem rails in Gemfile 2010-12-18 19:42:03 +01:00
Don Wilson
f71809f257 Fixed number_with_precision rounding error [#6182 state:resolved] 2010-12-18 10:00:37 +01:00
zhengjia
ad14926b44 Fix the example in ActiveSupport::Concern 2010-12-17 18:54:57 -06:00
Vijay Dev
3145c8afd1 changes in examples - reflect new mailer api and mysql2 adapter 2010-12-18 01:11:58 +05:30
Aaron Patterson
5008d33eee dry up case / when statement 2010-12-17 11:31:15 -08:00
Piotr Sarnacki
e22885f3a9 Use require 'bundler/setup' instead of directly calling Bundler.setup in config/boot.rb 2010-12-17 20:30:34 +01:00
Piotr Sarnacki
07567aea5f Revert "Fixed number_with_precision rounding error [#6182 state:resolved]"
This reverts commit 006ec77e60.
2010-12-17 16:11:47 +01:00
Piotr Sarnacki
f7e33620ca Allow to use BUNDLE_GEMFILE env variable in boot.rb [#6184 state:resolved] 2010-12-17 16:10:08 +01:00
Don Wilson
006ec77e60 Fixed number_with_precision rounding error [#6182 state:resolved] 2010-12-17 11:32:19 +01:00
Ryan Bigg
d421b16edc Config guide: middlewares can also be removed from the stack 2010-12-17 16:24:47 +10:00
Ryan Bigg
225f95237b init guide: Cover beginnings of rails/application.rb 2010-12-17 16:24:47 +10:00
Ryan Bigg
5e0daa0bce init guide: Cover ruby version checker and kernel reporting and logger coreext 2010-12-17 16:24:47 +10:00
Akira Matsuda
a3fbbb626f 'nil' => nil 2010-12-17 14:37:22 +09:00
Santiago Pastorino
3b9120fa52 Generate add_index by default when giving type belongs_to or references 2010-12-16 20:58:58 -02:00
Piotr Sarnacki
f176b2552e Changelog and guide entries for config.action_view.cache_template_loading 2010-12-16 22:53:19 +01:00
Piotr Sarnacki
40b15f9f38 ActiveRecord::Base.joins should allow single nil argument [#6181 state:resolved] 2010-12-16 22:25:09 +01:00
Piotr Sarnacki
e89fff2f6b Bring back config.action_view.cache_template_loading [#5847 state:resolved] 2010-12-16 22:24:48 +01:00
Santiago Pastorino
81cf98d342 dragdrop was tested twice and effects.js was missing, added checks for controls.js, dragdrop.js and effects.js to another test 2010-12-16 11:37:11 -02:00
Jon Leighton
14b880fd03 Fix various issues with the :primary_key option in :through associations [#2421 state:resolved] 2010-12-15 17:50:14 -08:00
Jon Leighton
09ddca67ac Fix problem with duplicated records when a :uniq :through association is preloaded [#2447 state:resolved] 2010-12-15 17:47:42 -08:00
Aaron Patterson
6bfa846a2c dry up compute type in attribute 2010-12-15 14:02:30 -08:00
Pavel Gorbokon
96bae30538 Replace rudimentary named_scope with scope. [#6052 state:resolved]
* rename method names (actually in tests)
* rename instance variable @_named_scopes_cache to @_scopes_cache
* rename references in doc comments
* don't touch CHANGELOG :)
2010-12-15 14:02:30 -08:00
Franck Verrot
aa40543022 Provide test for #4840: to_xml doesn't work in such case: Event.select('title as t').to_xml 2010-12-15 14:02:30 -08:00
Víctor Martínez
fe0db2b805 to_xml doesn't work in such case: Event.select('title as t').to_xml [#4840 state:resolved]
NilClass.type is no longer defined in Ruby 1.9 and causes ActiveRecord::Base.to_xml to fail with message: undefined method `type' for nil:NilClass
2010-12-15 14:02:30 -08:00
Vijay Dev
e00afadfdd removed info about deprecated rake tasks, documented the sandbox option for the rails console and minor corrections 2010-12-16 02:09:57 +05:30
Vijay Dev
c594f22e65 Merge branch 'master' of github.com:lifo/docrails 2010-12-16 01:51:44 +05:30
Vijay Dev
f96fb78e57 removed info about deprecated rake tasks, documented the sandbox option for the rails console and minor corrections 2010-12-16 01:49:30 +05:30
Pivotal Labs
15984dbe35 test for eager load of has_one association with condition on the through table 2010-12-16 01:49:30 +05:30
Aaron Patterson
4cd3302279 make sure that join nodes are uniq 2010-12-16 01:49:30 +05:30
Jon Leighton
491ce5b6ce Verify that creating a has_many through record where there is a default_scope on the join model works correctly (creates the join record with the default scope applied) 2010-12-16 01:49:30 +05:30
Jon Leighton
eba7664086 Respect the default_scope on a join model when reading a through association 2010-12-16 01:49:30 +05:30
brainopia
ebc47465a5 Fix edge cases for domain :all option on cookie store
Dont set explicit domain for cookies if host is not a domain name

[#6002 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-12-16 01:49:30 +05:30
Piotr Sarnacki
875bbd58b4 AppGenerator: use options instead of @options 2010-12-16 01:49:30 +05:30
Piotr Sarnacki
bb89f8613a Kill whitespace! 2010-12-16 01:49:30 +05:30
Piotr Sarnacki
ed32c8fe51 Generate default layout in engine with --mountable option 2010-12-16 01:49:30 +05:30
Piotr Sarnacki
7f77d6691f Fix generation of prototype files, it should work with --javascript prototype, not --prototype 2010-12-16 01:49:30 +05:30
Piotr Sarnacki
978314c4e1 Generate javascripts in engine with --mountable option 2010-12-16 01:49:30 +05:30
Piotr Sarnacki
a462a76bd3 Set proper engine's asset directories when assets are served from engine.
When using stylesheet_link_tag(:all) or javascript_include_tag(:all),
assets directories are searched for css or js files. When
config.serve_static_assets is set to true, those files can be
served directly from engine's directories. That's why assets paths
should be set individually for controllers inside engine
if we want to serve static assets with ActionDispatch::Static
2010-12-16 01:49:29 +05:30
Piotr Sarnacki
8e955c5fe4 Should be isolated engine instead of namespaced engine 2010-12-16 01:49:29 +05:30
Ernie Miller
5d37ff6bb2 Fix hm:t to self table aliasing in construct_scope 2010-12-16 01:49:29 +05:30
Joe Hannon
7bffa9dd01 add test which fails for has_many through self join [#4361 state:open] 2010-12-16 01:49:29 +05:30
Aaron Patterson
a64bf22a71 class names are already strings, so we do not need to call to_s on the strings that are already strings 2010-12-16 01:49:29 +05:30
Aaron Patterson
2f0708e974 build SQL AST nodes rather than generate strings 2010-12-16 01:49:29 +05:30
Aaron Patterson
aa4d03fcfc construct_joins no longer needs an argument 2010-12-16 01:49:29 +05:30
Aaron Patterson
18402b5d64 supporting arel AST nodes when building join statements 2010-12-16 01:49:29 +05:30
Aaron Patterson
80ff64a947 just copy the joins to the list 2010-12-16 01:49:29 +05:30
Aaron Patterson
b68407f7f0 bucketing based on join type 2010-12-16 01:49:29 +05:30
Aaron Patterson
c02fd2acc5 taking advantage of the JoinSource node in the SQL AST 2010-12-16 01:49:29 +05:30
Aaron Patterson
08ccca7644 fixing whitespace errors 2010-12-16 01:49:29 +05:30
Piotr Sarnacki
f0f978a4f3 Fix indentation and newlines in generated engine 2010-12-16 01:49:29 +05:30
Aaron Patterson
63480d234d stop delegating inserts to ARel, use the INSERT SQL ourselves 2010-12-16 01:49:29 +05:30
Aaron Patterson
a1ca1e85a9 persisted? should be able to return a truthy object 2010-12-16 01:49:28 +05:30
Chiel Wester
bda16eb092 Only call save on belongs_to associations if the record has changed or any nested associations have changed (resolves #3353)
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-12-16 01:49:28 +05:30
Santiago Pastorino
9cfbada93a This is not an executable file 2010-12-16 01:49:28 +05:30
Samuel Kadolph
972011a2e5 Add support for namespaced validators
Includes test and documentation for new feature

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-12-16 01:49:28 +05:30
Piotr Sarnacki
0dc39cd8ee Skip creating migration if --skip option is passed to model generator [#6144 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-12-16 01:49:28 +05:30
Piotr Sarnacki
e6928e8c35 Allow to generate namespaced generators [#6140 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-12-16 01:49:28 +05:30
Santiago Pastorino
692b621d2a Tables style unification 2010-12-16 01:49:28 +05:30
Santiago Pastorino
4c5805dfab Add named helper to photo controller example 2010-12-16 01:49:28 +05:30
Santiago Pastorino
6f8cc0776b Add underline to header 2010-12-16 01:49:28 +05:30
Santiago Pastorino
edf5b57451 Add named helper output to translated paths example 2010-12-16 01:49:28 +05:30
Aaron Patterson
ad47b7bcc1 just use the regexp directly 2010-12-16 01:49:28 +05:30
Aaron Patterson
59bd9c2a37 combine regexp 2010-12-16 01:49:28 +05:30
Aaron Patterson
b3ae67dbb9 reduce method calls 2010-12-16 01:49:28 +05:30
Aaron Patterson
59ec131555 move ivar to initialize, use triple dot rather than minus 2010-12-16 01:49:28 +05:30
Aaron Patterson
b1447d902c explicitly set prefix 2010-12-16 01:49:27 +05:30
Aaron Patterson
0042054ea8 remove lasgn since AST is mutated 2010-12-16 01:49:27 +05:30
Aaron Patterson
cea73f82ad just mutate the ast, fewer lasgns 2010-12-16 01:49:27 +05:30
Xavier Noria
8a9a7562cc Merge branch 'master' of github.com:rails/rails 2010-12-15 20:50:17 +01:00
Xavier Noria
62113a8fa9 Merge branch 'master' of git://github.com/lifo/docrails 2010-12-15 20:40:01 +01:00
Vijay Dev
e9732c75a8 fixed typos 2010-12-16 00:56:02 +05:30
Vijay Dev
ae7910fad4 minor formatting fixes 2010-12-16 00:54:15 +05:30
Pivotal Labs
6df88f0d2c test for eager load of has_one association with condition on the through table 2010-12-15 11:23:39 -08:00
Xavier Noria
3c9486f487 Merge branch 'master' of git://github.com/lifo/docrails 2010-12-15 20:18:36 +01:00
Aaron Patterson
5d78b4c6f7 make sure that join nodes are uniq 2010-12-15 11:12:33 -08:00
Jon Leighton
a04e103669 Verify that creating a has_many through record where there is a default_scope on the join model works correctly (creates the join record with the default scope applied) 2010-12-15 11:03:58 -08:00
Jon Leighton
16e93f2c3c Respect the default_scope on a join model when reading a through association 2010-12-15 11:03:58 -08:00
Vijay Dev
80382c7465 fixed link to ruby-prof 2010-12-16 00:16:28 +05:30
Vijay Dev
7a028eae79 fixed font 2010-12-15 23:13:22 +05:30
Vijay Dev
7b0e1cb0ca Merge branch 'master' of github.com:lifo/docrails 2010-12-15 22:35:32 +05:30
Vijay Dev
e15a55c862 filter_parameter_logging is deprecated in Rails 3. Changed it to config.filter_parameters 2010-12-15 22:35:09 +05:30
brainopia
439c23dce3 Fix edge cases for domain :all option on cookie store
Dont set explicit domain for cookies if host is not a domain name

[#6002 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-12-15 11:03:03 -02:00
Piotr Sarnacki
17afec0ae3 AppGenerator: use options instead of @options 2010-12-15 13:08:49 +01:00
Piotr Sarnacki
2dafb14c28 Kill whitespace! 2010-12-15 13:05:18 +01:00
Piotr Sarnacki
232e37952d Generate default layout in engine with --mountable option 2010-12-15 13:04:11 +01:00
Piotr Sarnacki
779a60dee5 Fix generation of prototype files, it should work with --javascript prototype, not --prototype 2010-12-15 13:04:06 +01:00
Piotr Sarnacki
5d63a36ae8 Generate javascripts in engine with --mountable option 2010-12-15 13:03:30 +01:00
Aditya Sanghi
6fc3750471 eternal confusion! fixed doco to inform correctly 2010-12-15 16:13:36 +05:30
Piotr Sarnacki
0e5ee9af48 Set proper engine's asset directories when assets are served from engine.
When using stylesheet_link_tag(:all) or javascript_include_tag(:all),
assets directories are searched for css or js files. When
config.serve_static_assets is set to true, those files can be
served directly from engine's directories. That's why assets paths
should be set individually for controllers inside engine
if we want to serve static assets with ActionDispatch::Static
2010-12-15 10:01:27 +01:00
Piotr Sarnacki
5e3b853aee Should be isolated engine instead of namespaced engine 2010-12-15 10:00:58 +01:00
Ryan Bigg
a7791c3752 Active Support coreext guide: Logger core extension documentation 2010-12-15 16:18:46 +10:00
Ryan Bigg
003fce430a WIP: Reviewing the initialization guide for Rails 3.1 2010-12-15 16:18:46 +10:00
Elben Shira
de4f9acad8 It should be ActiveModel::Validator, not ActiveRecord::Validator. 2010-12-14 20:35:08 -06:00
Ernie Miller
c81af00a7a Fix hm:t to self table aliasing in construct_scope 2010-12-14 16:16:34 -08:00
Joe Hannon
00c893d3b8 add test which fails for has_many through self join [#4361 state:open] 2010-12-14 15:56:39 -08:00
Aaron Patterson
f2234a5dd3 class names are already strings, so we do not need to call to_s on the strings that are already strings 2010-12-14 15:27:06 -08:00
Aaron Patterson
820582883a build SQL AST nodes rather than generate strings 2010-12-14 15:24:25 -08:00
Aaron Patterson
7af9ec8a99 construct_joins no longer needs an argument 2010-12-14 15:03:06 -08:00
Aaron Patterson
2e7da54f77 supporting arel AST nodes when building join statements 2010-12-14 14:57:03 -08:00
Aaron Patterson
6212ecaa0b just copy the joins to the list 2010-12-14 14:49:33 -08:00
Aaron Patterson
fdabb8fe17 bucketing based on join type 2010-12-14 12:34:04 -08:00
Aaron Patterson
90d9aa3b45 taking advantage of the JoinSource node in the SQL AST 2010-12-14 11:25:47 -08:00
Aaron Patterson
df20c9f1a9 fixing whitespace errors 2010-12-14 08:42:58 -08:00
Piotr Sarnacki
34d1e5d04d Fix indentation and newlines in generated engine 2010-12-14 10:28:00 +01:00
Aaron Patterson
79e6c7d230 stop delegating inserts to ARel, use the INSERT SQL ourselves 2010-12-13 13:21:18 -08:00
Aaron Patterson
6ed6e4f9df persisted? should be able to return a truthy object 2010-12-13 11:39:31 -08:00
Chiel Wester
658bb4fa25 Only call save on belongs_to associations if the record has changed or any nested associations have changed (resolves #3353)
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-12-13 17:04:57 +01:00
Ben Mills
73dafba6ca Added :placeholder option to ActionView::Helpers::FormTagHelper text_field_tag 2010-12-13 16:25:17 +10:00
Umar Sheikh
0b5671ccca for the root route to work, we need to delete the public/index.html.erb
file as well
2010-12-13 11:18:49 +05:00
Ryan Bigg
a81f68e879 Fix indentation on the namespace method's documentation 2010-12-13 13:03:41 +10:00
Ryan Bigg
a6bc1f9be4 Remove nodoc from FormBuilder because the methods inside are public API methods 2010-12-13 07:14:16 +10:00
Vijay Dev
a6faeffe59 fixed typos in mailer 2010-12-12 21:10:03 +05:30
Jon Leighton
9a98c766e0 Merge branch 'master' into nested_has_many_through
Conflicts:
	activerecord/CHANGELOG
	activerecord/lib/active_record/associations/class_methods/join_dependency.rb
	activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb
	activerecord/lib/active_record/associations/has_many_through_association.rb
2010-12-12 09:55:32 +00:00
Santiago Pastorino
32a2bf8d4e This is not an executable file 2010-12-11 16:40:05 -02:00
Samuel Kadolph
2650742bd0 Add support for namespaced validators
Includes test and documentation for new feature

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-12-11 16:35:18 -02:00
vijay
3efe1b7386 fixed typos and rephrased a few sentences; also removed reference to status codes being located in action_controller/status_codes.rb 2010-12-11 23:06:54 +05:30
Paul Odeon
14b5c8b985 Updated generator guide for rails commit 7891de8939 2010-12-11 14:30:12 +00:00
Piotr Sarnacki
307443972c Skip creating migration if --skip option is passed to model generator [#6144 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-12-11 11:41:16 +01:00
Piotr Sarnacki
7891de8939 Allow to generate namespaced generators [#6140 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-12-11 11:40:51 +01:00
Ryan Bigg
751733ab96 Provide an example for ActionDispatch::Routing::Mapper#scope 2010-12-11 17:27:14 +10:00
Santiago Pastorino
f05238e1d2 Tables style unification 2010-12-11 02:24:07 -02:00
Santiago Pastorino
93af9ecf35 Add named helper to photo controller example 2010-12-11 02:02:09 -02:00
Santiago Pastorino
e4c252c119 Add underline to header 2010-12-11 01:54:59 -02:00
Santiago Pastorino
c780cf2f02 Add named helper output to translated paths example 2010-12-11 01:50:21 -02:00
Aaron Patterson
9094cd2600 just use the regexp directly 2010-12-10 17:03:32 -08:00
Aaron Patterson
de708447f4 combine regexp 2010-12-10 17:01:15 -08:00
Aaron Patterson
9e16254b46 reduce method calls 2010-12-10 16:31:09 -08:00
Aaron Patterson
8924018d59 move ivar to initialize, use triple dot rather than minus 2010-12-10 16:31:09 -08:00
Aaron Patterson
64ba043544 explicitly set prefix 2010-12-10 16:31:08 -08:00
Aaron Patterson
4d5f9a0765 remove lasgn since AST is mutated 2010-12-10 16:31:08 -08:00
Aaron Patterson
b9bb240a2b just mutate the ast, fewer lasgns 2010-12-10 16:31:08 -08:00
Xavier Noria
c6612d2bb3 Merge branch 'master' of git://github.com/lifo/docrails
Conflicts:
	activerecord/lib/active_record/transactions.rb
2010-12-11 00:55:25 +01:00
Xavier Noria
d38644f4a9 reviews commit 53bbbcc 2010-12-11 00:52:33 +01:00
Xavier Noria
c8baefbca3 spaces with underscores, I mean 2010-12-11 00:22:51 +01:00
Xavier Noria
f0580bd84c testing guide: revises explanation of the test macro 2010-12-11 00:20:15 +01:00
Xavier Noria
1b8f9d3d7e Merge branch 'master' of https://github.com/vijaydev/docrails into vijaydev-master 2010-12-11 00:07:31 +01:00
Xavier Noria
b911d88390 Merge branch 'master' of https://github.com/lucascaton/docrails into lucascaton-master 2010-12-11 00:02:41 +01:00
Xavier Noria
b43842f6c0 Merge branch 'master' of https://github.com/git2samus/docrails into git2samus-master 2010-12-10 23:53:13 +01:00
Aaron Patterson
e07772556a use table alias nodes rather than Table nodes 2010-12-10 13:28:50 -08:00
Aaron Patterson
f528389a55 use alias nodes to represent table aliases 2010-12-10 13:26:58 -08:00
Aaron Patterson
73d4d6704e avoid *args on join_target_table 2010-12-10 13:20:03 -08:00
Aaron Patterson
6e15a7fa3c only quote the table name once per call 2010-12-10 11:46:02 -08:00
Aaron Patterson
7d8fd57236 no more manager manipulation if there is no custom join ast 2010-12-10 11:38:43 -08:00
Aaron Patterson
ec72b6b3ec froms should never equal 0 2010-12-10 11:38:43 -08:00
Aaron Patterson
4dec00a9d8 manager will always be a manager 2010-12-10 11:38:43 -08:00
Aaron Patterson
82944b95a9 eliminate lasgns 2010-12-10 11:38:42 -08:00
Aaron Patterson
88bc49f2f7 dealing with an AST manager, not a relation, so fix the variable names 2010-12-10 11:38:42 -08:00
vijay
61817d2630 fixed typos and rephrased few sentences in routing 2010-12-10 23:34:48 +05:30
vijay
6acd1304b1 Merge branch 'master' of github.com:lifo/docrails 2010-12-10 23:03:31 +05:30
Piotr Sarnacki
3d01ef6dd1 require core_ext/array/wrap in active_record/migration
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-12-10 08:33:48 +01:00
Ryan Bigg
dbf955c03b Action Controller Overview: Remove dead link to the API docs for filters 2010-12-10 15:55:46 +10:00
Aaron Patterson
06ba9eaa62 move join creation a little closer to where it is used 2010-12-09 15:54:07 -08:00
Ryan Bigg
f0d4b7f2a6 root method options are the same as the match method 2010-12-10 09:34:40 +10:00
Aaron Patterson
12f67a7069 use inject rather than lasgn 2010-12-09 15:31:09 -08:00
Aaron Patterson
3e7c351b48 preheating cache so that tests can run in isolation 2010-12-09 15:12:48 -08:00
Aaron Patterson
0e8280b193 reuse the superclass methods for shorter codes 2010-12-09 13:48:37 -08:00
Aaron Patterson
b2a042570c just use core methods 2010-12-09 13:48:37 -08:00
José Valim
1860d873f2 Ensure asset_path defaults to nil for application 2010-12-09 21:19:06 +01:00
Aaron Patterson
d1387a9942 Merge remote branch 'rude/disable-keys-for-postgres-9.0.1' into pg
* rude/disable-keys-for-postgres-9.0.1:
  Cleaner way to extract the Postgres version
  Fix Bug: disable_referential_integrity doesn't work for postgres 9.0.1
2010-12-09 11:19:25 -08:00
Aaron Patterson
6110b0c54d fixing documentation, thanks Ivan Evtuhovich 2010-12-09 11:14:54 -08:00
Aaron Patterson
3cbf5d9794 removing useless lasgn 2010-12-09 11:13:00 -08:00
Robert Pankowecki (Gavdi)
bba3dacc3d Simplifies observer implementation [#6065 state:resolved] 2010-12-09 10:41:43 -08:00
Piotr Sarnacki
e12810178c Use Array.wrap instead of using ternary
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-12-09 18:50:49 +01:00
Piotr Sarnacki
6f8958277b Fix test on finding migrations from 2 paths
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-12-09 18:50:44 +01:00
Neeraj Singh
0027b65421 Ensure that while caching a page rails takes into
account the resolved mime type for the request

[#6110 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-12-09 16:14:57 +01:00
José Valim
cc48192248 Merge remote branch 'drogus/dummy_tasks'
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-12-09 16:09:51 +01:00
Piotr Sarnacki
7b9f634e15 Refactor db:load:config to automatically pick additional migrations if ENGINE_PATH is available 2010-12-09 14:19:32 +01:00
José Valim
d3f7e565d1 Ensure resolvers backward compatibility. 2010-12-09 14:06:44 +01:00
José Valim
8e6d27641c Clean up asset_host and asset_path. 2010-12-09 13:40:45 +01:00
José Valim
cc70ac9508 Properly check the arity for template handlers. 2010-12-09 13:15:40 +01:00
José Valim
28cf77203b Check if the routes object really responds to define_mount_prefix. 2010-12-09 13:15:25 +01:00
Ryan Bigg
fe0e3880e8 root route should go at the *top* of the routes file, because it is the most popular route and should be matched first 2010-12-09 20:21:08 +10:00
Ryan Bigg
d2f98e5b55 indent code samples for mount doc 2010-12-09 20:03:14 +10:00
Ryan Bigg
a47f31c593 mapper.rb: add "options" to make the default-to-namespace-name line read better 2010-12-09 20:01:42 +10:00
Ryan Bigg
b4ec6f0d39 Move ActiveModel::Lint::Tests documentation to be above module declaration so it appears in the API docs for this module. 2010-12-09 18:16:18 +10:00
Mike Dvorkin
f572a02b94 Take into account current time zone when serializing datetime values [#6096 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-12-09 09:01:49 +01:00
Ryan Bigg
ae7825d57c Config guide: Use bold titles for initializers instead of headings. 2010-12-09 17:54:38 +10:00
Ryan Bigg
e4456b6f03 Add note which links to documentation regarding the types of columns available. 2010-12-09 17:54:38 +10:00
Ryan Bigg
9560f50920 Config guide: Space out initialization events to improve readability 2010-12-09 17:54:38 +10:00
Ryan Bigg
ceb164a420 Config guide: add further initializers 2010-12-09 17:54:38 +10:00
Ryan Bigg
4902fc73b3 Config guide: add session store config option 2010-12-09 17:54:38 +10:00
Ryan Bigg
b6eec1decf Config guide: eager_load_paths by default contains every directory in the app directory 2010-12-09 17:54:37 +10:00
Aaron Patterson
07b0e59988 use sort_by 2010-12-08 17:31:20 -08:00
Piotr Sarnacki
843130dbe7 Use Rails::Engine.find in commands.rb 2010-12-09 01:59:55 +01:00
Piotr Sarnacki
051127d4d3 Rails::Engine.find(path) - method to find engine by path 2010-12-09 01:59:54 +01:00
Piotr Sarnacki
5df72a238e Rake tasks for managing database while development and testing of engines
Some of the engines needs database. As engine needs to be run inside
Rails application, migrations and other database operations are run
from dummy application. To make that process simple I changed db
tasks to look for migrations in both engine's and application's
db/migrate directory. You can run all of the database tasks from
test/dummy or directly from engine with prefix app, like:

  rake app:db:migrate
  rake app:db:migrate:redo
2010-12-09 01:59:54 +01:00
Piotr Sarnacki
2dc3342f75 Do not require fixtures in example integration test in engine if active record is skipeed 2010-12-09 01:59:54 +01:00
Aditya Sanghi
7a237d56aa Ensure that boolean false is properly serialized [#6079 state:resolved] 2010-12-08 15:51:47 -08:00
Aaron Patterson
285f456391 updating CHANGELOG 2010-12-08 15:38:39 -08:00
Aaron Patterson
6c5b734e6a removing method to prevent warnings 2010-12-08 15:37:13 -08:00
Jeff Dean
7ecee054a3 Setting the id of a belongs_to object updates all referenced objects [#2989 state:resolved] 2010-12-08 15:21:18 -08:00
Piotr Sarnacki
23ba7e456d properly load database config in database rake tasks, to properly set migrations_paths 2010-12-09 00:04:36 +01:00
Piotr Sarnacki
c9d23214ae Allow to run migrations from more than one directory in rake tasks 2010-12-09 00:04:36 +01:00
Piotr Sarnacki
d0467e08e5 Allow to run migrations from more than one directory 2010-12-09 00:04:36 +01:00
Aaron Patterson
e924814b28 just allocate the table in initialize 2010-12-08 14:14:14 -08:00
Ivan Evtukhovich
53bbbcc663 Fix doc about nested transaction rollback
Because AR::Rollback do not reraise and inner transaction is not "real"
nothing rollback at all
2010-12-09 00:41:47 +03:00
Xavier Noria
8c822e8e29 Merge branch 'master' of git://github.com/lifo/docrails 2010-12-08 21:21:49 +01:00
Xavier Noria
0aa78826e4 makes a pass to the action caching rdoc 2010-12-08 21:20:53 +01:00
Aaron Patterson
45ea60eee7 fewer method calls, fewer code branches 2010-12-08 12:11:43 -08:00
Aaron Patterson
c69bd59a9c only call active_record once 2010-12-08 12:09:00 -08:00
Aaron Patterson
dcc0c9a8bb dry up calls to table_aliases 2010-12-08 12:05:02 -08:00
Aaron Patterson
de4bd472c3 remove code that could never be executed 2010-12-08 11:54:45 -08:00
Aaron Patterson
b8d57a0400 have table_aliases call count_aliases to set the default value 2010-12-08 11:50:16 -08:00
Aaron Patterson
f4223cc7ab arel ignores the columns parameter 2010-12-08 11:18:26 -08:00
Aaron Patterson
17d72dd19f adding a fixme comment 2010-12-08 11:02:15 -08:00
Aaron Patterson
3499f882cc renaming variables, making the join_ast method private 2010-12-08 10:54:24 -08:00
Aaron Patterson
ddd6dee043 further reducing dependence on custom_joins 2010-12-08 10:35:26 -08:00
Aaron Patterson
2fd385d471 reducing use of custom joins 2010-12-08 10:29:52 -08:00
Aaron Patterson
1d96d44da3 passing the ast to a table when the relation is a table 2010-12-07 18:54:04 -08:00
Aaron Patterson
d98cb5153d JoinDependency is always created with an AST now 2010-12-07 17:05:15 -08:00
Aaron Patterson
2d9d6cd4c2 passing the ast to JoinDependency 2010-12-07 16:48:59 -08:00
Aaron Patterson
d6133209ce arel is lazy about column information, so no need to pass it around 2010-12-07 15:25:16 -08:00
Aaron Patterson
ddbd203961 reduce string objects, reduce method calls 2010-12-07 15:25:16 -08:00
Pavel Gorbokon
1ce9b73e5c Replace nested ifs with case/when
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-12-07 20:56:10 -02:00
Pavel Gorbokon
4c4c7a272f Ommit nil in method call
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-12-07 20:55:39 -02:00
Aaron Patterson
ef79658bd1 save the AR reference rather than delegating 2010-12-07 14:47:21 -08:00
Aaron Patterson
70ab450274 cleaning up custom_join_sql method 2010-12-07 14:01:37 -08:00
Neeraj Singh
3ac844deec Add to documentation that action caching does
handle HTTP_ACCEPT attribute properly and might
provide wrong result. Use params[:format] to
avoid this issue.
2010-12-06 16:38:47 -05:00
Lucas Catón
323a64ecb5 Fix link on generations' page 2010-12-05 15:58:29 -02:00
Vijay Dev
638b409eb4 fixed typo in test method name 2010-12-05 09:46:52 -08:00
Santiago Pastorino
7c920631ec Test using default option as symbol added for human_attribute_name 2010-12-05 13:26:14 -02:00
Santiago Pastorino
33b0a30fcc default could be a symbol here so attribute.to_s.humanize should be the final option 2010-12-05 12:57:45 -02:00
Santiago Pastorino
20ba81e47d We can use the keys of the @attributes hash here and avoid a method call 2010-12-05 12:44:17 -02:00
Santiago Pastorino
c4809d9984 use map instead of each 2010-12-05 12:44:14 -02:00
Santiago Pastorino
3ab98cf6e0 If default is provided don't add attribute.to_s.humanize to the options 2010-12-05 12:36:56 -02:00
Santiago Pastorino
0dbf4ac709 Test falling back to default added for human_attribute_name 2010-12-05 12:36:53 -02:00
Santiago Pastorino
b870d67290 Test using default option added for human_attribute_name 2010-12-05 12:36:51 -02:00
Xavier Noria
48386d245b Merge branch 'master' of git://github.com/lifo/docrails 2010-12-05 10:33:50 +01:00
Carlos Antonio da Silva
e1d0d5ae81 Fix mime type doc typos 2010-12-04 22:40:05 -02:00
Santiago Pastorino
b696dd70db Allow back passing :rescue_format => nil and test added 2010-12-04 20:08:23 -02:00
Santiago Pastorino
be4551f63b Use ||= here 2010-12-04 19:01:00 -02:00
Santiago Pastorino
a11ddf3ee2 Fix indentation here 2010-12-04 17:50:02 -02:00
Santiago Pastorino
3e84255942 attributes_before_type_cast are just the value of @attributes 2010-12-04 17:49:37 -02:00
Sven Fuchs
896e25e994 Make TranslationHelper#translate use the :rescue_format option in I18n 0.5.0
Don't catch exceptions here. Instead only declare that we want exceptions to be rescued as :html, but also let users configure reactions to exceptions in I18n.

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-12-04 18:00:52 +01:00
Sven Fuchs
7ffd5daa7f bump i18n gem
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-12-04 18:00:31 +01:00
Ryan Bigg
c4669d3c02 Config guide: continuing work on documenting the initializers 2010-12-04 11:27:17 +11:00
Aaron Patterson
a299fcaef9 not a responsibility for rails to test 2010-12-03 16:22:42 -08:00
Aaron Patterson
d21f38aaa2 use the columns hash for primary key lookup 2010-12-03 15:33:59 -08:00
Samus_
62d5bb2686 typo 2010-12-03 18:05:52 -02:00
Aaron Patterson
399730bdd2 removing unused setup 2010-12-03 12:00:09 -08:00
Aaron Patterson
47737681fd in the middle of refactoring 2010-12-03 12:00:09 -08:00
José Valim
226ea0e9e8 Wrap everything in class << self. 2010-12-03 13:27:43 +01:00
José Valim
78afe68afb Merge remote branch 'joshk/redirect_routing'
Conflicts:
	actionpack/CHANGELOG
	actionpack/lib/action_controller/metal/mime_responds.rb

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-12-03 12:27:50 +01:00
Ryan Bigg
30bcdff405 Config guide: begin documenting the initializers 2010-12-03 19:16:25 +11:00
Ryan Bigg
b800125ae8 Config guide: Add javascript_expansions and stylesheet_expansions 2010-12-03 18:06:02 +11:00
Ryan Bigg
04779fbadd Config guide: should use config.action_dispatch.tld_length to set the TLD 2010-12-03 17:34:34 +11:00
Ryan Bigg
e600f84208 Config guide: Add cache_asset_ids 2010-12-03 17:28:51 +11:00
Ryan Bigg
79b14407ad Config guide: add tld_length to ActionDispatch section 2010-12-03 17:26:40 +11:00
Ryan Bigg
7f1c794a11 Remove extra f 2010-12-03 13:29:02 +11:00
Ryan Bigg
1304c92b68 Config guide: Mention ActionDispatch::Callbacks methods: before, to_prepare and after 2010-12-03 13:05:58 +11:00
Ryan Bigg
4d11af2e8f Config guide: clarify what cache_store defaults to. 2010-12-03 12:16:08 +11:00
Ryan Bigg
2e021ef477 Clarify that preload_frameworks defaults to nil 2010-12-03 11:57:42 +11:00
Aaron Patterson
9a3e29e126 remove calls to deprecated methods 2010-12-02 15:56:55 -08:00
Aaron Patterson
b0fc912f1b avoid deprecate api 2010-12-02 15:50:34 -08:00
Aaron Patterson
8c9b5e413f removing more calls to deprecated methods 2010-12-02 15:07:01 -08:00
Aaron Patterson
ead0c6eed3 removing more calls to deprecated methods 2010-12-02 15:07:00 -08:00
Aaron Patterson
12b9920a15 removing calls to deprecated methods 2010-12-02 15:07:00 -08:00
Aaron Patterson
9f0133fbf4 refactor self.class to a variable 2010-12-02 15:07:00 -08:00
Santiago Pastorino
ae35a36afc :method: is not needed when RDoc can detect it 2010-12-02 20:31:06 -02:00
Santiago Pastorino
21eadc1b3f Base#[] and Base#[]= are aliases so implement them as aliases :) 2010-12-02 20:28:28 -02:00
Santiago Pastorino
42c51b8527 Doesn't need to sort, lets users of attribute_names sort them if they want 2010-12-02 20:28:24 -02:00
Aaron Patterson
6673d88f6f avoiding deprecated methods in arel 2010-12-02 14:02:52 -08:00
Aaron Patterson
15633519f7 removing some calls to insert on arel 2010-12-02 14:02:52 -08:00
Santiago Pastorino
acbabd9626 Don't compute this string again 2010-12-02 15:43:12 -02:00
Alex Rothenberg
deb90d9485 made in_clause_length default nil (no limit) 2010-12-02 08:53:19 -08:00
Aaron Patterson
077ec5a0ed fixing space errors 2010-12-02 08:45:37 -08:00
Aaron Patterson
da6ce2e253 adding a test for YAML round trip 2010-12-02 08:44:48 -08:00
Michael Koziarski
96eec090df Work around a strange piece of Syck behaviour where it checks Model#respond_to? before initializing the object.
Things like YAML.load(YAML.dump(@post)) won't work without this.
2010-12-02 08:40:34 -08:00
Ryan Bigg
e8ee2ba6cb Config guide: Add config.active_support.bare 2010-12-02 17:28:48 +11:00
Ryan Bigg
3dfcbe8d2c Config guide: separate the initialization events and initializer method documentation 2010-12-02 17:22:00 +11:00
Ryan Bigg
6349f5caae Move Rails Environment settings to above the initialization events in the config guide 2010-12-02 17:19:32 +11:00
Ryan Bigg
a3a50a0336 Configuring guide: Adding mention of the initializer method. 2010-12-02 17:12:59 +11:00
Ryan Bigg
9cbdbd59d1 Config guide: Rails has *5* initialization events 2010-12-02 15:48:00 +11:00
Ryan Bigg
32026b5867 Add mention of config.to_prepare in configuring guide 2010-12-02 15:22:25 +11:00
Ryan Bigg
bde7d2351e Association guide: change wording to say that build is for initialization, create is for creating 2010-12-02 13:31:11 +11:00
Ryan Bigg
697f734455 Associations guide: Add note that you must use the build_ prefix to build associations of the belongs_to and has_one type 2010-12-02 13:29:17 +11:00
Aaron Patterson
0afebd5b31 no need for self 2010-12-01 18:00:24 -08:00
Aaron Patterson
3ec212e3c9 rolling out migrated_at until I can fix the build 2010-12-01 17:08:01 -08:00
Aaron Patterson
c15c14563e removing duplicate test 2010-12-01 15:14:56 -08:00
Aaron Patterson
85a5318c2b should not to_s the possibly nil value 2010-12-01 15:14:10 -08:00
Aaron Patterson
4232454289 make sure we have a value in migrated_at 2010-12-01 15:07:44 -08:00
Aaron Patterson
7d2179608c not all databases return dates as strings 2010-12-01 14:59:17 -08:00
Aaron Patterson
754493c790 updating CHANGELOG 2010-12-01 14:35:57 -08:00
Aaron Patterson
c266a6bf0f fixing tests and warnings 2010-12-01 14:33:59 -08:00
Ryan Bigg
949eb91d0e Add missing colons on the end of before_initialize and after_initialize documentation in configuring guide 2010-12-02 08:36:25 +11:00
Josh Susser
a49de9811a tests mostly pass
adjust to work with instance-based migations
migrated_at can't be null
why must people have last names? it's killing me!
2010-12-01 12:01:56 -08:00
Josh Susser
b07c2c0fd3 clear schema_migrations in Schema.define 2010-12-01 11:01:15 -08:00
Josh Susser
7139aa878c name in schema_migrations, migrations in schema dump 2010-12-01 10:57:38 -08:00
Josh Susser
4e4e9ad48a record migration timestamp when migrations run 2010-12-01 10:46:29 -08:00
Josh Susser
c283cdd63c Add migrated_at column to schema_migrations table. 2010-12-01 10:46:29 -08:00
Thilo Utke
7148b933c4 ActiveModel::Errors.to_hash returns plain OrderedHash and used in to_json serialization to properly handle multiple errors per attribute [#5615 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-12-01 11:43:37 +01:00
José Valim
1ec126dd37 Revert "Fix generation of wrong json string when field has multiple errors"
This reverts commit a9b666b51d.
2010-12-01 11:42:30 +01:00
José Valim
ba63c0a9b5 Deprecate handler_class_for_extension as template handlers can be any Ruby object, not necessarily a class. 2010-12-01 11:22:48 +01:00
Ryan Bigg
3a3c812c28 Finish documenting generator / template methods for the generators guide 2010-12-01 20:25:39 +11:00
Ryan Bigg
77a228785c Add gem method documentation to the generators guide 2010-12-01 17:18:41 +11:00
Ryan Bigg
74e178880c For templates' gem method, :env is deprecated, use :group instead 2010-12-01 16:16:00 +11:00
Ryan Bigg
f3bf63d611 Covering generator methods provided by Rails in the generators guide 2010-12-01 15:53:36 +11:00
Ryan Bigg
04ec2c6d6c Begin covering application templates in the generators guide 2010-12-01 15:23:27 +11:00
Ryan Bigg
b640e3f510 Mention that the documentation of create_file can be found on rdoc.info ino the generators guide 2010-12-01 15:23:27 +11:00
Aaron Patterson
831a2342c6 just use alias 2010-11-30 20:04:31 -08:00
Aaron Patterson
542cb5c327 fix warnings, stop using global variables 2010-11-30 18:46:56 -08:00
Aaron Patterson
10b1887a71 JoinBase initialize can be deleted 2010-11-30 17:48:10 -08:00
Aaron Patterson
d51854a6be stop using splat args when we do not need them 2010-11-30 17:42:17 -08:00
Aaron Patterson
7408b6ec84 just grep the AST for OuterJoin nodes rather than converting the tree to SQL 2010-11-30 17:29:19 -08:00
Aaron Patterson
f1758525f9 reduce method calls on arel 2010-11-30 16:51:03 -08:00
Aaron Patterson
39f5fc06cb just call join_sql against the manager object 2010-11-30 16:42:21 -08:00
Aaron Patterson
22b01c52c7 isolating eager_loading? method 2010-11-30 16:10:49 -08:00
Aaron Patterson
fe522f79c7 we already know it is already an array, so we do not need to make really really sure it is an array 2010-11-30 15:53:04 -08:00
Aaron Patterson
ae6033331f shorten up scope_for_create 2010-11-30 15:48:15 -08:00
Aaron Patterson
b293ab7c61 making sure scope_for_create value is cached 2010-11-30 15:45:32 -08:00
Aaron Patterson
b2e7d1e41e surrounding scope_for_create behavior 2010-11-30 15:44:30 -08:00
Aaron Patterson
7ff980031b scope_for_create always returns something 2010-11-30 15:39:49 -08:00
Aaron Patterson
dccf624b64 Ruby 1.8, how does it work? 2010-11-30 15:20:27 -08:00
Aaron Patterson
c856e25b32 removing arel 1.0 compatibility 2010-11-30 14:56:53 -08:00
Aaron Patterson
3ad0779e56 testing combined nodes are not traversed 2010-11-30 14:56:32 -08:00
Aaron Patterson
795dc3d15f adding more tests surrounding where_values_hash 2010-11-30 14:47:55 -08:00
Aaron Patterson
6c32290bac testing Relation#table_name 2010-11-30 14:29:35 -08:00
Aaron Patterson
bfc398cb70 adding a test for ActiveRecord::Relation 2010-11-30 14:10:55 -08:00
Aaron Patterson
b7a9890d77 fix whitespace errors 2010-11-30 13:38:48 -08:00
Aaron Patterson
8998aea4b7 making relationship merge cheaper 2010-11-30 13:31:00 -08:00
Aaron Patterson
b6848b6491 cleaning up where_values_hash 2010-11-30 12:05:02 -08:00
Josh Kalderimis
1e26bda095 Added documentation explaining the new additional supported syntaxes for the routing redirect method, a small changelog note, and two extra tests for path interpolation when using the hash option syntax. 2010-11-30 17:55:33 +01:00
Krekoten' Marjan
a9b666b51d Fix generation of wrong json string when field has multiple errors 2010-12-01 00:03:42 +08:00
Josh Kalderimis
0bda6f1ec6 The redirect routing method now allows for a hash of options which only changes the relevant parts of the url, or an object which responds to call can be supplied so common redirect rules can be easily reused. This commit includes a change where url generation from parts has been moved to AD::Http::URL as a class method. 2010-11-30 16:36:01 +01:00
Neeraj Singh
3c7a33c051 Rewording existing comment 2010-11-30 10:00:47 -05:00
Neeraj Singh
aa1ac1ca8c Add comment for config_accessor method 2010-11-30 09:44:12 -05:00
Neeraj Singh
aa9a3227a0 Rewording existing comment 2010-11-29 21:38:59 -05:00
Aaron Patterson
76a15dd059 adding more tests surrounding where values hash 2010-11-29 16:41:02 -08:00
Aaron Patterson
9f2e885ce8 testing attributes applied by default_scope 2010-11-29 13:32:02 -08:00
Aaron Patterson
aae3c35384 removing interpolate_sql from join associations 2010-11-29 10:58:21 -08:00
Aaron Patterson
439a7dc0e6 moving method to subclass that actually uses the method 2010-11-29 10:39:33 -08:00
Aditya Sanghi
f07ff29ea9 Merge branch 'master' of https://github.com/peterb/docrails into peterb-master 2010-11-29 21:41:48 +05:30
Aditya Sanghi
6308f1f0fc Merge branch 'master' of https://github.com/kotfu/docrails into kotfu-master 2010-11-29 21:40:39 +05:30
Aditya Sanghi
2025775adb Merge branch 'master' of https://github.com/gjastrab/docrails into gjastrab-master 2010-11-29 21:39:18 +05:30
Aditya Sanghi
8601f163a8 Merge branch 'master' of https://github.com/cylence/docrails into cylence-master 2010-11-29 21:36:43 +05:30
John Hawthorn
28896a9f4a test case on has_one :through after a destroy
[#6037 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-29 10:48:48 +01:00
Ryan Bigg
477d17b316 Add perform_caching to config guide 2010-11-29 18:30:01 +11:00
Ryan Bigg
15cfaa0a36 Add documentation for page_cache_directory and page_cache_extension to config guide 2010-11-29 18:27:23 +11:00
Ryan Bigg
c4cbf733a1 re-add config.action_controller.asset_host and asset_path to config guide 2010-11-29 17:55:29 +11:00
Ryan Bigg
9e655e8571 Bring order description in line with actual text. 2010-11-29 15:12:39 +11:00
Ryan Bigg
964c2025ff Use ARel for Range Conditions section, remove Date & Time section because users should *never* do that. 2010-11-29 15:08:35 +11:00
Ryan Bigg
390de62cac Fix documentation regarding the initialization events of the Rails stack 2010-11-29 14:10:36 +11:00
Ryan Bigg
685353afc7 asset_host and asset_path are now set at the global level 2010-11-29 13:30:11 +11:00
Ryan Bigg
b9fde2fb75 Reorder logger and middleware global config options 2010-11-29 13:11:53 +11:00
Ryan Bigg
245ce774bf Add mention of helper_paths to config guide 2010-11-29 13:11:27 +11:00
Ryan Bigg
b89ce3e679 Mention encoding in config guide 2010-11-29 13:10:51 +11:00
Ryan Bigg
549c134660 Add asset_host and asset_path to the configuring guide 2010-11-29 12:24:41 +11:00
Ryan Bigg
e15b8fa090 No more app_generators method in 3.1 2010-11-29 12:18:47 +11:00
Ryan Bigg
945d714e75 Mention controller_paths in the config guide 2010-11-29 12:05:23 +11:00
Ryan Bigg
0d32572275 Move threadsafe warning to threadsafe's new location in config guide 2010-11-29 11:54:48 +11:00
Ryan Bigg
b62d5d62e9 Move consider_all_requests_local to global config methods in config guide 2010-11-29 11:54:14 +11:00
Ryan Bigg
f03aa05cee Change coloriz_logging description to follow the standard for this guide 2010-11-29 11:46:15 +11:00
Ryan Bigg
d7ac3992d5 Mention threadsafe! method in config guide 2010-11-29 11:07:55 +11:00
Ryan Bigg
70abf78800 allow_concurrency is a "global" configuration option in Rails 3 2010-11-29 11:07:36 +11:00
Ryan Bigg
dc4dcb1555 Add documentation for secret_token to config guide 2010-11-29 11:00:16 +11:00
Ryan Bigg
fbdd72ecae Mention filter_parameters for config 2010-11-29 11:00:16 +11:00
José Valim
e444439fe2 Partialy revert f1c13b0dd7 2010-11-28 16:55:53 +01:00
José Valim
31906eecdf Fix tests on 1.9.2. 2010-11-28 12:48:50 +01:00
José Valim
a4c360e8c7 trailing star mimes should respect the order in which mime types are defined. 2010-11-28 11:54:00 +01:00
Neeraj Singh
9bd291407c make it clear that recompilation happens only in
development mode
2010-11-27 22:16:51 -05:00
Akira Matsuda
2029187c56 s/myqsl/mysql/ 2010-11-28 09:42:19 +09:00
Akira Matsuda
1662aa1a15 Added a space before "do" keyword 2010-11-28 09:42:19 +09:00
Xavier Shay
76053fe4d1 Allow http templates again, fix the broken test
[#5926 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-27 22:05:35 -02:00
José Valim
927c582acf Update CHANGELOG. 2010-11-27 08:12:49 -08:00
Aditya Sanghi
04922bafda grammar fix 2010-11-27 19:56:08 +05:30
Jon Leighton
3a7f43ca6e Merge branch 'master' into nested_has_many_through
Conflicts:
	activerecord/CHANGELOG
	activerecord/lib/active_record/associations.rb
2010-11-27 11:31:17 +00:00
Mikel Lindsaar
667bcac439 Application templates should work with HTTPS too 2010-11-27 22:16:15 +11:00
Aditya Sanghi
f28916194c Resolves LH #6063, should be :expires_in not :expire_in 2010-11-27 15:20:46 +05:30
Xavier Noria
fd83f9d515 Merge branch 'master' of git://github.com/lifo/docrails 2010-11-27 07:43:59 +01:00
Ryan Bigg
c8c95fc519 Add methods for configuring middleware to config guide 2010-11-27 08:29:29 +11:00
Ryan Bigg
3ee0f0379c Add "Configuring Middleware" section to config guide, starting with mentioning what every bit of middleware does. 2010-11-27 08:15:29 +11:00
Ryan Bigg
167964149e Add explicit statement that verify_authenticity_token can be turned off for actions. 2010-11-27 07:57:10 +11:00
Ryan Bigg
6aa408e11c Add mention of config.serve_static_assets to config guide 2010-11-27 07:57:10 +11:00
Andrés Mejía
3a50799ab8 Mentioning catch with Bundler remembering options between different calls 2010-11-26 17:16:52 +01:00
Andrés Mejía
fe2103a1c8 Added missing word. 2010-11-26 14:11:28 +01:00
Aditya Sanghi
5b9f6a74db Resolving LH #5986, cookies doc updates 2010-11-26 16:41:33 +05:30
José Valim
ce9456eca0 Only convert direct hash instances in hash with indifferent access. 2010-11-26 11:56:52 +01:00
Ryan Bigg
8d6ac59d58 Added documentation for config.generators to the config guide 2010-11-26 18:06:14 +11:00
Ryan Bigg
72e973ebbc Add mention of after_initialize to the config guide 2010-11-26 17:03:14 +11:00
Ryan Bigg
6bb462861f There is no more load_application_initializers in Rails 3 2010-11-26 16:46:06 +11:00
Ryan Bigg
ff04f6fee4 root_path is now simply root in Rails 3 2010-11-26 15:09:17 +11:00
Ryan Bigg
788fdb2ac1 Update Changelog for configuring guide 2010-11-26 14:57:16 +11:00
Ryan Bigg
1d5db09ca7 There is no RAILS_GEM_VERSION environment variable or constant for Rails 3, since this is now managed by Bundler 2010-11-26 14:55:56 +11:00
Ryan Bigg
e96a64fb39 There is no config.action_mailer.default_implicit_parts_order method for Rails 3 2010-11-26 14:53:12 +11:00
Ryan Bigg
d0006121c5 Mention the default config.action_mailer.default options in Configuration guide 2010-11-26 14:43:16 +11:00
Ryan Bigg
66aefed136 There is no config.action_mailer.default_content_type method for Rails 3 2010-11-26 14:32:36 +11:00
Ryan Bigg
926d64e8b3 There is no config.action_mailer.default_charset method for Rails 3 2010-11-26 14:32:20 +11:00
Ryan Bigg
8d1c56148f Merge branch 'master' of github.com:lifo/docrails
* 'master' of github.com:lifo/docrails:
  Fix missing word in ActionMailer::Base documentation.
2010-11-26 14:26:29 +11:00
Ryan Bigg
e968acc21c Update ActionMailer documentation to not use deprecated template_root method as documentation, but rather raise_delivery_errors method 2010-11-26 14:25:46 +11:00
Ryan Bigg
8b49fae3ea There is no config.action_mailer.template_root method for Rails 3 2010-11-26 14:24:51 +11:00
Ryan Bigg
3d8d21b513 There is no config.action_view.warn_cache_misses method for Rails 3 2010-11-26 14:23:40 +11:00
Ryan Bigg
b4ec8ad09c Separate Action Dispatch and Action Pack sections in Configuration Guide. 2010-11-26 14:22:24 +11:00
Ryan Bigg
3eec4d4f93 There is no config.action_controller.optimize_named_routes method for Rails 3 2010-11-26 14:20:33 +11:00
Ryan Bigg
f1406a905a There is no config.action_controller.resource_path_names method for Rails 3 2010-11-26 14:19:17 +11:00
Ryan Bigg
33298d8e38 There is no config.action_controller.params_parser method for Rails 3. This is now handled by the ActionDispatch::ParamsParser middleware. 2010-11-26 14:16:57 +11:00
Ryan Bigg
9a4d672457 There is no view_path config option in Rails 3 2010-11-26 14:08:26 +11:00
Ryan Bigg
69ae74210c There is no root_path config option in Rails 3 2010-11-26 14:07:42 +11:00
Ryan Bigg
ffca2d7f14 There is no plugin_paths config option in Rails 3 2010-11-26 14:05:43 +11:00
Ryan Bigg
f01f7fc629 There is no plugin_locators config option in Rails 3 2010-11-26 14:05:22 +11:00
Ryan Bigg
9979251d7c There is no plugin_loader config option in Rails 3 2010-11-26 14:05:00 +11:00
Ryan Bigg
c8af6c28cc load_once_paths is now autoload_paths in Rails 3 2010-11-26 14:03:49 +11:00
Ryan Bigg
db7c8abbb6 There is no database_configuration_file method in Rails 3 2010-11-26 13:59:51 +11:00
Ryan Bigg
eb21791c5b There is no controller_paths method in Rails 3 2010-11-26 13:58:01 +11:00
Ryan Bigg
8b114bec06 Mention what cache_classes defaults to in all three default environments 2010-11-26 13:56:39 +11:00
Ryan Bigg
26837734d6 Don't mention Rails 2.3, given that this is supposed to be a guide for Rails *3*. 2010-11-26 13:54:37 +11:00
Ryan Bigg
aab76ce199 There is no more routes_configuration_file method. 2010-11-26 13:51:35 +11:00
Xavier Noria
9332cc582e removes a couple of redundant selfs 2010-11-26 00:35:23 +01:00
Santiago Pastorino
74049b57fb implicit self here 2010-11-25 21:31:14 -02:00
Josh Kalderimis
a98d9d65ae move the setting up of the mime collector into the collector on init
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-25 21:24:45 -02:00
Josh Kalderimis
2c08ee97c7 move the setting up of the mime collector into the collector on init 2010-11-26 00:21:51 +01:00
Santiago Pastorino
438c0188f8 nil check unneeded ht. exviva 2010-11-25 20:00:40 -02:00
Emilio Tagua
a3bd62e1ba Remove explicit return.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-25 17:35:24 -02:00
Emilio Tagua
c91a13f8f5 Use ternary instead explicit return.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-25 17:35:09 -02:00
Emilio Tagua
ac6e9447e5 Remove return, we are already returning self.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-25 17:33:38 -02:00
Emilio Tagua
1b6b80355c Remove explicit return.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-25 17:33:18 -02:00
Emilio Tagua
c4d31d0f13 Reuse lock_col variable instead calling locking_column class method.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-25 17:32:16 -02:00
José Valim
731ca00b48 Dynamically generaeted helpers on collection should not clobber resources url helper [#6028 state:resolved] 2010-11-25 11:50:29 +01:00
José Valim
90b0f61491 #:nodoc: internal methods. 2010-11-25 11:50:28 +01:00
Cheah Chu Yeow
ad8e1ba452 Fix missing word in ActionMailer::Base documentation. 2010-11-25 16:11:26 +08:00
raggi
cb1570936d Rakefiles are executables, and rake loads rake, not rakefile code 2010-11-25 06:49:55 +08:00
raggi
d8692985fe Don't depend on rubygems loading thread (for Mutex) 2010-11-25 06:47:27 +08:00
Aaron Patterson
ee74f2c623 alias should be a SQL literal 2010-11-24 14:16:38 -08:00
Aaron Patterson
38eb01863c initialize instance variables in initialize... o_O 2010-11-24 14:11:12 -08:00
Aaron Patterson
34d21b87bb adding a factory method to the join part for generating a table alias 2010-11-24 13:55:56 -08:00
Aaron Patterson
cdf6cf01cb use ARel rather than generate SQL strings 2010-11-24 13:55:55 -08:00
Aaron Patterson
afe51afcc6 remove useless join 2010-11-24 13:55:55 -08:00
Aaron Patterson
d4b8d3bafa moving column_aliases to JoinDependency 2010-11-24 13:55:55 -08:00
Aaron Patterson
a3ba60fd81 reduce method calls 2010-11-24 13:54:08 -08:00
Neeraj Singh
fa2a5ae033 If a user wants json output then try best to render json output. In such cases prefer kind_of(String) over respond_to?(to_str)
[#5841 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-24 22:08:36 +01:00
Neeraj Singh
66212f69ac If a nested_attribute is being marked for destruction and at the same time an attr_accessor value is being assigned then the value being assigned is being ignored. This patch is a fix for that issue.
[#5939 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-24 22:08:36 +01:00
Neeraj Singh
18adbe9347 process text/* if it appears in the middle of
HTTP_ACCEPT parameter
2010-11-25 04:38:51 +08:00
Neeraj Singh
5c9abb6cca processing image/* is an odditity because there is
a test case which expects image/* to not to be
expanded. So I am leaving image/* as it is and
process only text/* and application/*
2010-11-25 04:38:50 +08:00
Neeraj Singh
b52a6ba169 clean up test by using unregister method 2010-11-25 04:38:50 +08:00
Neeraj Singh
e870883625 unregister method implementation and test 2010-11-25 04:38:47 +08:00
Neeraj Singh
c6030e8562 Remove the not needed setup and teardown 2010-11-25 04:38:45 +08:00
Franck Verrot
7f8ce38b0d Document the behavior of the dup method: does not preserve timestamps 2010-11-25 03:01:30 +08:00
Franck Verrot
7b77a1fc71 Typo in the comments of the clear_timestamp_attributes method 2010-11-25 03:01:30 +08:00
Franck Verrot
c17cb7326d Dup should reset the timestamps as it is considered a new record 2010-11-25 01:18:43 +08:00
Franck Verrot
47f39d26a7 Testing that dup is resetting the timestamps 2010-11-25 01:18:43 +08:00
José Valim
8624065bff Allow template handlers to store temp data. 2010-11-24 12:38:52 +01:00
Josh Kalderimis
e39138478b port_string bought back to life as it is part of the public api
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-24 10:34:18 +01:00
Aaron Patterson
0687b21de8 removing ternary 2010-11-23 17:52:51 -08:00
Aaron Patterson
1aaa8edeb9 breaking classes up in to respective files 2010-11-23 17:42:49 -08:00
Aaron Patterson
a551d2ec62 fixing variable names. oops! 2010-11-23 17:42:49 -08:00
Neeraj Singh
8882e65ac8 No need to return anything 2010-11-24 08:00:40 +08:00
Aaron Patterson
8e8fb8a429 just wrap as a sql literal 2010-11-23 14:42:55 -08:00
Neeraj Singh
d33dcba72d Do not send id for quoting twice if the primary key is string.
[#6022 state:resolved]
2010-11-23 14:33:00 -08:00
Ryan Bigg
e4a9af186a Add mention of nested resource to resources documentation 2010-11-24 09:31:29 +11:00
Aaron Patterson
0456feab11 updating changelog for dup and clone semantics 2010-11-23 14:29:05 -08:00
Aaron Patterson
d717cb2913 clone and dup are working on 1.8 2010-11-23 14:29:05 -08:00
Aaron Patterson
fe4388eb15 converting clone test to dup test 2010-11-23 14:29:05 -08:00
Aaron Patterson
064c28d6c2 fixing dup regressions 2010-11-23 14:29:05 -08:00
Aaron Patterson
93d78b8318 fixing more dup tests 2010-11-23 14:29:05 -08:00
Aaron Patterson
6a8f1b8b40 renaming duplication test to dup test 2010-11-23 14:29:04 -08:00
Aaron Patterson
c5858a6df3 adding a specific case for clone testing 2010-11-23 14:29:04 -08:00
Aaron Patterson
28f4df0908 testing duped attributes are independent 2010-11-23 14:29:04 -08:00
Aaron Patterson
4c1f76eaab initialize_clone can go away 2010-11-23 14:29:04 -08:00
Aaron Patterson
035d00b665 making sure changes to dup will not touch original 2010-11-23 14:29:04 -08:00
Aaron Patterson
5badf60d12 dup keeps changes 2010-11-23 14:29:04 -08:00
Aaron Patterson
ca7b0a0d1a dup is working better 2010-11-23 14:29:03 -08:00
Ryan Bigg
fd47a4bf43 Document the :path option for resources :posts 2010-11-24 09:28:21 +11:00
Ryan Bigg
01af50d8b6 Add :module option documentation for the resources method 2010-11-24 09:27:12 +11:00
Ryan Bigg
2974f57aae Remove non-sensical first couple of lines for scope method documentation 2010-11-24 09:25:01 +11:00
Ryan Bigg
04af510b56 Paths in ActionDispatch::Scoping documentation should be for /admin/posts, not /admin/photos 2010-11-24 09:21:25 +11:00
Ryan Bigg
769575300a Fix formatting issue with rake routes output for the namespace method 2010-11-24 09:19:27 +11:00
Xavier Noria
0250c3eca4 copy-edits RDoc of 2fe43b6 2010-11-23 22:51:51 +01:00
Xavier Noria
85d64316a4 Merge branch 'master' of git://github.com/lifo/docrails 2010-11-23 21:59:50 +01:00
Emilio Tagua
9f35799221 Refactor && simplify count_records. 2010-11-23 09:51:07 -08:00
Emilio Tagua
e2bad8a2e7 No need to create a variables to use them once. 2010-11-24 01:37:02 +08:00
Emilio Tagua
d29d793c90 Don't create local vars. 2010-11-24 01:37:01 +08:00
Emilio Tagua
6ffe0ef55b Avoid creating local var. 2010-11-24 01:37:01 +08:00
Emilio Tagua
63c9185b62 Remove explicit return and avoid creating local var. 2010-11-24 01:37:01 +08:00
Emilio Tagua
1b531b7ee2 Remove explicit return. 2010-11-24 01:37:00 +08:00
Emilio Tagua
b8df3a9197 Use params default. 2010-11-24 01:37:00 +08:00
Emilio Tagua
861cdc4c59 Remove unneeded local var. 2010-11-24 01:36:59 +08:00
Emilio Tagua
9c161599ac Remove uneeded local var definition. 2010-11-24 01:36:59 +08:00
Emilio Tagua
a9e963d51d Remove confusing parenthesis. 2010-11-24 01:36:59 +08:00
Emilio Tagua
14055ea282 No need to define a local var here. 2010-11-24 01:36:59 +08:00
Jaime Iniesta
fd64bba648 i18n guide: fix RedCloth artifacts that were rendering bad format and broken links on 2.3 warnings 2010-11-23 17:53:59 +01:00
José Valim
da583df50c Remove bazillion warnings from AP suite. 2010-11-23 10:09:24 +01:00
José Valim
56b1214024 Speed up subdomain and domain calculus. 2010-11-23 10:05:47 +01:00
Josh Kalderimis
2fe43b694f :subdomain, :domain and :tld_length options can now be used in url_for, allowing for easy manipulation of the host during link generation.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-23 09:54:42 +01:00
Ray Baxter
de829f871b fix typo 2010-11-22 22:11:56 -08:00
Santiago Pastorino
9938a3fc78 Update to Prototype 1.7
[#6042 state:committed]
2010-11-23 00:32:30 -02:00
Aaron Patterson
dc320d5873 skip cloning if arguments are blank 2010-11-22 17:23:37 -08:00
Aaron Patterson
4ece7e06fd removing space error 2010-11-22 17:06:55 -08:00
Aaron Patterson
4d31ee1e0e removing unused variables 2010-11-22 16:14:37 -08:00
Aaron Patterson
e83d15376d adding a test for the runner module [#6027 state:resolved] 2010-11-22 15:57:03 -08:00
Aaron Patterson
4395d493c5 sort lists before comparing them 2010-11-22 15:51:29 -08:00
Sven Fuchs
5c86286dd6 add respond_to? to ActionDispatch::Integration::Runner
since Runner uses method_missing to delegate to the integration session it also should define respond_to? accordingly
2010-11-22 15:42:28 -08:00
Alex Rothenberg
66c09372f3 Removed ids_in_list_limit in favor of in_clause_length defined in database_limits.rb 2010-11-23 06:43:18 +08:00
Neeraj Singh
5debc65c35 Merge branch 'master' of github.com:lifo/docrails 2010-11-22 17:32:27 -05:00
Neeraj Singh
1c68e55ae5 Revert "unscoped takes care of named_scopes too"
This reverts commit 126fbd7ed8.
2010-11-22 17:32:15 -05:00
Neeraj Singh
21fd93cedd make test more resilient to future changes by not
testing the count and not testing the internal value
of the registered mime type.

Ideally all mime type registration should be cleaned up
in teardown.

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-22 23:06:15 +01:00
Neeraj Singh
794b34306e remove select, collect and then inject with
something better

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-22 23:06:15 +01:00
Neeraj Singh
c5bfc6abe4 string include method is 10x faster than creating
a new regex object every single time

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-22 23:06:14 +01:00
Neeraj Singh
8154f4b816 Compile regex only once
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-22 23:06:14 +01:00
Neeraj Singh
cdbbf6fd6b move the mime registration code to setup so that
it could be cleaned up on teardown.

Currently the test code
test/controller/mime_responds_test.rb impacts
test/dispatch/mime_type_test.rb.

dispatch/mime_type_test.rb runs independently fine
but when run as part of rake breaks because of
new mime types registered in
controller/mime_responds_test.rb

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-22 23:06:14 +01:00
Neeraj Singh
23ea19e20d rename star star to just one star
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-22 23:06:14 +01:00
Neeraj Singh
c9147ebfa0 cleanup Mime::LOOKUP after registering image/gif
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-22 23:06:14 +01:00
Neeraj Singh
4154c659fe fix test
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-22 23:06:14 +01:00
Neeraj Singh
6f6e754bac implement code that handles text/*, appplication/*,
and image/*

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-22 23:06:13 +01:00
Neeraj Singh
b798a59bd5 test for text/*, application/* and image/*
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-22 23:06:13 +01:00
Neeraj Singh
d04a21b362 declare regex as a constant
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-22 23:06:13 +01:00
Neeraj Singh
cbb2651cc0 add the fixture file
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-22 23:06:13 +01:00
Neeraj Singh
eb6ccc9953 do not assume that there is no space between
leading */* and comma

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-22 23:06:12 +01:00
Neeraj Singh
f5fba917f8 failing test for #6022
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-22 23:06:12 +01:00
Neeraj Singh
61950a4b05 current code ignores http header "Accept" if it
has ....,*/* .

It is possible to a device to send
request such that */* appear at the beginning of the
"Accept" header. This patch ensures that "Accept" header
is ignored for such cases too.

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-22 23:06:12 +01:00
Santiago Pastorino
c937ddb5ce Remove unused constant 2010-11-22 19:00:05 -02:00
Santiago Pastorino
6e559168dc There's no need for ternary op here 2010-11-22 18:47:47 -02:00
Santiago Pastorino
559c4292bc Remove unneeded metaprogramming and method generation in favor of direct definition 2010-11-22 16:02:13 -02:00
David N. Welton
818b366c3e Merge branch 'master' of github.com:lifo/docrails 2010-11-22 16:06:28 +01:00
David N. Welton
0598bd4d2d Explain that NamedBase makes the variable 'name' available to the script. 2010-11-22 16:05:53 +01:00
Pavel Gorbokon
2515ad8a3e Fix ruby syntax errors in railties/guides docs 2010-11-22 16:37:33 +02:00
David N. Welton
8c17d30d68 Slightly more natural sounding phrase. 2010-11-22 15:09:58 +01:00
Piotr Sarnacki
115abd52b6 Ensure that app generator is not loaded twice to get rid of warnings
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-22 13:43:18 +01:00
Piotr Sarnacki
f821055dc7 Do not create table_name_prefix method on isolated module if the method already exists.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-22 13:43:12 +01:00
Brian Alexander
51007f1dba Previous version inaccurately suggested that
resources :posts, :path => "/admin"

would route "/admin/posts" to the PostsController but it actually routed "/admin" to the PostsController
2010-11-21 19:54:05 -08:00
Matthew Rudy Jacobs
16d7ba0698 Cleaner way to extract the Postgres version 2010-11-21 20:45:01 +08:00
Xavier Noria
799a6fa047 realigns a series of hash arrows 2010-11-21 10:25:23 +01:00
Xavier Noria
15fd29b3ea documents <%== in the AS guide 2010-11-21 10:17:30 +01:00
Xavier Noria
6af08ab6d8 Merge branch 'master' of git://github.com/rails/rails 2010-11-21 03:30:06 +01:00
Xavier Noria
7c51d1fcf9 Spanish for "project" is "proyecto" 2010-11-21 03:29:44 +01:00
Neeraj Singh
7d5b097357 use_accept_header is no longer supported 2010-11-21 03:29:44 +01:00
Xavier Noria
a03a3b7c31 copy-edits d773ef8 2010-11-21 03:29:44 +01:00
Jamison Dance
ffed9db269 fix some grammar issues with section 2.5 2010-11-21 03:29:44 +01:00
Prem Sichanugrist
e65c23dc3e Mention the case that render will return nil if given :collection is nil or empty when rendering partial. 2010-11-21 03:29:44 +01:00
nosolopau
f975f35147 Spelling mistake: "Projecto" instead of "projeto" 2010-11-21 03:29:44 +01:00
Jaime Iniesta
925aeed4b6 i18n guide: fix external link to rack locale 2010-11-21 03:29:44 +01:00
Léo Hackin
f5a51a7788 Fix code for customize the error messages html adding a .html_safe of 8.3 section 2010-11-21 03:29:43 +01:00
Neeraj Singh
c8ab3992f8 unscoped takes care of named_scopes too 2010-11-21 03:29:43 +01:00
Jaime Iniesta
f044d38192 i18n guide: this is not longer a problem 2010-11-21 03:29:43 +01:00
Jaime Iniesta
cbea139130 i18n guide: remove link to external page about 'How to encode the current locale in the URL' as it no longer exists 2010-11-21 03:29:43 +01:00
Jaime Iniesta
3c64553644 i18n guide: it's activerecord.errors.messages.record_invalid (instead of 'invalid'), and messagges typo 2010-11-21 03:29:43 +01:00
zhengjia
4a51328ae8 Minor fix on Rails:Railtie documentation 2010-11-21 03:29:43 +01:00
eparreno
3d377454db remove old school validations and replaced with new validates method. Pending: fix active_record guide 2010-11-21 03:29:43 +01:00
Xavier Noria
f326221c70 Spanish for "project" is "proyecto" 2010-11-21 03:24:02 +01:00
Neeraj Singh
7b503f02ca Merge branch 'master' of github.com:lifo/docrails 2010-11-20 21:01:15 -05:00
Neeraj Singh
69d47a00c7 use_accept_header is no longer supported 2010-11-20 21:00:44 -05:00
Xavier Noria
074782eda2 copy-edits d773ef8 2010-11-21 00:01:10 +01:00
Jamison Dance
d773ef8e8c fix some grammar issues with section 2.5 2010-11-20 14:55:39 -07:00
José Valim
d5779efaf2 Ensure calling reset session twice does not raise errors. 2010-11-20 21:56:08 +01:00
Josh Kalderimis
8796f9a31a removed an AR method which wasn't used internally, had no tests, and had no docs
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-20 19:40:32 +01:00
Josh Kalderimis
d7db6a8873 class inheritable attributes is used no more! all internal use of class inheritable has been changed to class_attribute. class inheritable attributes has been deprecated.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-20 19:40:29 +01:00
José Valim
8d8062190d I18n is always loaded on boot by Active Model or Action Pack, so no need for supporting lazy hooks. 2010-11-20 19:39:57 +01:00
Prem Sichanugrist
3ddbaf955e Mention the case that render will return nil if given :collection is nil or empty when rendering partial. 2010-11-21 01:36:27 +07:00
Matthew Rudy Jacobs
d9ac62c914 Fix Bug: disable_referential_integrity doesn't work for postgres 9.0.1 2010-11-21 00:18:33 +08:00
Xavier Noria
206e48e8b9 applies API conventions to the RDoc of json_encode
* Examples running with the text are preferred over separate Example
  sections.
* No need to call puts, in # => we show the return value, not STDOUT.
* Say explicitly that double quotes are removed.
* Specify that we are talking \uXXX, rather than, say, HTML entities.
2010-11-20 16:20:42 +01:00
nosolopau
5b86e8f5e9 Spelling mistake: "Projecto" instead of "projeto" 2010-11-20 04:23:31 -08:00
Santiago Pastorino
4f3b5b8ec1 Fix indentation 2010-11-20 02:46:55 -02:00
Santiago Pastorino
d3f8765482 Avoid range object creation 2010-11-20 02:29:57 -02:00
Aaron Patterson
938243feb9 do not require ruby-debug automatically. please require it if you have declared it as a dependency 2010-11-19 16:26:09 -08:00
Emilio Tagua
2ba06b48de Clean IdentityMap before running each benchmark. 2010-11-19 19:09:01 -03:00
Emilio Tagua
b2b5d0237b No need to specify clear is a method from IM when we are inside IM. 2010-11-19 19:09:01 -03:00
Emilio Tagua
d9c0340ac3 IM enable should be kept in current thread. 2010-11-19 19:09:01 -03:00
Emilio Tagua
a12bb7140f "there is no need to store this option just for initialization" José Valim dixit. 2010-11-19 19:09:01 -03:00
Emilio Tagua
72aa6f4f64 identity_map name is used for configuration, use IdentityMap to access it. 2010-11-19 19:09:00 -03:00
Emilio Tagua
5098302fa1 Simplify remove_from_config. 2010-11-19 19:09:00 -03:00
Emilio Tagua
375aaa9db1 Enable IdentityMap when generating new apps. 2010-11-19 19:09:00 -03:00
Emilio Tagua
d47224190c Fix typo. 2010-11-19 19:09:00 -03:00
Emilio Tagua
1d530e23e5 We have to check object class to avoid issues when using STI. 2010-11-19 19:09:00 -03:00
Emilio Tagua
54f924c313 Enable IM in performance script unless IM=disabled is set when running it. 2010-11-19 19:09:00 -03:00
Emilio Tagua
b626f3e1ec IM is disabled by default. 2010-11-19 19:08:59 -03:00
Emilio Tagua
1c88d59891 Add test using identity map and select. 2010-11-19 19:08:59 -03:00
Emilio Tagua
22696b5b7c No need to check returned object now that weakhash is gone. 2010-11-19 19:08:59 -03:00
Emilio Tagua
dd166fab33 Usa Hash instead of WeakHash. 2010-11-19 19:08:59 -03:00
Emilio Tagua
2fd48c8d06 Revert "Use ActiveSupport::WeakHash for MRI, JRuby prefers Weakling."
This reverts commit 3cddebc2402eb71f2806e8b2119dc3efdceb4662.

Conflicts:

	activerecord/lib/active_record/identity_map.rb
	activesupport/lib/active_support/weak_hash.rb
2010-11-19 19:08:59 -03:00
Emilio Tagua
421643bb3d Read from config, because AR may not be loaded yet. 2010-11-19 19:08:59 -03:00
Emilio Tagua
938f168f22 Set IdentityMap disabled by default. 2010-11-19 19:08:58 -03:00
Emilio Tagua
a84add0c2c We don't need to dup key, since only value is weak. 2010-11-19 19:08:58 -03:00
Emilio Tagua
7d563f9278 Refactor associations cache removal from IM. (ht: Aaron Patterson) 2010-11-19 19:08:58 -03:00
Emilio Tagua
6cd1224f2e Update number of queries executed instead of avoiding IM. 2010-11-19 19:08:58 -03:00
Emilio Tagua
7892543a88 Don't change tests, fix code: if locking is enabled skip IM. 2010-11-19 19:08:57 -03:00
Emilio Tagua
5ee3663101 Remove associated objects from IM when clearing them from association cache. 2010-11-19 19:08:57 -03:00
Emilio Tagua
095c445819 Test setup method should clean up IM. 2010-11-19 19:08:57 -03:00
Emilio Tagua
b9e869a420 Query objects if readonly_value is false, skip them only if nil. 2010-11-19 19:08:57 -03:00
Emilio Tagua
024bc70bfe Added method to IM to remove objects by class and id. Then used it to remove objects when updating counters. 2010-11-19 19:08:57 -03:00
Emilio Tagua
4a0a1605cd Clear IdentityMap before continue this test, we can do this here because store_full_sti_class is not supposed to change during "runtime". 2010-11-19 19:08:56 -03:00
Emilio Tagua
edb69b9be3 Call super setup in this test. 2010-11-19 19:08:56 -03:00
Emilio Tagua
4015819ada Fix number of queries performed in tests. 2010-11-19 19:08:56 -03:00
Emilio Tagua
9fe0dbf8bd Ups, forgot to remove one conflict tag from previous commit. 2010-11-19 19:08:56 -03:00
Emilio Tagua
93daf1b809 Revert "IdentityMap - Adjustments to test cases"
This reverts commit 4db9dca55e3acc2c59f252eb83ecb83db5f4b81b.

Conflicts:

	activerecord/test/cases/identity_map_test.rb
2010-11-19 19:08:56 -03:00
Emilio Tagua
69b627ef67 Don't load IdentityMap middleware if not enabled. Simplify middleware. 2010-11-19 19:08:56 -03:00
Emilio Tagua
48edab9ba0 Don't wrap into identity map if it is disabled. 2010-11-19 19:08:55 -03:00
Emilio Tagua
333cdcdf5a Bring back "Reject attributes even if association is loaded" after rebasing to master. 2010-11-19 19:08:55 -03:00
Emilio Tagua
08c37b7ed8 Use block syntax in IdentityMap middleware. 2010-11-19 19:08:55 -03:00
Emilio Tagua
3a34ae04bd Change API name, we don't need any param. 2010-11-19 19:08:55 -03:00
Emilio Tagua
d13df4c6c4 Use just one repository and keep it in the current thread. 2010-11-19 19:08:55 -03:00
Emilio Tagua
87aa9133c4 Flush IdentityMap when running tests. 2010-11-19 19:08:55 -03:00
Emilio Tagua
c036caf501 Use association_class method which returns the reflection class, this method is redefined in polymorphic belongs to associations. 2010-11-19 19:08:54 -03:00
Emilio Tagua
f3722a30b6 Use IdentityMap middleware to flush map on each request. 2010-11-19 19:08:42 -03:00
Emilio Tagua
4da31d21bc Add initial tests for WeakHash. 2010-11-19 19:08:42 -03:00
Emilio Tagua
96cc08f24b Check if constant is defined in AR, if not this can cause errors when using polymorphic associations. 2010-11-19 19:08:42 -03:00
Emilio Tagua
0873d1e944 Use conditional to avoid warnings. 2010-11-19 19:08:28 -03:00
Emilio Tagua
86699339bc Weakling is only required for JRuby. 2010-11-19 19:08:28 -03:00
Emilio Tagua
ada014929b Use ActiveSupport::WeakHash for MRI, JRuby prefers Weakling. 2010-11-19 19:08:28 -03:00
Emilio Tagua
301dd3d514 Use hash[:Post][1] style identity maps for each table. 2010-11-19 19:08:28 -03:00
Emilio Tagua
4f3b8e107a IdentityMap is enabled by default. 2010-11-19 19:08:12 -03:00
Emilio Tagua
a62f7220bb Add docs to Identity Map. 2010-11-19 19:08:12 -03:00
Emilio Tagua
da721dae1e Added config syntax to enable/disable identity map: config.active_record.identity_map = true 2010-11-19 19:08:12 -03:00
Emilio Tagua
003e4fb4cf Fix test name and typo. 2010-11-19 19:08:12 -03:00
Marcin Raczkowski
76f33dc372 Reeject attributes even if association is loaded 2010-11-19 19:08:12 -03:00
Marcin Raczkowski
740450514c Test reorganization 2010-11-19 19:08:11 -03:00
Marcin Raczkowski
24485b9ef0 Separated initialization 2010-11-19 19:08:11 -03:00
Emilio Tagua
6d58b27422 Set Identity Map disabled by default. Enable it for testing. 2010-11-19 19:08:11 -03:00
Emilio Tagua
ab4238203f Test with target object, failing on 1.9.2 when comparing object against association proxy object. 2010-11-19 19:08:10 -03:00
Emilio Tagua
21483cbc67 Testing objects equality is what we are looking for here, no query caching. 2010-11-19 19:08:10 -03:00
Emilio Tagua
cd6d6fcb23 Change test models. 2010-11-19 19:08:10 -03:00
Emilio Tagua
0f169493a2 Use strings primary keys in identity map keys to avoid problems with casting and also allow strings primary keys. 2010-11-19 19:08:10 -03:00
Emilio Tagua
a3210d90be implicit_readonly is not set until records are loaded, just check readonly_value and then set readonly status. 2010-11-19 19:08:10 -03:00
Emilio Tagua
c0ad5e48f6 Don't use identity map if loading readonly records, this will prevent changing readonly status on already loaded records. 2010-11-19 19:08:09 -03:00
Emilio Tagua
448420ff7d Add tests for inverse relations when using has many and identity map. 2010-11-19 19:08:09 -03:00
Emilio Tagua
6f684478dd Remove associated object from identity map when reloading. 2010-11-19 19:08:09 -03:00
Emilio Tagua
234bbe5cb0 Associated objects are assigned from identity map if enabled and contains associated object. 2010-11-19 19:08:09 -03:00
Emilio Tagua
6b0b95f1bd Add test for update_attributes and identity map. 2010-11-19 19:07:43 -03:00
Emilio Tagua
f3adddb966 Remove objects from identity map if save! failed, otherwise finding again the same record will have invalid attributes. 2010-11-19 19:07:43 -03:00
Emilio Tagua
e83f5a0ae9 Remove objects from identity map if save failed, otherwise finding again the same record will have invalid attributes. 2010-11-19 19:07:43 -03:00
Emilio Tagua
a9edd6cf93 Add test to show that when IdentityMap is disabled finders returns different objects. 2010-11-19 19:07:43 -03:00
Emilio Tagua
f1913ad835 Uncomment test and make it work. 2010-11-19 19:07:43 -03:00
Emilio Tagua
f0eaf11c0e Use yield instead block argument. 2010-11-19 19:07:42 -03:00
Emilio Tagua
fa11c60b44 Disable identity map when loading associated records from habtm. 2010-11-19 19:07:42 -03:00
Emilio Tagua
dd6e680815 Prevent pushing duplicated records when using identity map. 2010-11-19 19:07:03 -03:00
Emilio Tagua
7df61754a5 Remove associated records from identity map if any raised an unexpected exception. 2010-11-19 19:07:03 -03:00
Emilio Tagua
09f12a1270 Use identity mapper only if enabled. 2010-11-19 19:04:58 -03:00
Emilio Tagua
e88fd0230f Remove object from identity map if transaction failed. 2010-11-19 19:04:40 -03:00
Marcin Raczkowski
eebf33a234 IdentityMap - Fixes problem with dirty attributes 2010-11-19 19:04:40 -03:00
Marcin Raczkowski
ccb335da1f IdentityMap - Adjustments to test cases 2010-11-19 19:04:39 -03:00
Marcin Raczkowski
3ab625f984 Looping prevention for autosave relations on validation and creation 2010-11-19 19:04:39 -03:00
Marcin Raczkowski
c357f842e2 IdentityMap - adding and removing of records on create/update 2010-11-19 19:04:39 -03:00
Marcin Raczkowski
ce66bfdc54 IdentityMap - misc fixes
- Added IdentityMap to be included into AR::Base
- Fixed bug with Mysql namespace missing when running tests only for sqlite
- Added sqlite as default connection
2010-11-19 19:03:57 -03:00
Marcin Raczkowski
ce3ea558ab IdentityMap - Tests for IM 2010-11-19 19:03:56 -03:00
Marcin Raczkowski
3df4460a74 IdentityMap - Adding Weakling and IM Base as concern 2010-11-19 19:03:56 -03:00
Xavier Noria
902ae14e65 guides: gives clear instructions for feedback, removes links to the now archived LH project 2010-11-19 21:46:12 +01:00
Aaron Patterson
6bd93f672a wtf vim 2010-11-19 11:48:23 -08:00
Aaron Patterson
598fc85f9e fisting typeo, thanks @vinibaggio 2010-11-19 11:42:58 -08:00
Aaron Patterson
a4d9b1d329 adding documentation for reversible migrations 2010-11-19 11:34:42 -08:00
Aaron Patterson
db32b545da adding Migration#change to the CHANGELOG 2010-11-19 11:20:02 -08:00
Aaron Patterson
87124457e5 fisting my spelling errors 2010-11-19 10:55:57 -08:00
Aaron Patterson
0cc6c46fe9 testing a non-invertible migration case 2010-11-19 10:50:24 -08:00
Aaron Patterson
47017bd169 invertable migrations are working 2010-11-19 10:31:03 -08:00
Aaron Patterson
6519df4157 command recorder will record commands sent to a delegate object 2010-11-19 10:24:16 -08:00
Aaron Patterson
6dbbfae563 adding invertable migration test 2010-11-19 10:24:16 -08:00
Aaron Patterson
0d7410faab updating documentation 2010-11-19 10:24:16 -08:00
Aaron Patterson
96b50a0392 IrreversibleMigration is raised if we cannot invert the command 2010-11-19 10:24:15 -08:00
Aaron Patterson
b29a24bb6f commands are reversed 2010-11-19 10:24:15 -08:00
Aaron Patterson
5d93900dc6 add and remove timestamps can be inverted 2010-11-19 10:24:15 -08:00
Aaron Patterson
24b637a80f inverting add_index 2010-11-19 10:24:15 -08:00
Aaron Patterson
843e319f78 partial implementation of the command recorder 2010-11-19 10:24:15 -08:00
Aaron Patterson
24174d1b3a this return value is not used, so stop returning it 2010-11-19 10:23:13 -08:00
Aaron Patterson
9280fbf795 instantiate the delegate object after initialize is defined so that our initialize method actually gets called 2010-11-19 10:14:13 -08:00
Henning Koch
deff528947 Fix AssetIncludeTag ensuring that files are in the wrong directory [#6015 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-19 15:38:13 -02:00
Xavier Noria
cb8f7a1156 removes orphan tests, custom String#% was removed from AS in 39d6f9e 2010-11-19 18:24:58 +01:00
Santiago Pastorino
bb7b705b0c Fix indentation 2010-11-19 14:26:44 -02:00
Santiago Pastorino
555b7cd04a Don't merge just directly add to the action to the :partial key 2010-11-19 14:26:42 -02:00
Santiago Pastorino
b1ffd65b8f Useless assignation 2010-11-19 14:26:39 -02:00
Jaime Iniesta
bf78ceb772 i18n guide: fix external link to rack locale 2010-11-19 17:25:37 +01:00
Santiago Pastorino
d891ad4e92 Make ARes tests unescape [ and ] 2010-11-18 23:52:17 -02:00
Santiago Pastorino
52b71c01fd Revert "Quick fix for not escaping []s (not ideal)"
According to http://www.ietf.org/rfc/rfc2616.txt and
http://tools.ietf.org/rfc/rfc3986.txt [ and ] are reserved characters
and should be escaped using "%" HEX HEX

This reverts commit 856d2fd874 and
1ee9b40b18a0bed5bb10a0785f7e2730bac983f6..
2010-11-18 23:31:00 -02:00
Aaron Patterson
07a74f196d connection is set from the connection pool during migrations 2010-11-18 15:53:59 -08:00
Aaron Patterson
e107dcca6b testing multiple ORd queries 2010-11-18 13:39:57 -08:00
José Valim
e3d8331c5b Revert "Remove deprecated form_for with strings or symbols"
This code was not deprecated. What was deprecated is the following:

  form_for(:foo, @foo)

Which now should be rewritten as:

  form_for(@foo, :as => :foo)

The following format is valid:

  form_for(:foo)

This reverts commit be797750e6.
2010-11-18 20:22:14 +01:00
Leonardo Capillera
be797750e6 Remove deprecated form_for with strings or symbols
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-18 16:46:55 -02:00
Aaron Patterson
c52e2cf4b3 delegating path and open to internal tempfile 2010-11-18 10:10:25 -08:00
Aaron Patterson
26923756fb removing space errors 2010-11-18 10:01:29 -08:00
Alex Rothenberg
c5a284f8eb Adapters can specify maximum number of ids they support in a list of expressions
(default is nil meaning unlimited but Oracle imposes a limit of 1000)
Limit is used to make multiple queries when preloading associated has_many or habtm records
2010-11-18 09:59:52 -08:00
Piotr Sarnacki
77fc0cc165 Ensure that initializers are executed before loading rake tasks
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-18 17:46:18 +01:00
Léo Hackin
03f1413787 Fix code for customize the error messages html adding a .html_safe of 8.3 section 2010-11-18 08:25:38 -02:00
José Valim
d19768b50c Facepunch failing tests. 2010-11-18 09:32:48 +01:00
Neeraj Singh
126fbd7ed8 unscoped takes care of named_scopes too 2010-11-17 21:46:55 -05:00
Aaron Patterson
80d9b724c3 group can be done by left side only 2010-11-17 17:28:40 -08:00
Santiago Pastorino
c6bfd6802a When use where more than once on the same column, relation doesn't do an 'or' or 'in' with the values 2010-11-17 17:15:25 -08:00
Aaron Patterson
00693209ec collapsing same table / column WHERE clauses to be OR [#4598 state:resolved] 2010-11-17 17:10:50 -08:00
Aaron Patterson
56c5820458 use shorter form for sql literals 2010-11-17 16:15:52 -08:00
Jon Leighton
fe42c00ac3 Fix bug with 0bb85ed9ff which missed out a fixtures declaration in cascaded_eager_loading_test.rb 2010-11-17 15:52:18 -08:00
Neeraj Singh
9c1993bf6b replace and with && as per rails coding convention 2010-11-18 07:49:45 +08:00
Neeraj Singh
f978c4b2e4 remove the rescue block by returning a not asking Base for lookup_ancestors. It was also marked for later optimization. 2010-11-17 15:44:04 -08:00
Josh Kalderimis
ae44bf7c7e bye bye extlib_inheritable_*, AS callbacks now using class_attribute
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-18 00:38:51 +01:00
Aaron Patterson
43e2e10f4f adding an initialize with name and version defaults 2010-11-17 15:30:09 -08:00
Piotr Sarnacki
ae56c82e2b Added config.action_controller.include_all_helpers to CHANGELOG.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-18 00:29:23 +01:00
Piotr Sarnacki
250fb3f6c2 Add config.action_controller.include_all_helpers, by default it is set to true.
In older rails versions there was a way to use only helpers from
helper file corresponding to current controller and you could also
include all helpers by saying 'helper :all' in controller. This config
allows to return to older behavior by setting it to false.
2010-11-18 00:20:57 +01:00
Aaron Patterson
4d35f8b661 updating generators 2010-11-17 14:57:54 -08:00
Aaron Patterson
c1a63c8dba fixing more documentation 2010-11-17 14:57:54 -08:00
Aaron Patterson
d1fcba8118 fixing documentation, removing unused AS files 2010-11-17 14:57:54 -08:00
Aaron Patterson
7906e08bba fixing indentation since these methods are not class methods 2010-11-17 14:57:54 -08:00
Aaron Patterson
606e41a4dd these methods are no longer needed 2010-11-17 14:57:54 -08:00
José Valim
f14c2bf582 Pass the view object as parameter to the handler. Useful if you need to access the lookup context or other information when compiling the template. 2010-11-17 23:50:45 +01:00
José Valim
7b2f2c8b47 Tidy up generators commits. 2010-11-17 23:32:19 +01:00
Piotr Sarnacki
aafac200be Fix generators tests on ruby 1.9
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-17 23:32:19 +01:00
Aaron Patterson
17c7723451 updating CHANGELOG 2010-11-17 14:26:35 -08:00
Aaron Patterson
b0a6f58068 do not need these accessors 2010-11-17 14:26:35 -08:00
Aaron Patterson
68b66ef308 testing instance based migrations 2010-11-17 14:26:35 -08:00
Aaron Patterson
974ff0dd43 singleton method added is no longer needed 2010-11-17 14:26:35 -08:00
Aaron Patterson
0bea9fd6be schema migrations work as instances 2010-11-17 14:26:34 -08:00
Aaron Patterson
8b2f801ed8 converted migrations to support instance methods 2010-11-17 14:26:34 -08:00
Neeraj Singh
fe2f168d40 fix warning during test execution
[#5997 state:resolved]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-17 20:19:07 -02:00
Santiago Pastorino
08eee5ce20 Fix stupid error 2010-11-17 20:06:19 -02:00
Santiago Pastorino
884e3506d2 Bump builder to 3.0.0 2010-11-17 19:35:58 -02:00
Aaron Patterson
77440ec51a fixing assertions so error messages will be more helpful 2010-11-17 13:02:03 -08:00
Santiago Pastorino
646e5202e0 Typo fixed 2010-11-17 10:27:44 -02:00
Jon Leighton
1bc90044b6 Merge branch 'master' into nested_has_many_through
Conflicts:
	activerecord/lib/active_record/associations/has_many_through_association.rb
	activerecord/test/cases/associations/has_many_through_associations_test.rb
2010-11-17 11:32:31 +00:00
Jaime Iniesta
648568df1a i18n guide: this is not longer a problem 2010-11-17 09:24:47 +01:00
Carl Lerche
401c1835af Anchors should be allowed on constraints that are not on path segments 2010-11-16 21:46:15 -08:00
Carl Lerche
1deeaf5495 The PRE part of the rails version is a string or nil 2010-11-16 17:23:39 -08:00
Carl Lerche
d20eab85bf Removing the old release.rb script 2010-11-16 17:19:47 -08:00
Carl Lerche
c3dd1238c5 Small cleanup of the release task 2010-11-16 17:19:47 -08:00
Carl Lerche
df5fe4d83c Add a task to tag the commit and push 2010-11-16 17:19:47 -08:00
Carl Lerche
aa0732dc00 Ignore the dist directory 2010-11-16 17:19:47 -08:00
Carl Lerche
482790db6c Add a task to commit the changes 2010-11-16 17:19:47 -08:00
Carl Lerche
dab1d8dcc6 Add some sanity checks to the gem push script 2010-11-16 17:19:47 -08:00
Carl Lerche
6b3f521b80 Remove some useless comments from the release task 2010-11-16 17:19:47 -08:00
Carl Lerche
4ff8c59fb7 Update the main Rakefile to use the new release tasks 2010-11-16 17:19:47 -08:00
Carl Lerche
fb5b2ba186 Add a new file containing tasks related to releasing 2010-11-16 17:19:47 -08:00
Carl Lerche
ccd2f3ede5 Update the version.rb files to include a PRE part 2010-11-16 17:19:46 -08:00
Carl Lerche
7e4f9dbd67 Remove the old gem release task 2010-11-16 17:19:46 -08:00
Aaron Patterson
2738ec891b removing many unused variables 2010-11-16 17:06:50 -08:00
Aaron Patterson
08c64bbd39 super automatically passes on the implicit block 2010-11-16 14:28:19 -08:00
Aaron Patterson
05320e3788 use unless instead of if ! 2010-11-16 14:28:19 -08:00
Aaron Patterson
5f608fc7c4 removing space errors 2010-11-16 14:28:19 -08:00
Aaron Patterson
c801f233df reloading an association will properly set attributes of instantiated objects. Thanks Brian Palmer [#5802 state:resolved] 2010-11-16 14:28:19 -08:00
Piotr Sarnacki
1395545404 Do not run migrations from mounted engine separately.
There is no good way now to run migrations for mounted engine in test application,
but that way of running migrations makes it really hard to run
engine in development mode and test it (you need to copy migrations
in dev mode and in that case in tests they will be run twice).

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-16 22:58:13 +01:00
Jaime Iniesta
8f8abbbf7a i18n guide: remove link to external page about 'How to encode the current locale in the URL' as it no longer exists 2010-11-16 22:35:11 +01:00
Aaron Patterson
59ba800698 refactoring uniq method 2010-11-16 13:34:18 -08:00
Jaime Iniesta
0545d0eb99 i18n guide: it's activerecord.errors.messages.record_invalid (instead of 'invalid'), and messagges typo 2010-11-16 22:25:20 +01:00
Aaron Patterson
7ebd36d1c4 refactor to reduce method calls 2010-11-16 11:43:11 -08:00
Alexandru Catighera
a5cdf0b9eb Fix ActiveRecord calculations when grouped by multiple fields 2010-11-16 10:38:47 -08:00
Aaron Patterson
254b0a4bbb using a merge with a Hash[] rather than a loop to add SAX parsed attributes 2010-11-16 10:09:42 -08:00
Piotr Sarnacki
437ceab139 Create directory before copying migrations if it does not exist 2010-11-16 17:00:01 +01:00
Piotr Sarnacki
510375b501 Fix plugin new --mountable: ActionController instead of ActiveController 2010-11-16 16:41:37 +01:00
Piotr Sarnacki
ced8ebcee0 Change inside_namespace method to inside_template and use it in all templates by default
The initial implementation of namespacing was based on wrong
assumptions. Namespacing path and class names in templates
should be based on current namespace and skip_namespace attribute,
but it should be not necessary to wrap content on all the templates
into additional block methods.
2010-11-16 16:38:14 +01:00
zhengjia
45e3827eb2 Minor fix on Rails:Railtie documentation 2010-11-16 09:26:21 -06:00
Xavier Noria
a820d0afdd revises RDoc of AR::Base#== 2010-11-16 15:58:37 +01:00
Santiago Pastorino
4718d097ff Models should be equals even after destroyed
[#5978 state:committed]
2010-11-16 12:40:40 -02:00
Xavier Noria
dff0dfb7f8 adds a publish_docs task to force stable docs generation and publishing after a new stable tag has been pushed 2010-11-16 14:07:55 +01:00
Josh Kalderimis
e1e780a31d Brought the domain method in AD http url inline with subdomain where @@tld_length is used by default. Also set the default value of @@tld_length to 1. 2010-11-16 18:57:51 +08:00
Doug Ireton
ecd0310e14 Fix misspelling of 'deprecation' in plugin_generator. 2010-11-16 15:37:29 +08:00
Aaron Patterson
ace84a003c support finding by a ruby class [#5979 state:resolved] 2010-11-15 20:25:43 -08:00
Aaron Patterson
7bf9cbb766 adding more test coverage around finding with active record objects 2010-11-15 15:30:58 -08:00
José Valim
bd96e45641 Fix failing tests. 2010-11-16 00:04:38 +01:00
Josh Kalderimis
1d5842b27c updated the rails guide to reflect changes in the action view railtie relating to the asset id cache code 2010-11-16 00:04:37 +01:00
Josh Kalderimis
2bed4d94e6 changed asset_timestamps_cache to asset_ids_cache, added an rdoc comment to the new public api, and updated the railtie 2010-11-16 00:04:37 +01:00
Josh Kalderimis
ce1f87673c corrected the AV railtie to use the new home for cache_asset_timestamps, and merged asset id caching and asset paths together. 2010-11-16 00:04:37 +01:00
Josh Kalderimis
0ff1c5935f reorganised the the common asset helpers module into a class and have it include the id caching module, this class is now shared from the view instance to the asset include tag helpers (js and css) 2010-11-16 00:04:37 +01:00
Josh Kalderimis
6a609dbc82 incorporated most of the feedback from José 2010-11-16 00:04:37 +01:00
Josh Kalderimis
6747ae2708 reduced duplication between the javascript and stylesheet asset tag methods, also split the asset id caching methods into a separate module for easy inclusion and use by the asset include tag class and base asset tag helpers 2010-11-16 00:04:36 +01:00
Josh Kalderimis
7a38c8b9f5 removed an assert from a test as it was testing a private method 2010-11-16 00:04:36 +01:00
Josh Kalderimis
1c129f8f8e separated the asset id methods to a separate module, removed some dupliation with the various path methods, and moved the base asset tag methods to a base module so the asset id module can play nice with the path generation 2010-11-16 00:04:36 +01:00
Josh Kalderimis
91b0b65834 split the javascript and stylesheet tag helpers into separate files as a precusor before removing the duplication between the two 2010-11-16 00:04:36 +01:00
Piotr Sarnacki
bf176e9c7a Do not allow to use plugin_new generator directly, you should use Usage:
rails new APP_PATH [options]

Options:
  -G, [--skip-git]            # Skip Git ignores and keeps
  -r, [--ruby=PATH]           # Path to the Ruby binary of your choice
                              # Default: /Users/drogus/.rvm/rubies/ruby-1.8.7-p302/bin/ruby
  -b, [--builder=BUILDER]     # Path to an application builder (can be a filesystem path or URL)
      [--edge]                # Setup the application with Gemfile pointing to Rails repository
      [--dev]                 # Setup the application with Gemfile pointing to your Rails checkout
      [--skip-gemfile]        # Don't create a Gemfile
  -d, [--database=DATABASE]   # Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite3/frontbase/ibm_db)
                              # Default: sqlite3
  -O, [--skip-active-record]  # Skip Active Record files
  -m, [--template=TEMPLATE]   # Path to an application template (can be a filesystem path or URL)
  -J, [--skip-prototype]      # Skip Prototype files
  -T, [--skip-test-unit]      # Skip Test::Unit files

Runtime options:
  -s, [--skip]     # Skip files that already exist
  -p, [--pretend]  # Run but do not make any changes
  -f, [--force]    # Overwrite files that already exist
  -q, [--quiet]    # Supress status output

Rails options:
  -v, [--version]  # Show Rails version number and quit
  -h, [--help]     # Show this help message and quit

Description:
    The 'rails new' command creates a new Rails application with a default
    directory structure and configuration at the path you specify.

Example:
    rails new ~/Code/Ruby/weblog

    This generates a skeletal Rails installation in ~/Code/Ruby/weblog.
    See the README in the newly created application to get going. command
2010-11-16 00:04:35 +01:00
Piotr Sarnacki
b0665345f8 Allow running rails plugin new command inside rails application 2010-11-16 00:04:35 +01:00
Piotr Sarnacki
4da6d95604 Bye bye bang bang. 2010-11-16 00:04:35 +01:00
Piotr Sarnacki
ef4afed81c There is no need to make isolated? method with bang-bang, just alias isolated 2010-11-16 00:04:35 +01:00
Piotr Sarnacki
dc1250265c Deprecate plugin generator 2010-11-16 00:04:35 +01:00
Piotr Sarnacki
73443329de Add skip-gemspec option to 'plugin new' generator 2010-11-16 00:04:34 +01:00
Piotr Sarnacki
d988fa820a Update changelog with rails plugin new 2010-11-16 00:04:34 +01:00
Piotr Sarnacki
fefce1262b Don't need to support rails plugin --version 2010-11-16 00:04:34 +01:00
Aaron Patterson
2b2082eb09 rejecting blank strings 2010-11-15 15:02:18 -08:00
Aaron Patterson
dcdfc84f55 use quoted id of single AR::Base objects in predicates 2010-11-15 14:35:38 -08:00
Aaron Patterson
e4591489d1 reduce method calls 2010-11-15 14:22:06 -08:00
Aaron Patterson
0be181bfa0 make sure we are only doing sanity checking against regular expressions 2010-11-15 13:37:27 -08:00
eparreno
ca4b4c0baa Merge branch 'master' of github.com:lifo/docrails 2010-11-15 22:16:17 +01:00
Xavier Noria
91a6db90cf Merge branch 'master' of git://github.com/lifo/docrails 2010-11-15 19:45:46 +01:00
eparreno
04775a41cb remove old school validations and replaced with new validates method. Pending: fix active_record guide 2010-11-15 19:21:40 +01:00
Neeraj Singh
7c5c1a07c0 if association is already loaded and if a find operation is performed on the already loaded association list with an empty hash then do not perform another sql
[#5972 state:resolved]
2010-11-15 10:12:23 -08:00
Aaron Patterson
022519a032 fisting a bunch of unused variable warnings 2010-11-15 10:12:09 -08:00
James Miller
c2c2b8b962 Add HTTP Verb Constraints (:via) to routing guide 2010-11-15 09:26:57 -07:00
Mikel Lindsaar
8124b2bc24 Revert "Bump up mail dependency to take advantage of relaxed i18n version requirement"
Locking to ~> 2.2.9.1 means locking to < 2.2.10, not intended behaviour.

This reverts commit e7de5dd11e.
2010-11-16 00:23:03 +11:00
Mikel Lindsaar
e7de5dd11e Bump up mail dependency to take advantage of relaxed i18n version requirement 2010-11-16 00:08:23 +11:00
Ryan Bigg
8b5700192e Merge branch 'master' of github.com:lifo/docrails
* 'master' of github.com:lifo/docrails:
  Getting Started guide: remove calls to f.error_messages as it has been removed from Rails
  deliver_* is no more
  removed unnecessary indentation
  added note with example for using flash in redirection
  corrected sample code to clear @_current_user class variable also
  the partial option is not required for simple partial rendering
  colorize_logging is a Rails General Configuration option not a specific option of ActiveRecord
  Fixed the name of the 'generator option'
  this reads better, i don't know what the other 'so on' are, doesn't help reader imho
  added missing word to clear up meaning in my previous commit
  Add a note to TextHelpers making explicit their default behavior of not escaping but sanitizing.
  removed indentation, for code style consistency and readibility
  Use Rails.logger, not ActiveRecord::Base.logger
  removed etc. not require
  added missing space and minor rewording
  corrected to Rails 3 syntax for declaring resources
  Fixes ActionMailer example error
2010-11-15 11:44:04 +08:00
Santiago Pastorino
0262218976 Add f.submit to forms just to show the most common use case 2010-11-14 21:40:34 -02:00
Santiago Pastorino
bdf70fd379 Merge branch 'spastorino-master' 2010-11-14 21:28:11 -02:00
Santiago Pastorino
f597d1ec80 This doesn't make sense here 2010-11-14 21:25:37 -02:00
Jaime Iniesta
72fda46214 Merge branch 'master' of github.com:lifo/docrails 2010-11-15 00:07:35 +01:00
Jaime Iniesta
324569bb11 Getting Started guide: remove calls to f.error_messages as it has been removed from Rails 2010-11-15 00:07:25 +01:00
Santiago Pastorino
4ef6d2e534 Add empty line between previous method and RDoc of submit to allow RDoc appear on api.rubyonrails.org 2010-11-14 21:01:59 -02:00
Santiago Pastorino
c996901913 Change deprecated syntax and use f.submit instead of submit_tag 2010-11-14 21:00:26 -02:00
Santiago Pastorino
bc556a21e2 Remove unused var 2010-11-14 15:34:07 -02:00
Jason Cheow
93c9f4a942 Fix bug where size of through association is not correct after adding a has_many association (occurs only before main object has been reloaded).
[#5968 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-14 15:32:52 -02:00
José Valim
fae4264a7e Update the guides. 2010-11-14 16:22:21 +01:00
Aditya Sanghi
330d65d312 deliver_* is no more 2010-11-14 18:27:08 +05:30
Rajinder Yadav
abf225423c removed unnecessary indentation 2010-11-14 06:02:16 -05:00
Rajinder Yadav
f69784289b added note with example for using flash in redirection 2010-11-14 05:20:10 -05:00
Rajinder Yadav
23f71c431d corrected sample code to clear @_current_user class variable also 2010-11-14 05:12:01 -05:00
Robert Pankowecki
88688cdd8e Fix when database column name has some symbolic characters. [#5818 state:resolved] 2010-11-14 17:24:31 +08:00
raggi
e6d14279b8 Add support for try to just yield the object to a block if no method is to be called. Kind of like a tap_if_present. 2010-11-14 17:23:44 +08:00
Larry Sprock
f43e5d160b HashWithIndifferentAccess should not change the subclass of an array 2010-11-14 17:14:47 +08:00
Rajinder Yadav
7e1f6688e9 the partial option is not required for simple partial rendering 2010-11-13 20:24:04 -05:00
Ryan Bigg
74061f55be Document the constraints method 2010-11-14 07:32:54 +08:00
Santiago Pastorino
293c8a4de5 Tests added for rendering partial with layout, when the partial contains another render layout with block call added missing fixtures 2010-11-13 13:40:36 -02:00
Santiago Pastorino
e3b68e5f6b Tests added for rendering partial with layout, when the partial contains another render layout with block call 2010-11-13 13:38:40 -02:00
Paco Guzman
d44cd370bf colorize_logging is a Rails General Configuration option not a specific option of ActiveRecord 2010-11-13 12:17:21 +01:00
Santiago Pastorino
27f4ffd11a Make collection and collection_from_object methods return an array
This transforms for instance scoped objects into arrays and avoid unneeded queries

[#5958 state:committed]
2010-11-13 04:02:57 -02:00
Ryan Bigg
fe8446fcce Add documentation for :path_names option on resources 2010-11-13 11:16:32 +08:00
Ryan Bigg
95f41fe12e See the scope method for documentation for namespace's shallow_path option 2010-11-13 11:16:06 +08:00
Ryan Bigg
b235519777 Add documentation for the mount method in ActionDispatch's Mapper 2010-11-13 11:15:17 +08:00
Yehuda Katz
7cc371a032 Allow bundler 1.1 (and 1.2, etc.) in Rails 1.0.2 and above 2010-11-12 18:36:55 -06:00
Franck Verrot
983976ec54 Finder gives a little bit more info on the lookup column (primary key) 2010-11-13 06:32:08 +08:00
Santiago Pastorino
b15d816166 Update to JQuery 1.4.4
Check out http://blog.jquery.com/2010/11/11/jquery-1-4-4-release-notes/
for information on what's new.
2010-11-12 13:02:17 -02:00
Frederick Ros
e7723baa0b Fixed the name of the 'generator option' 2010-11-11 23:02:05 +01:00
Santiago Pastorino
b734e192a7 present? is better here 2010-11-11 19:00:33 -02:00
José Valim
c63600576a Remove whitespaces and add missing test. 2010-11-11 20:07:47 +01:00
José Valim
f912a359aa Merge remote branch 'drogus/plugin_new'
Conflicts:
	railties/test/generators/app_generator_test.rb
2010-11-11 19:39:21 +01:00
Franck Verrot
de2933e1a0 STI type is now updated when calling AR::Base.becomes on subclasses [#5953 state:resolved] 2010-11-12 02:17:34 +08:00
Santiago Pastorino
296e5c38f1 Use ! instead of not 2010-11-11 15:24:49 -02:00
Santiago Pastorino
894fd28859 Fixed bug in active_record/nested_attributes where an empty string id caused an ActiveRecord::RecordNotFound error. Found by [Ben Tillman]
[#5638 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-11 15:23:40 -02:00
Santiago Pastorino
ceef719924 Bump Arel up to 2.0.2 2010-11-11 15:05:12 -02:00
Rob Zolkos
bafa1533f4 skip testing framework if app created with --skip-test-unit [#5796 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-11 17:35:18 +01:00
José Valim
37d3266f35 Add missing autoload. 2010-11-11 17:30:24 +01:00
zhengjia
8a6ac4fc26 Remove unused Configurable in Rails::Engine and Rails::Application. Remove unnecessary railties load path in cli [#5871 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-11 17:29:39 +01:00
Neeraj Singh
793967cd40 provide better error message if path is uri [#5914 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-11 17:27:47 +01:00
Jeff Kreeftmeijer
154e5d735e The model generator shouldn't throw warnings when using mass nouns [#5363 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-11 17:24:23 +01:00
Neeraj Singh
fbaf3a23d9 fields_for should treat ActiveRecord::Relation as an array
[#5795 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-11 17:14:47 +01:00
José Valim
a897402863 Remove inline comment. 2010-11-11 17:07:06 +01:00
Marcelo Giorgi
2bb1c202b4 Make after_filter halt when before_filter renders or redirects [#5648 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-11 17:05:07 +01:00
Carlos Antonio da Silva
7846fb79e1 Fix render partial with layout and no block
When using a render :partial with :layout call, without giving a block,
if the given :partial had another render :partial call, the layout was
not being rendered. This commit fixes this context by storing variables
before rendering the partial, so they are not overrided in any successive
call to render partials down the path. All ActionPack tests are ok.
2010-11-11 16:22:39 +01:00
Carlos Antonio da Silva
50c7aab996 Fix issue with rendering partials and then yielding inside a render layout call
The given block was never being executed when another render :partial call
existed before the yield call, due to the block being overriden.

This commit also adds some more tests to render with :layout option.
2010-11-11 16:22:39 +01:00
Aditya Sanghi
920660b19c patching to ensure separator is printed with order [#5816 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-11 12:22:15 -02:00
José Valim
9c9f416d39 Allow AR Session Store to be renewed 2010-11-11 14:17:14 +01:00
Santiago Pastorino
2651a87a33 Duck typing here 2010-11-11 01:33:27 -02:00
Alvaro Bautista
5dc7f34dca Fix ActiveSupport::TimeWithZone#localtime method with DateTime
[#5344 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-11 01:30:28 -02:00
Xavier Noria
c577e90f61 restores the example for fixed-width font in API guidelines 2010-11-10 23:46:00 +01:00
Santiago Pastorino
7a2be37592 Remove copy_instance_variables_from from guides 2010-11-10 19:12:10 -02:00
Santiago Pastorino
c20838596b Remove unused method 2010-11-10 16:57:12 -02:00
Denis Odorcic
b961c6c158 Remove useless cgi
[#5943 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-10 16:43:26 -02:00
Xavier Noria
41366cdec6 syncs CHANGELOGs for 3.0.2 in 3-0-stable with the ones in master 2010-11-09 20:56:41 +01:00
Santiago Pastorino
88a559d414 Double negation of an already boolean value produces the same result 2010-11-09 16:53:03 -02:00
Santiago Pastorino
75dfd95618 Don't check if persisted is defined just initialize it properly 2010-11-09 16:00:02 -02:00
Santiago Pastorino
994a1c2a47 Execute less operations 2010-11-09 14:03:09 -02:00
David Chelimsky
1f06652a57 use persisted? instead of new_record? wherever possible
- persisted? is the API defined in ActiveModel
- makes it easier for extension libraries to conform to ActiveModel APIs
  without concern for whether the extended object is specifically
  ActiveRecord

[#5927 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-09 13:54:04 -02:00
Rajinder Yadav
5cdb46d9fb this reads better, i don't know what the other 'so on' are, doesn't help reader imho 2010-11-09 05:05:56 -05:00
Rajinder Yadav
4e074c7cc6 added missing word to clear up meaning in my previous commit 2010-11-09 04:34:32 -05:00
Rajinder Yadav
26d314ed6a Merge branch 'master' of github.com:lifo/docrails 2010-11-09 04:31:08 -05:00
Xavier Noria
f57b5197b3 registers number_to_currency's :negative_format in the CHANGELOG 2010-11-09 09:37:32 +01:00
Andrew White
ef46b9f21a Strip regexp anchors from rake routes output [#5934 state:resolved] 2010-11-09 05:24:10 +00:00
Piotr Sarnacki
cc135e3b6d Allow to set dummy application path through options 2010-11-08 22:43:51 +01:00
Jon Leighton
e05162cffa Merge branch 'master' into nested_has_many_through
Conflicts:
	activerecord/lib/active_record/associations.rb
2010-11-08 11:02:26 +00:00
José Valim
645f515843 Add a note to TextHelpers making explicit their default behavior of not escaping but sanitizing. 2010-11-08 01:47:49 -08:00
Rajinder Yadav
4b7ac55780 removed indentation, for code style consistency and readibility 2010-11-08 04:17:56 -05:00
dmathieu
78e085b12c Use Rails.logger, not ActiveRecord::Base.logger
Because everybody is not using ActiveRecord. And the logger is not specific to it.
2010-11-08 10:14:15 +01:00
Rajinder Yadav
149f795d16 removed etc. not require 2010-11-08 04:04:18 -05:00
Rajinder Yadav
e135f13f50 added missing space and minor rewording 2010-11-08 03:58:19 -05:00
Rajinder Yadav
4d5807bcd5 corrected to Rails 3 syntax for declaring resources 2010-11-08 03:47:45 -05:00
Santiago Pastorino
4e0477c9b7 Test cache.key_file_path with separators ht. Jim Wilson [#5611] 2010-11-07 20:02:14 -02:00
Denis Odorcic
c452d734f2 Fix FileStore cache incorrectly regenerating its key from a pathname when a regexp is used in expire_fragment
[#5850 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-07 20:01:51 -02:00
Michael Koziarski
3d6eea0221 Update the validates_uniqueness_of documentation to tell you to use a unique index.
The other options mentioned were not good ideas and disclaimed as such in the documentation.
2010-11-08 10:16:40 +13:00
Michael Koziarski
9ecaa80300 Make safe_append= live on AV::OutputBuffer not AS::SafeBuffer
Conflicts:

	actionpack/lib/action_view/template/handlers/erb.rb
2010-11-08 10:10:30 +13:00
Francesc Esplugas
e22ad7ae1d Fixes ActionMailer example error 2010-11-07 22:08:59 +01:00
Jan Maurits Faber
f04ec6a227 Added support for Erubis <%== tag
<%== x %> is syntactic sugar for <%= raw(x) %>

Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#5918 status:committed]
2010-11-08 09:55:55 +13:00
James A. Rosen
697f4851b8 OrderedHash#select now preserves order [#5843 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-07 17:27:07 -02:00
David Trasbo
990f52ebd7 Make cookies hash in ActionDispatch::TestProcess indifferent access [#5761 state:committed]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-07 14:48:51 -02:00
laserlemon
02039e9752 Ensure that HashWithIndifferentAccess duplication preserves class (for sublclasses) and default value [#5724 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-07 10:19:51 -02:00
Raimonds Simanovskis
6709078eb1 use column names as order by complex function parameters, fix for postgresql adapter to correctly remove ASC/DESC
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-07 09:55:17 -02:00
Ryan Bigg
b591989b5f Fix indentation for :as option documentation on the namespace method 2010-11-07 12:22:39 +10:00
Ryan Bigg
ff3a494e2e Document the :shallow_path option for scope 2010-11-07 12:21:56 +10:00
Ryan Bigg
e6aed6b6a8 Indent final comment for :path option 2010-11-07 12:18:19 +10:00
Ryan Bigg
ee646788fc Indent code example for :as option 2010-11-07 12:17:36 +10:00
Ryan Bigg
7d83673134 Document the :as option for the scope method 2010-11-07 12:11:39 +10:00
Ryan Bigg
ffe97e338e Space between module option documentation and path documentation 2010-11-07 12:09:58 +10:00
Ryan Bigg
4a6150a3eb Fix indentation on comment for :path option 2010-11-07 12:09:38 +10:00
Ryan Bigg
6ca042b3e4 Document the :as option for the namespace method 2010-11-07 12:07:41 +10:00
Ryan Bigg
66d1276d7f Document the :module option for namespace 2010-11-07 12:05:55 +10:00
Ryan Bigg
0eef4e3bfb Document the :path option for namespace 2010-11-07 12:05:14 +10:00
Ryan Bigg
379939e1e0 Begin to document the namespace method for AD's Mapper 2010-11-07 12:04:25 +10:00
Ryan Bigg
e5eece41b5 Document the controller method for AD's Mapper 2010-11-07 11:49:57 +10:00
Ryan Bigg
5f7f3adccd Document the defaults method 2010-11-07 11:39:57 +10:00
Ryan Bigg
5040ecbfea Document the :module and :path options for the scope method. 2010-11-07 11:39:55 +10:00
Ryan Bigg
35c7ca5c37 Separate comments and examples with "Examples" header. 2010-11-07 11:39:53 +10:00
Ryan Bigg
433e1aca86 Fix where the documentation says "photos", but the example shows "posts" or "comments" by switching both to simply "posts" 2010-11-07 11:39:50 +10:00
Ryan Bigg
203e45cd7f Add further documentation + examples for the get, post, put and delete methods in ActionDispatch::Routing::Mapper::HttpHelpers 2010-11-07 11:39:27 +10:00
Aaron Patterson
1acc086278 reduce duplication in assiciations #construct() 2010-11-06 18:20:08 -07:00
Santiago Pastorino
46332e458c Move @assigns from the controller to the test itself 2010-11-06 21:15:59 -02:00
Santiago Pastorino
2382667955 Fix problems trying to functional test AC::Metal controllers
[#5393 state:committed]
2010-11-06 21:15:03 -02:00
Aaron Patterson
c11102d4f8 make sure we keep parent records in order 2010-11-06 14:32:41 -07:00
Aaron Patterson
39a8056791 only call to_s on the association variable once 2010-11-05 17:08:56 -07:00
Aaron Patterson
c43d909ee2 simplify instantiate in the join parts object 2010-11-05 16:56:50 -07:00
Aaron Patterson
d89d702361 index is not used, so removing it 2010-11-05 16:56:50 -07:00
Aaron Patterson
a79e1de90a reduce method calls to the join base object 2010-11-05 16:56:50 -07:00
Chris Eppstein
b1667c7c2c Correctly handle the case of an API response that returns a hash by treating a single hash argument as the resource instead of as options. 2010-11-06 06:56:36 +08:00
Aaron Patterson
06d518a323 stop recursively calling exists? 2010-11-05 15:36:36 -07:00
Santiago Pastorino
29b54a41d9 Bring back ruby-debug19 for Ruby versions < 1.9.3 2010-11-05 19:11:58 -02:00
Santiago Pastorino
00261a187e Avoid warning: shadowing outer local variable 2010-11-05 16:34:23 -02:00
Santiago Pastorino
3146aa68fd Fixes queries using limits and punctuation in order, removes order("col1, col2") usage in favor of order(["col1", "col2"})
[#4597 state:committed]
2010-11-05 11:27:34 -07:00
Aaron Patterson
d5e45931a0 renaming exec in the mysql adapter 2010-11-05 10:21:14 -07:00
Aaron Patterson
0f45f23669 renaming exec in the PG adapter 2010-11-05 10:15:33 -07:00
Aaron Patterson
9a08517c8d converted exec to exec_query for sqlite 2010-11-05 10:08:38 -07:00
sblackstone
710dcf826a Association Proxy should not undefine the default respond_to_missing 2010-11-04 15:02:27 -07:00
Piotr Sarnacki
1fd46240a6 New version of thor was released no need to use the one from git 2010-11-04 20:04:57 +01:00
José Valim
3bb1ad32bf Update to latest thor. 2010-11-04 10:39:15 -02:00
Aaron Patterson
fa4686243c ignoring certain SQL when using Oracle 2010-11-03 17:34:49 -07:00
Aaron Patterson
6367e95867 select goes through exec(), so no method chaining for query counts 2010-11-03 17:34:49 -07:00
Aaron Patterson
5c6978608d use bind params in select with query monkeypatch 2010-11-03 17:34:49 -07:00
Piotr Sarnacki
d0d30e767d Fix scaffold generator to be aware of namespace in isolated engine 2010-11-03 20:48:40 +01:00
Santiago Pastorino
d7ec94f665 Just initialize options with an empty hash 2010-11-03 17:20:02 -02:00
Aaron Patterson
6362538815 add more tests surrounding camlize in xmlmini, refactor rename_key() 2010-11-03 11:02:42 -07:00
Jeremy Holland
ea0faa2055 Allowing to_xml :camelize option to be set to :lower to enable lower-camelcase tags [#5903 state:resolved] 2010-11-03 10:43:45 -07:00
Xavier Noria
208fb2920d made a pass to the docs of :negative_format 2010-11-03 06:20:26 +01:00
Don Wilson
c4d977fbbc Added :negative_format option to number_to_currency function [#5894 state:resolved]
Signed-off-by: Andrew White <andyw@pixeltrix.co.uk>
2010-11-02 23:00:23 +00:00
Santiago Pastorino
3c7215bdce Test that capture doesn't escape twice 2010-11-02 20:02:55 -02:00
Santiago Pastorino
72d12d9455 Call as ERB::Util.html_escape since is not the module is not included here 2010-11-02 20:02:13 -02:00
Jeff Kreeftmeijer
bb9c58eb4a Make sure capture's output gets html_escaped [#5545 state:resolved]
Also remove a duplicate test_link_to_unless assertion and add .html_safe to the
remaining one.

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-02 19:38:28 -02:00
Piotr Sarnacki
cbe391b517 Add --mountable option to 'plugin new' generator which generates full mountable application (engine) 2010-11-02 17:14:53 +01:00
Piotr Sarnacki
c159b501b0 Add example rake task to 'plugin new' generator 2010-11-02 17:14:53 +01:00
Piotr Sarnacki
f9e33fc09a create_dummy_app method that allows to easily create dummy application from template 2010-11-02 17:14:53 +01:00
Piotr Sarnacki
fadad11f90 Properly skip test unit in 'plugin new' generator 2010-11-02 17:14:53 +01:00
Piotr Sarnacki
2133495b8c Properly handle other databases in 'plugin new' generator 2010-11-02 17:14:53 +01:00
Piotr Sarnacki
b6497d3b5a Skip active record properly in 'plugin new' generator 2010-11-02 17:14:52 +01:00
Piotr Sarnacki
57fae9b2c7 Use rails integration tests by default in 'plugin new' generator 2010-11-02 17:14:52 +01:00
Piotr Sarnacki
4d108cb33d We don't need to configure ActionMailer in plugin's test helper, it's configured by dummy app 2010-11-02 17:14:52 +01:00
Piotr Sarnacki
9cb9713eeb Refactor app and plugin generators to use new Thor API 2010-11-02 17:14:52 +01:00
Piotr Sarnacki
a5311ee86b Make deep copy of application generators on engine initialization.
Otherwise nested hashes will be same objects for both application and engine,
which will result in overwriting each others values on changes.
2010-11-02 17:14:52 +01:00
Piotr Sarnacki
5071b727b4 Added Hash#deep_dup function which performs deep duplication on given hash 2010-11-02 17:14:52 +01:00
Piotr Sarnacki
cfbe595831 Use application's generators defaults as engine defaults to not force users to manually set it 2010-11-02 17:14:52 +01:00
Piotr Sarnacki
9e86767bb8 Do not create additional newline 2010-11-02 17:14:52 +01:00
Piotr Sarnacki
489b279fc4 Don't be verbose while creating dummy application in plugin new generator 2010-11-02 17:14:52 +01:00
Piotr Sarnacki
013fc0a418 No need to require 'app_base', it's required in app_generator 2010-11-02 17:14:51 +01:00
Piotr Sarnacki
46fdb3197d Pass more options to test/dummy in 'plugin new' generator 2010-11-02 17:14:51 +01:00
Piotr Sarnacki
671d1469c6 Add --full option to 'plugin new' generator, which generates rails engine 2010-11-02 17:14:51 +01:00
Piotr Sarnacki
fdbd9df21e No need for say_step in 'plugin new' generator 2010-11-02 17:14:51 +01:00
Piotr Sarnacki
d995953869 DRY up app generator and plugin new generator. Moved shared options to AppBase generator 2010-11-02 17:14:51 +01:00
Piotr Sarnacki
68295bc693 Remove integration tests and ActionModel/ActiveRecord calls from 'rake plugin new' generator, it shouldn't be available as default option 2010-11-02 17:14:51 +01:00
Piotr Sarnacki
ac8f9276f5 We don't need gem tasks, we have a gemspec 2010-11-02 17:14:51 +01:00
Piotr Sarnacki
48fef64cb5 Builder should not be responsible for running store_application_definition method 2010-11-02 17:14:50 +01:00
Piotr Sarnacki
ae1debd442 Make tests for app and plugin generators more DRY 2010-11-02 17:14:50 +01:00
Piotr Sarnacki
b36fa51a3f Allow easy overriding of test framework in 'rake plugin new' generator, using PluginBuilder 2010-11-02 17:14:50 +01:00
Piotr Sarnacki
fd1562af8c Ensure that tests run properly 2010-11-02 17:14:50 +01:00
Piotr Sarnacki
59d52229f9 Change // style regexp to %r{}, to not confuse editors code highlighting 2010-11-02 17:14:50 +01:00
Piotr Sarnacki
e51e9e2db0 Add --dev and --edge options to rails plugin new 2010-11-02 17:14:50 +01:00
Piotr Sarnacki
5c8b48ab4b Added USAGE for rails plugin new 2010-11-02 17:14:50 +01:00
Piotr Sarnacki
bbf02ffea4 That method is already declared at AppBase 2010-11-02 17:14:50 +01:00
Piotr Sarnacki
bcd414fd10 Add support for templates for rails plugin new 2010-11-02 17:14:50 +01:00
Piotr Sarnacki
b8a0fabe18 Ensure that options for plugin new generator are not passed to application generator 2010-11-02 17:14:49 +01:00
Piotr Sarnacki
b37938eff7 Refactored AppGenerator and PluginNewGenerator to inherit from AppBase. 2010-11-02 17:14:49 +01:00
Piotr Sarnacki
cfcea1d53a Added 'rails plugin new' generator which generates gem plugin skeleton.
This command is based on enginex gem by José Valim. It generates gem structure
and ads dummy application into test/dummy. This can be used to start developing
any kind of extension for rails 3.
2010-11-02 17:14:49 +01:00
Andrew White
d446392f76 Add additional HTTP request methods from the following RFCs:
* Hypertext Transfer Protocol -- HTTP/1.1
  http://www.ietf.org/rfc/rfc2616.txt)

* HTTP Extensions for Distributed Authoring -- WEBDAV
  http://www.ietf.org/rfc/rfc2518.txt

* Versioning Extensions to WebDAV
  http://www.ietf.org/rfc/rfc3253.txt

* Ordered Collections Protocol (WebDAV)
  http://www.ietf.org/rfc/rfc3648.txt

* Web Distributed Authoring and Versioning (WebDAV) Access Control Protocol
  http://www.ietf.org/rfc/rfc3744.txt

* Web Distributed Authoring and Versioning (WebDAV) SEARCH
  http://www.ietf.org/rfc/rfc5323.txt

* PATCH Method for HTTP
  http://www.ietf.org/rfc/rfc5789.txt

[#2809 state:resolved] [#5895 state:resolved]
2010-11-02 10:56:14 +00:00
Pratik Naik
18b6aa6538 Make should_record_timestamps? serialization aware rather than object#changed? 2010-11-02 01:45:30 +00:00
Pratik Naik
e911ed1f0f Ensure save always updates timestamps when serialized attributes are present 2010-11-02 01:42:49 +00:00
Pratik Naik
c5c2e4fefd Add timestamps to Topic 2010-11-02 01:24:31 +00:00
Jon Leighton
083d6f2676 Update new tests in cascaded_eager_loading_test.rb to work with the modified fixtures in this branch 2010-10-31 11:27:58 +00:00
Jon Leighton
026dbd28d9 Fix bug with 0bb85ed9ff which missed out a fixtures declaration in cascaded_eager_loading_test.rb 2010-10-31 11:24:26 +00:00
Jon Leighton
9a1a32ac2b Fix naughty trailing whitespace 2010-10-31 11:21:28 +00:00
Jon Leighton
d010fb13ef Merge branch 'master' into nested_has_many_through
Conflicts:
	activerecord/lib/active_record/associations/has_many_association.rb
	activerecord/lib/active_record/associations/through_association_scope.rb
2010-10-31 10:04:56 +00:00
Xavier Noria
3cf85fb4fc Merge branch 'master' of git://github.com/lifo/docrails 2010-10-30 23:28:16 +02:00
Aaron Patterson
296467fcc4 only returning where values for the corresponding relation, also filtering where value hash based on table name [#5234 state:resolved] [#5184 state:resolved] 2010-10-30 13:25:49 -07:00
Aaron Patterson
cbca12f908 adding tests for #5234 and #5184. Tests were from Akira Matsuda. Thanks Akira! 2010-10-30 13:20:54 -07:00
Aaron Patterson
7d5762d2c2 no need to merge where values if no new where values have been added 2010-10-30 12:28:49 -07:00
Aaron Patterson
2b48e47654 ruby-debug19 does not work with 1.9.3, so I am removing it 2010-10-30 11:30:08 -07:00
Denis Odorcic
cc9742920c Convert :primary_key in association to a string before comparing to column names, so that for example :primary_key => :another_pk works as well [#5605 state:resolved] 2010-10-30 11:24:36 -07:00
Aaron Patterson
67a3a70295 refactoring find_join_association 2010-10-30 08:45:40 -07:00
Ernie Miller
0bb85ed9ff Fix issues when including the same association multiple times and mixing joins/includes together. 2010-10-30 06:48:44 -07:00
Jon Leighton
b82fab25f9 Refactoring: replace the mix of variables like @finder_sql, @counter_sql, etc with just a single scope hash (created on initialization of the proxy). This is now used consistently across all associations. Therefore, all you have to do to ensure finding/counting etc is done correctly is implement the scope correctly. 2010-10-30 06:30:00 -07:00
Aaron Patterson
2a47e7ef10 only do string substitution on column names once, remove intermediate data structures 2010-10-30 06:16:54 -07:00
Aaron Patterson
2e07260f36 columns are always strings 2010-10-30 06:12:50 -07:00
Aaron Patterson
6cf44a1bd6 no need to to_i, sqlite does that for us 2010-10-30 06:11:06 -07:00
John Firebaugh
403b06e98e Ensure original exception message is present in both Template::Error#message and Template::Error#inspect.
Previously, #inspect would produce #<ActionView::Template::Error: ActionView::Template::Error>, which is not very useful.
2010-10-29 15:27:19 -07:00
John Firebaugh
7bbad753e2 ActiveSupport::Deprecation.silence no longer needed. 2010-10-29 15:27:19 -07:00
snusnu
973b908777 Added missing AS require to active_model/naming.rb
We saw a failing spec when running the DataMapper
ActiveModel compliance specs for dm-active_model.

  ActiveModel::Naming#model_name

relies on the Module#parents method defined in

  active_support/core_ext/module/introspection.rb

Adding the appropriate require statement of course
fixed our specs.
2010-10-30 00:20:31 +08:00
Aditya Sanghi
3ca1665038 reverting last change to javascript helper; needs more investigation 2010-10-29 10:13:48 +05:30
Aditya Sanghi
74f3f74b6e fixed javascript helper doc to close issue #10 raised by jialin 2010-10-29 10:01:43 +05:30
Jon Leighton
fc276e5635 Merge branch 'master' into nested_has_many_through
Conflicts:
	activerecord/CHANGELOG
	activerecord/lib/active_record/association_preload.rb
	activerecord/lib/active_record/associations.rb
	activerecord/test/schema/schema.rb
2010-10-28 18:06:01 +01:00
Aaron Patterson
6a3d6b7f13 select_all() should always return an array, so no need to test 2010-10-27 14:39:24 -07:00
Aaron Patterson
f6ddb3553a fisting test name 2010-10-27 14:33:02 -07:00
Aaron Patterson
9ce0211806 speeding up query cache 2010-10-27 14:23:01 -07:00
Aaron Patterson
7104122cc3 making query cache work with prepared statements 2010-10-27 14:05:40 -07:00
Andrew White
47ceb135c6 Ensure that Rails.env is defined first 2010-10-27 10:30:14 +01:00
Aaron Patterson
e73b0b84d9 renaming bind_values to binds where it makes sense 2010-10-26 13:44:11 -07:00
Aaron Patterson
104d0b263e adding backwards compatibility for non-prepare statement handling drivers 2010-10-26 13:44:11 -07:00
Aaron Patterson
fca229e205 caching column values 2010-10-26 13:44:11 -07:00
Aaron Patterson
02128d628c setting the authorized session clears the statement cache 2010-10-26 13:44:11 -07:00
Aaron Patterson
9d9aed433b add a session authorization setter to the pg connection 2010-10-26 13:44:11 -07:00
Aaron Patterson
1741bbe2d5 avoiding statement cache if there are no bind values 2010-10-26 13:44:10 -07:00
Aaron Patterson
28a18b5988 folding async_exec to exec 2010-10-26 13:44:10 -07:00
Aaron Patterson
03e4ea5290 clear cache before resetting the connection 2010-10-26 13:44:10 -07:00
Aaron Patterson
1b4e0b6542 prepare the statement before we cache the key 2010-10-26 13:44:10 -07:00
Aaron Patterson
43bbb25ddd bind substitution is working properly 2010-10-26 13:44:10 -07:00
Aaron Patterson
9d46e0d012 bind parameters are now typecast 2010-10-26 13:44:10 -07:00
Aaron Patterson
e2813479f9 basic bind parameters are working 2010-10-26 13:44:09 -07:00
Aaron Patterson
ffb999125a initial exec() method is working in pg adapter 2010-10-26 13:44:09 -07:00
Aaron Patterson
eb83eb6c98 monkey patching with enumerable so we can call each 2010-10-26 13:44:09 -07:00
Aaron Patterson
fe2ee4fafd monkey patching Mysql::Stmt, calling free on the metadata 2010-10-26 13:44:09 -07:00
Aaron Patterson
ee959a9ca1 free the result after slurping 2010-10-26 13:44:09 -07:00
Aaron Patterson
efc10a8a64 eliminating some calls to execute() 2010-10-26 13:44:09 -07:00
Aaron Patterson
050d7d3e49 statements are cached, cache is cleared on reconnect 2010-10-26 13:44:09 -07:00
Aaron Patterson
d4b0bcb88e all mysql tests are passing 2010-10-26 13:44:09 -07:00
Aaron Patterson
d6b16bbaf7 one more mysql test left! 2010-10-26 13:44:09 -07:00
Aaron Patterson
77b1193ac1 mysql tests are mostly passing 2010-10-26 13:44:08 -07:00
Aaron Patterson
9c7e2e4117 find_one uses prepared statement cache 2010-10-26 13:44:08 -07:00
Aaron Patterson
5abebfb569 clearing statements on disconnect and reset 2010-10-26 13:44:08 -07:00
Aaron Patterson
54ff59f3ba refactoring tests 2010-10-26 13:44:08 -07:00
Aaron Patterson
d7207cf504 type casting bound value based on column associated with value 2010-10-26 13:44:08 -07:00
Aaron Patterson
76d0805786 stop calling execute directly on the database connection 2010-10-26 13:44:08 -07:00
Aaron Patterson
77d548a6d3 removing another execute 2010-10-26 13:44:08 -07:00
Aaron Patterson
7023d73f26 removing more execute calls 2010-10-26 13:44:08 -07:00
Aaron Patterson
e60fecd829 removing more calls to execute 2010-10-26 13:44:08 -07:00
Aaron Patterson
853d39e854 removing some uses of execute 2010-10-26 13:44:07 -07:00
Aaron Patterson
cc468d3ec8 exec returns an AR::Result 2010-10-26 13:44:07 -07:00
Aaron Patterson
6ceffb8178 adding bind_values to relations 2010-10-26 13:44:07 -07:00
Aaron Patterson
497218d5db adding bind value substitution 2010-10-26 13:44:07 -07:00
Aaron Patterson
ef0cf143a9 adding the abstract method 2010-10-26 13:44:07 -07:00
Aaron Patterson
c376fd488c Revert "removing unused variable"
This reverts commit 3e4ede81d6.
2010-10-26 13:43:06 -07:00
Aaron Patterson
f61f758761 reducing the number of parameters to select() 2010-10-26 13:43:06 -07:00
José Valim
2a90a4e51c Use latest I18n. 2010-10-26 18:17:11 -02:00
Jeremy Kemper
0dfdbdd4f4 Fix loop introduced by rack:dda892d 2010-10-26 11:31:05 -07:00
José Valim
69a1a0adb5 Remove rack-cache-purge. 2010-10-26 14:05:06 -02:00
Andrew White
4ba24ba043 Allow generated url helpers to be overriden [#5243 state:resolved] 2010-10-26 14:27:18 +01:00
Mikel Lindsaar
c40074c1c7 Updating mail dependency to 2.2.9 2010-10-26 18:50:30 +11:00
Ugis Ozols
8f141d0ce7 Changed environment.rb to application.rb 2010-10-25 22:27:56 +03:00
Ugis Ozols
604c21102f Reworded sentence using text from rails source code. 2010-10-25 22:18:20 +03:00
Andrew White
2d5a12a50b Don't write out secure cookies unless the request is secure 2010-10-25 16:36:35 +01:00
Ugis Ozols
4f0b119b2d Changed environment.rb to application.rb 2010-10-25 16:48:59 +03:00
Ryan L. Cross
67c40160d3 Corrected typo and wording. 2010-10-24 19:17:49 -07:00
Xavier Noria
cdce5fc886 ensures that no browser shows a vertical scrollbar in the code blocks of guides, thanks to Marcelino Llano for a hint to fix this 2010-10-24 19:28:28 +02:00
Xavier Noria
5e0e77fc12 configure a uniform font-family for code in guides 2010-10-24 16:21:20 +02:00
Xavier Noria
8a629ab6c3 use a gray a little darker in code blocks, for better contrast with the gray background 2010-10-24 16:21:20 +02:00
Xavier Noria
739fda3f0a removes the toolbar from guides code blocks 2010-10-24 16:21:20 +02:00
Rob Zolkos
6492a2bd21 added tip about ruby-debug needing a different gem if using 1.9 [#190 state:resolved] 2010-10-24 21:20:41 +11:00
Aaron Patterson
5685a5c41c refactor to remove through_records 2010-10-23 20:29:46 -07:00
Aaron Patterson
6c998a79c8 removing dead code 2010-10-23 20:29:46 -07:00
Aaron Patterson
3e4ede81d6 removing unused variable 2010-10-23 20:29:46 -07:00
Xavier Noria
b0aae28422 Merge branch 'master' of git://github.com/lifo/docrails 2010-10-24 00:40:32 +02:00
Xavier Noria
5f5496c7f3 switches guides code syntax highlighting to the better SyntaxHighlighter, I did my best with the theme, I swear 2010-10-24 00:35:47 +02:00
Aaron Patterson
a3f96f16f4 save a few method calls 2010-10-22 17:31:28 -07:00
Aaron Patterson
cc12047372 removing wtfalse 2010-10-22 13:37:51 -07:00
Aaron Patterson
ee71a3fbfc removing call to deprecated API, this test is outside AR responsibilities 2010-10-22 13:33:59 -07:00
Aaron Patterson
1ce76db918 if it responds to :usec, it should also "act like" a time 2010-10-22 13:31:44 -07:00
Aaron Patterson
40491b4654 removing space errors 2010-10-22 10:35:08 -07:00
Greg Jastrab
5b502ed9cc fixed example code for i18n exception handling 2010-10-22 13:30:00 -04:00
Xavier Noria
8326161b19 copy-edits some CI traces 2010-10-22 17:34:22 +02:00
Xavier Noria
a031fc57c8 made a pass in AR's schema.rb to keep (most) create statements in lexicographic order, and fixed an FK 2010-10-22 16:55:02 +02:00
Xavier Noria
5b86c3e5bb has_one maintains the association with separate after_create/after_update
This way parent models can get their own after_create and
after_update callbacks fired after has_one has done its job.
2010-10-22 10:28:53 +02:00
Jared Crapo
1ef9ddde90 Fixed typo in code for Session Expiry 2010-10-21 11:56:36 -07:00
José Valim
fc8c072988 Use render :template instead of render :file in nested layouts example. render :template is a bit faster and more semantic compared to render :file. 2010-10-21 09:26:59 -02:00
Umar Sheikh
a04b2131de ActiveSupport::Dependencies' methods load_paths and load_once_paths have
changed names to autoload_paths and autoload_once_paths respectively
2010-10-21 14:41:00 +05:00
Aaron Patterson
410114e85a adding a test to ensure offsets with no limits will work [#5316 state:resolved] 2010-10-20 17:17:22 -07:00
Aaron Patterson
828bb94d5a use grep instead of select + is_a? 2010-10-20 16:41:50 -07:00
Aaron Patterson
4be0fc124a use a map and flatten to avoid << calls on array 2010-10-20 16:20:49 -07:00
Aaron Patterson
784177aeee only call column_methods_hash once, use array math for faster test of existence 2010-10-20 16:17:15 -07:00
Aaron Patterson
7f444a3db6 roll up weird method to meta programmed method 2010-10-20 15:51:44 -07:00
Aaron Patterson
fb835fc1e2 use zip + Hash.[] rather than looping with an index 2010-10-20 15:46:04 -07:00
Aaron Patterson
954bd126ec extract options is not necessary 2010-10-20 15:07:17 -07:00
Aaron Patterson
03d4b86e78 removing unused variable 2010-10-20 14:58:16 -07:00
Aaron Patterson
96e8e97e78 removing unused variables 2010-10-20 09:38:15 -07:00
Jan
21beedf1ff default scope merge where clauses [#5488 state:resolved] 2010-10-20 09:00:36 -07:00
Aaron Patterson
dbc5d2694f reduce duplicate where removal to one loop 2010-10-20 08:41:25 -07:00
Santiago Pastorino
d3d724bb88 Remove this require since active_support/testing/default doesn't exist anymore 2010-10-20 12:50:31 -02:00
Aaron Patterson
8c511c0b3c swap out some n^2 for some n 2010-10-19 20:53:53 -07:00
Aaron Patterson
4726a181c4 bumping mysql2 requirement 2010-10-19 17:53:00 -07:00
Aaron Patterson
8d5829f149 dup rather than create so many arrays 2010-10-19 17:51:46 -07:00
Aaron Patterson
dc16163d06 use array math rather than looping through the array 2010-10-19 17:46:54 -07:00
Aaron Patterson
c56fea2be4 use shortened version to generate a sql literal 2010-10-19 17:44:33 -07:00
Aaron Patterson
08636527b5 avoid cloning if we do not need to clone 2010-10-19 17:44:07 -07:00
Aaron Patterson
78b6f64105 avoid creating a proc object when possible 2010-10-19 17:37:55 -07:00
Aaron Patterson
d2898d4ef8 scopes can take an object that responds to call 2010-10-19 17:29:25 -07:00
Aaron Patterson
56be4c897a avoid creating the proc object if possible 2010-10-19 17:29:25 -07:00
Santiago Pastorino
17d196a18e Change mysql2 to the gem version again since 0.2.5 was released 2010-10-19 21:42:54 -02:00
Aaron Patterson
e68f339aae default scope can accept any object that responds to #call 2010-10-19 15:07:44 -07:00
Tim Morgan
b1b26af9a2 Allow default_scope to accept a Proc. 2010-10-19 14:43:31 -07:00
Xavier Noria
d619b9d1d1 Merge branch 'master' of git://github.com/lifo/docrails 2010-10-19 23:07:29 +02:00
Xavier Noria
95d87823d4 rewords a little the RDoc of the tag helper 2010-10-19 22:59:03 +02:00
Xavier Noria
ba1fb51fa5 api guidelines: adds a reference to the RDoc documentation where directives like :method: are covered 2010-10-19 22:45:51 +02:00
Jon Leighton
8e53e058ac Rename nested_has_many_through_associations_test.rb because it does not only concern has_many associations 2010-10-19 21:41:00 +01:00
Jon Leighton
383d545c88 Add explicit ordering in relations_test.rb, as the lack of this was causing failures against postgres 2010-10-19 19:33:25 +01:00
Jon Leighton
d15de7d97f Add explicit ordering to nested_has_many_through_associations_test.rb as this was causing failures under postgres 2010-10-19 19:25:44 +01:00
Anil Wadghule
d7799fadf9 Fix SQLite adapter name [#5842 state:resolved] 2010-10-19 10:44:59 -07:00
Jon Leighton
fcabfa428e Remove obsolete require to active_record/associations/nested_has_many_through 2010-10-19 18:43:09 +01:00
Jon Leighton
7b84477598 Fix typo 2010-10-19 18:32:02 +01:00
Jon Leighton
cf7c475ef1 Remove obsolete autoload 2010-10-19 18:29:10 +01:00
Jon Leighton
8aa6949083 Add a CHANGELOG entry about nested through associations 2010-10-19 18:21:32 +01:00
Jon Leighton
8345a141d1 Merge branch 'master' into nested_has_many_through 2010-10-19 18:16:52 +01:00
Jon Leighton
2c7183c026 Add some API documentation about nested through associations 2010-10-19 18:16:19 +01:00
Jon Leighton
2aa9388746 Add some comments for ThroughReflection#through_reflection_chain 2010-10-19 17:40:14 +01:00
Jon Leighton
7ee33b80a2 Remove various comments and code which were just being used during the development of nested through association support (OMFGZ, I might just have nearly finished this\! 2010-10-19 17:29:19 +01:00
Jon Leighton
82b889f7d3 Add explicit tests for the nested through association changes in reflection.rb 2010-10-19 17:22:42 +01:00
Aaron Patterson
1856e975c3 "instance_methods" includes public and protected 2010-10-19 08:30:45 -07:00
Jon Leighton
1f7415ab3a Fix broken test 2010-10-19 16:26:35 +01:00
Jon Leighton
b00db54e74 Small refactoring 2010-10-19 16:23:53 +01:00
Jon Leighton
915ea5ea82 Support the :primary_key option on a through reflection in a nested through association 2010-10-19 16:13:06 +01:00
Jon Leighton
0ceb342955 Bugfix/refactoring 2010-10-19 15:24:30 +01:00
Jon Leighton
9ff5fdeda9 Remove unused methods 2010-10-19 14:56:59 +01:00
Jon Leighton
01838636c6 Support for :primary_key option on the source reflection of a through association, where the source is a has_one or has_many 2010-10-19 14:14:06 +01:00
Richard Hart
e43de58ab4 Updating routing namespace examples to use symbols and not strings. 2010-10-19 13:40:47 +01:00
Jon Leighton
596cc3b232 Respect the :primary_key option on the through_reflection of (non-nested) through associations 2010-10-19 12:47:19 +01:00
Xavier Noria
de3603c255 adds the new :data idiom in tag helpers to the CHANGELOG 2010-10-19 10:13:26 +02:00
Stephen Celis & Xavier Noria
cfcef34bb5 Additional documentation for data-* attributes.
Signed-off-by: Xavier Noria <fxn@hashref.com>
2010-10-19 10:12:27 +02:00
Michał Łomnicki
4120e95dce Use ALTER INDEX syntax to rename an index 2010-10-19 08:40:28 +08:00
Jon Leighton
9ec0734874 Properly support conditions on any of the reflections involved in a nested through association 2010-10-19 00:27:40 +01:00
Aaron Patterson
541ed2b60d avoid a few comparisons 2010-10-18 16:11:27 -07:00
Krekoten' Marjan
a75d21df06 Fix status initialization when custom status provided
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-10-18 17:34:22 -02:00
Krekoten' Marjan
608bf7b72c AC::Caching DRYup
Remove ActionController::Caching::Pages#caching_allowed
because it duplicates ActionController::Caching#caching_allowed?

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-10-18 17:30:28 -02:00
Aaron Patterson
19c144f1b3 remove strange else block 2010-10-18 10:31:21 -07:00
Aaron Patterson
ca59ec354e skip extra work if no text or phrase was provided 2010-10-18 10:28:56 -07:00
Aaron Patterson
dda81cb177 lets not invert the hash on every iteration through this loop 2010-10-18 10:21:15 -07:00
Aaron Patterson
132f3e2d37 use -= in place of the expanded form 2010-10-18 10:11:32 -07:00
Aaron Patterson
a0a5a2a275 implicitly return nil if there is no number 2010-10-18 10:01:26 -07:00
Aaron Patterson
98d3c41cfb implicit return of nil 2010-10-18 09:58:18 -07:00
Aaron Patterson
9c219bf361 use regex escape sequences to shorten stuff up 2010-10-18 09:57:24 -07:00
Aaron Patterson
081e15f104 join strings rather than resizing buffer 2010-10-18 09:53:01 -07:00
Santiago Pastorino
330327eeec Call html_escape in ERB::Util module and don't mix it in in the helpers 2010-10-18 13:59:56 -02:00
Xavier Noria
df044ec4ac explains why ERB::Util#h is removed before being re-aliased 2010-10-18 17:24:30 +02:00
Santiago Pastorino
9d6917519c Use mysql2 from git for a while 2010-10-18 13:02:10 -02:00
Santiago Pastorino
901973b4d7 Invoke html_escape on the proper receiver 2010-10-18 12:29:03 -02:00
Santiago Pastorino
460c4efd71 Merge CHANGELOGs from 3-0-stable 2010-10-18 12:24:41 -02:00
Santiago Pastorino
31ac1db596 Tidy up a bit this code 2010-10-18 09:49:04 -02:00
Santiago Pastorino
1a0f72d0e3 Why strip only the extension, this can be done by the user 2010-10-18 09:48:24 -02:00
Santiago Pastorino
dfb3ff6698 This or login doesn't make sense 2010-10-18 09:47:21 -02:00
Santiago Pastorino
dc33cd6208 Use unless instead of if nil? 2010-10-18 09:45:37 -02:00
Santiago Pastorino
5f60735194 Add missing require 2010-10-18 08:39:20 -02:00
Andrew White
f7573175de Reset assert_template instance variables between requests [#5832 state:resolved] 2010-10-18 09:57:51 +01:00
Dallas Taylor
2c3c0bcbab Added :file as a possible value when configuring actionmailer 2010-10-18 18:55:02 +11:00
Krekoten' Marjan
7b2ec381ca Change def to attr_reader + alias
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-10-18 00:54:58 +02:00
Santiago Pastorino
0d5d70f1a3 parse number only if options[:raise] is provided 2010-10-17 20:44:06 -02:00
Santiago Pastorino
ea7db8ebc1 number_to_phone always return safe 2010-10-17 20:42:13 -02:00
Jon Leighton
78b8c51cb3 Refactoring: replace the mix of variables like @finder_sql, @counter_sql, etc with just a single scope hash (created on initialization of the proxy). This is now used consistently across all associations. Therefore, all you have to do to ensure finding/counting etc is done correctly is implement the scope correctly. 2010-10-17 23:29:56 +01:00
Michael Koziarski
2f9e880431 Rejig the html5 data helper code
Avoid allocating an array each pass through and support String subclasses like SafeBuffers
2010-10-18 11:18:43 +13:00
Stephen Celis
5e79094fc1 HTML5 data attribute helpers [#5825 state:resolved]. 2010-10-18 11:18:42 +13:00
Santiago Pastorino
67df21f895 No need for parenthesis here 2010-10-17 12:34:51 -02:00
Neeraj Singh
f527f9097b no need to check for nil
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-10-17 12:26:47 -02:00
Neeraj Singh
ea14396c45 replace if ! with unless
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-10-17 12:26:32 -02:00
Aditya Sanghi
5a36f9f89d Merge branch 'master' of github.com:lifo/docrails 2010-10-17 02:09:47 +05:30
Aditya Sanghi
40398a1f47 The deleted examples are redundant.
They do not reveal anything new that is not already been explained in preceding example.
2010-10-17 02:08:15 +05:30
Neeraj Singh
a38e653a6d json_escape makes json invalid doc change [#1485 state:resolved] 2010-10-16 21:57:19 +02:00
Xavier Noria
964033f351 Revert "added ignore rule for linux temp file ending with a tilda ~"
This reverts commit 410ef3818f.

Reason: docrails has a very strict docs-only policy.
2010-10-16 18:44:24 +02:00
Santiago Pastorino
b44e2abd9f Bump bundler up to 1.0.3 2010-10-16 14:36:25 -02:00
Santiago Pastorino
6c8ea83385 extract formats_regexp as a method 2010-10-16 14:12:41 -02:00
Santiago Pastorino
15d3c77bc2 There's no need now to expose lookup_context as an external API 2010-10-16 13:42:19 -02:00
Santiago Pastorino
0d00d65ad2 Delegate freeze_formats to lookup_context 2010-10-16 13:39:11 -02:00
Jeff Kreeftmeijer
b454bb0a98 Remove the :vew attr_reader from ActionView::AbstractRenderer [#5819 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-10-16 13:02:14 -02:00
Santiago Pastorino
66f805a969 JQuery updated to 1.4.3
Check out http://blog.jquery.com/2010/10/16/jquery-143-released/ for
information on what's new.
2010-10-16 12:30:34 -02:00
Rajinder Yadav
410ef3818f added ignore rule for linux temp file ending with a tilda ~ 2010-10-15 22:23:11 -04:00
Rajinder Yadav
62eb00a62e Merge branch 'master' of git://github.com/lifo/docrails 2010-10-15 22:19:39 -04:00
Rob Zolkos & Xavier Noria
bc1bcddede implements weeks_ago and prev_week for Date/DateTime/Time [#5122 state:committed] 2010-10-16 02:23:23 +02:00
Santiago Pastorino
4bfe30ca2f delete from :number until the end 2010-10-15 21:09:32 -02:00
Aaron Patterson
dc76e3c38f should sort these ids before asserting they are equal! 2010-10-15 15:47:09 -07:00
Aaron Patterson
552636c652 testing that symbols work as sql literals 2010-10-15 15:46:13 -07:00
Aaron Patterson
1dd266741e fixing an error in the rdoc 2010-10-15 10:43:53 -07:00
Aaron Patterson
eaa7605e2f Revert "refactor delete a little"
This reverts commit f3f34bce8f.
2010-10-15 10:23:05 -07:00
Jon Leighton
edc176d33b Make sure nested through associations are read only 2010-10-15 17:46:09 +01:00
Jon Leighton
d619e39938 Fix small bug which was shown by the last commit 2010-10-15 16:27:13 +01:00
Jon Leighton
1e2525bfe0 Add assertions for nested through associations loaded by includes with conditions (uses the single-query strategy). Currently one failure to fix. 2010-10-15 16:21:42 +01:00
Piotr Sarnacki
b0157f8d04 Removed duplicated method find_root_with_flag
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-10-15 13:17:36 -02:00
Jon Leighton
06c64eb606 Support preloading nested through associations (using the default multi-query strategy) 2010-10-15 15:46:19 +01:00
Xavier Noria
21ff8849bb in regexps, the dot in a character class is not a metacharacter 2010-10-15 16:31:00 +02:00
Rob Zolkos
cffae06a4f remove Mongrel from debugger docs 2010-10-15 23:38:31 +11:00
Rob Zolkos
ebe61bf37c WEBrick is the default web server, not Mongrel [#186 state:resolved] 2010-10-15 21:40:32 +11:00
André Camargo
c42ea2172e Fix for ActionView::Template#refresh in rails 3.1.0.beta
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-10-15 08:39:10 +02:00
Carl Lerche
69789c3b29 #transaction on the instance level should take options as well 2010-10-14 21:27:40 -07:00
Neil Middleton
8be96a3bcf Fixed casing of JavaScript (and RJS) [#183 state:resolved] 2010-10-14 23:12:25 +01:00
Michael Koziarski
9ebe582830 Revert 0c0b0aa0f2 which introduced a security vulnerability.
This addresses  CVE-2010-3933

Conflicts:

	activerecord/lib/active_record/nested_attributes.rb
2010-10-15 10:27:33 +13:00
Nick Quaranto
a18cefbc3a Fixing a small typo in the generators guide 2010-10-14 17:24:59 -04:00
Xavier Noria
13f7f89bda Merge branch 'master' of git://github.com/lifo/docrails 2010-10-14 23:15:23 +02:00
Peter Baker
5a898e106a Explain actionamailer authentication types 2010-10-14 11:24:25 -05:00
Jon Leighton
11508db1be Remove unnecessary requires from nested_has_many_through_associations_test.rb 2010-10-14 13:52:38 +01:00
Jon Leighton
002985fb66 Add test_has_one_through_has_one_through_with_belongs_to_source_reflection 2010-10-14 13:44:32 +01:00
Jon Leighton
25acd19da5 Add test_has_many_through_belongs_to_with_has_many_through_source_reflection (which already passes) 2010-10-14 13:16:47 +01:00
Jon Leighton
7963c30eba Add test_has_many_through_has_many_through_with_belongs_to_source_reflection (which already works) 2010-10-14 13:07:28 +01:00
Jon Leighton
bc821a5611 Added test_has_many_through_has_many_with_has_many_through_habtm_source_reflection and make it pass 2010-10-14 12:59:16 +01:00
Jon Leighton
22782e2cc1 Fix bug in previous refactoring 2010-10-14 12:31:35 +01:00
Jon Leighton
3fb493c2b0 Merge branch 'master' into nested_has_many_through
Conflicts:
	activerecord/lib/active_record/associations.rb
	activerecord/test/cases/associations/cascaded_eager_loading_test.rb
2010-10-14 10:25:43 +01:00
José Valim
01ab6f961b Remove :cache => true on lookup templates initialization. 2010-10-14 09:47:49 +02:00
José Valim
aa508c9baf SReorganize autoloads slightly and move two files to lib/action_view root. 2010-10-14 09:32:53 +02:00
José Valim
37d78028b2 render :once should consider the current controller prefix. 2010-10-14 09:27:18 +02:00
José Valim
c7aea81a39 Comment internal railties tasks. 2010-10-14 08:37:03 +02:00
Piotr Sarnacki
11558a11fe Use railtie_name to correctly get name from plugins 2010-10-14 07:46:12 +02:00
Piotr Sarnacki
72545da091 Remove task for creating symlinks for railties 2010-10-14 07:46:12 +02:00
Piotr Sarnacki
a2c52f1004 Update documentation for new tasks 2010-10-14 07:46:12 +02:00
Piotr Sarnacki
43215de208 Add task foo:install (where foo is plugin) as a shortcutinstall:migrations and foo:install:assets 2010-10-14 07:46:12 +02:00
Piotr Sarnacki
959f8576f2 Added foo:install:assets task that copies assets from plugins public directory to application's public directory
This is the most simple and naive approach: just copy every files from engine to app.
The only exception is when file has changed, in that case developer will be
asked if he wants to rename the field.

There is no need to make this task more sophisticated as 3.1 will be shipped
with better assets handling and it will be the default way to handle things.
2010-10-14 07:46:12 +02:00
Piotr Sarnacki
f07cbec865 Do not treat information about skipped migrations as WARNINGs but as a NOTEs, also puts to stdin 2010-10-14 07:46:12 +02:00
Aaron Patterson
ab1a661533 Revert "speeding up flattened version of OrderedHash.[]"
This reverts commit 9c53e82d66.
2010-10-13 21:06:07 -07:00
Aaron Patterson
9c53e82d66 speeding up flattened version of OrderedHash.[] 2010-10-13 21:04:42 -07:00
Aaron Patterson
f3f34bce8f refactor delete a little 2010-10-13 20:51:51 -07:00
Aaron Patterson
86b02e7bb1 use unless instead of if ! 2010-10-13 20:44:26 -07:00
Aaron Patterson
676a00163d clear any stale connections before messing with threaded tests 2010-10-13 16:58:03 -07:00
Ryan Bigg and Xavier Noria
cfb1ba023b Use <em> rather than underscores to fix display issue with 4.1.1.1 in the asssociation basics guide 2010-10-14 08:12:25 +11:00
Ugis Ozols
a37e1a6a69 Removed miscelenous letters. 2010-10-13 23:31:37 +03:00
Carl Lerche
91ba75806f Update the ActiveRecord tests to not set unused options
This makes a test fail, but it is revealing a bug in Arel master.
2010-10-13 12:32:52 -07:00
Rafael Mendonça França
aec5ef243a Remove doc for debugging callbacks. Methods don't exist in Rails master 2010-10-13 15:59:57 -03:00
Carl Lerche
0b6af35ef0 Update the PostgreSQL adapter documentation 2010-10-13 11:49:32 -07:00
Carl Lerche
941844cbe5 rb_thread_select should always be used in DB drivers when available. 2010-10-13 11:40:47 -07:00
Jon Leighton
212fdd8ba9 Add test_has_many_through_has_and_belongs_to_many_with_has_many_source_reflection and make it work 2010-10-13 18:36:51 +01:00
Jon Leighton
5d8bb06090 Refactoring ThroughAssociationScope#construct_through_joins 2010-10-13 17:55:41 +01:00
Jon Leighton
1ddbb216ea Delete unused methods in JoinAssociation 2010-10-13 08:24:19 -07:00
Jon Leighton
19304a9758 Renaming and formatting changes in JoinDependency 2010-10-13 08:24:19 -07:00
Jon Leighton
7dcb633427 Refactor JoinDependency and friends so that a JoinAssociation can produce an arbitrary number of joins, which will be needed in order to support nested through associations. 2010-10-13 08:24:19 -07:00
Jon Leighton
076b75bf98 Add some tests for functionality in JoinAssociation which already exists but was previously untested 2010-10-13 08:24:19 -07:00
Jon Leighton
781ad0f8fe First bit of support for habtm in through assocs - test_has_many_through_has_many_with_has_and_belongs_to_many_source_reflection now passes 2010-10-13 01:29:09 +01:00
Jon Leighton
199db8c8c0 Hook ThroughAssociationScope up to use the AliasTracker class 2010-10-13 00:05:04 +01:00
Jon Leighton
3f2e25805d Some small tweaks on the last commit 2010-10-12 23:42:30 +01:00
Aaron Patterson
603406dc53 stop using deprecated arel API 2010-10-12 14:33:16 -07:00
Xavier Noria
879cac5d76 getting started guide: deletes orphan <% end %>, reported by Michael L. Miller 2010-10-12 23:06:55 +02:00
Xavier Noria
2561c6ae64 fixes spelling of jQuery and Prototype 2010-10-12 22:57:13 +02:00
Krekoten' Marjan
6f4d00c5a5 Merge branch 'master' of github.com:lifo/docrails 2010-10-12 23:44:45 +03:00
Aaron Patterson
25a2909355 dry up column type testing 2010-10-12 13:13:19 -07:00
Aaron Patterson
4b2e16ed24 all columns respond to string_to_binary, so no need to check respond_to? 2010-10-12 13:10:52 -07:00
Aditya Sanghi
a0b53b25b6 fix time.to_formatted_time(:time) example 2010-10-13 01:39:22 +05:30
Krekoten' Marjan
0744d36f47 Fix small typo in documentation 2010-10-12 22:55:19 +03:00
Aaron Patterson
5b5ae01f29 drying up true and false cases 2010-10-12 11:59:20 -07:00
Aaron Patterson
01893f43f6 reducing comparisons in when statements 2010-10-12 11:55:52 -07:00
Jon Leighton
e8874318b7 Extract aliasing code from JoinDependency and JoinAssociation into a separate AliasTracker class. This can then be used by ThroughAssociationScope as well. 2010-10-12 19:49:32 +01:00
Aaron Patterson
9852a72417 removing intermediate variables 2010-10-12 11:48:41 -07:00
Aaron Patterson
c882154cd1 reduce the number of times we test for the column variable 2010-10-12 11:45:59 -07:00
Aaron Patterson
0ca9c836c0 test quoting a string with an unknown column type 2010-10-12 11:43:50 -07:00
Aaron Patterson
31b132aa9b refactoring date / time / datetime when statement 2010-10-12 11:41:23 -07:00
Aaron Patterson
ef11ce2af8 fixing case / when indentation 2010-10-12 11:38:40 -07:00
Aaron Patterson
98cb754cd7 test quoting multibyte chars object 2010-10-12 11:38:07 -07:00
Aaron Patterson
2681dd81b4 test quoting strings with binary columns 2010-10-12 11:34:21 -07:00
Aaron Patterson
4804cb485c test quoting a string with a float column 2010-10-12 11:30:34 -07:00
Aaron Patterson
50ad7f6561 testing quoting a string for an int column 2010-10-12 11:29:28 -07:00
Aaron Patterson
07b0b5b330 testing crazy object quoting 2010-10-12 11:25:20 -07:00
Aaron Patterson
1ba3489b75 test that dates / times / datetimes call quoted_date 2010-10-12 11:21:35 -07:00
Aaron Patterson
8b33f66891 test quoting of bigdecimals 2010-10-12 11:08:10 -07:00
Jon Leighton
c37a5e7acd Add a commented, failing test for using a habtm in a has many through association. I want to refactor how aliasing works first. 2010-10-12 18:16:31 +01:00
Jon Leighton
56064aa4b0 Add test_has_many_through_has_one_through_with_has_many_source_reflection 2010-10-12 17:32:52 +01:00
Jon Leighton
dc39aceb94 Adding test_has_many_through_has_one_with_has_many_through_source_reflection and modifying ThroughAssociationScope to make it work correctly. 2010-10-12 17:27:10 +01:00
Jon Leighton
6107386185 Rename some tests for consistency 2010-10-12 16:54:43 +01:00
Jon Leighton
6a016a5511 Add test_has_many_through_has_one_through 2010-10-12 16:53:22 +01:00
Jon Leighton
1777600e6e Support has_one through assocs as the source association 2010-10-12 16:40:24 +01:00
Jon Leighton
7aea695815 A load of tests that need to be written 2010-10-12 13:33:51 +01:00
Aaron Patterson
ba0a6772bb testing floats, fixnum, and bignums 2010-10-11 17:57:47 -07:00
Aaron Patterson
8e8a5f33f4 test quoting nils, true, false, id 2010-10-11 17:52:10 -07:00
Aaron Patterson
2610bcbd94 getting quoted_time under more specific tests 2010-10-11 17:52:10 -07:00
Aaron Patterson
b9d4341bd0 starting to get the quote module under test 2010-10-11 17:52:10 -07:00
Les Hill and Sandro Turriate
dde54f00c6 Show exceptions rescues the original exception
[#5784 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-10-12 00:56:07 +02:00
Szymon Nowak
0d33332571 Return a valid empty JSON on successful PUT and DELETE requests. [#5199 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-10-12 00:56:07 +02:00
Aditya Sanghi
582a088ba7 Fix test helpers to ensure get method forms are properly tested [#5753 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-10-12 00:56:07 +02:00
Miles Egan
3eff729079 make sure request parameters are accessible after rack throws an exception parsing the query string [#3030 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-10-12 00:56:07 +02:00
Santiago Pastorino
933f745dcb Railties changelog updated with -j parameter 2010-10-11 20:31:14 -02:00
siong1987
708e09448b -j parameter added to rails new command.
Now you can start your apps with jquery with rails new myapp -j jquery, the default is still prototype

[#5613 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-10-11 19:47:53 -02:00
Aaron Patterson
cecccf1156 we should always cast the value based on the column 2010-10-11 13:35:58 -07:00
Aaron Patterson
bef5b826e3 removing freeze 2010-10-11 13:02:36 -07:00
Aaron Patterson
ee7863eaac removing some load path tomfoolery 2010-10-11 11:30:22 -07:00
Aaron Patterson
333e033064 fixing railties tests 2010-10-11 11:24:00 -07:00
Santiago Pastorino
0c824e3cd7 Refactor a bit this code to add data-confirm and data-disable-with 2010-10-11 15:55:45 -02:00
Marcelo Giorgi
1c9022de21 Honor distinct option when used with count operation after group clause [#5721 state:resolved] 2010-10-11 09:39:34 -07:00
Paco Guzman
31358d8c3c data-disable-with in button_to helper
[#4993 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-10-11 13:24:07 -02:00
Santiago Pastorino
e0b76d6151 reorder removed in favor of except(:order).order 2010-10-11 11:54:46 -02:00
Xavier Noria
21a92b8d01 Merge branch 'master' of git://github.com/lifo/docrails 2010-10-11 12:06:21 +02:00
Xavier Noria
e6b45b8111 Revert "Add missing CHANGELOG entry about reset_javascript_include_default"
This reverts commit 234a4ca7dd.

Reason: No big deal Ryan, only there's a very strict policy in
docrails which allows public write access on the other hand.
CHANGELOGs can only be edited in master. If this is added I'll
make sure you get the credit for the patch.
2010-10-11 12:00:37 +02:00
José Valim
a8b1780410 Updated DOCS for engines and added a couple TODOs. Also, commented internal railties rake tasks description. 2010-10-11 10:29:31 +02:00
Philip R. Dutton
70ad6e499f I corrected a code snippet typo in the railties/guides/source/initialization.textile file [#5779 state:resolved] 2010-10-11 13:55:58 +11:00
Ryan Bigg
234a4ca7dd Add missing CHANGELOG entry about reset_javascript_include_default 2010-10-11 13:32:40 +11:00
Ryan Bigg
ef74ad8e0c Remove mention to register_javascript_include_default in documentation 2010-10-11 13:28:50 +11:00
Utkarsh Kukreti
7d08116222 Fix typo 'configation' [#5575 state:resolved] 2010-10-11 12:12:36 +11:00
Nathan Zook and Ryan Bigg
9074e8c644 Updated RUNNING_UNIT_TESTS documentation with mention of the build_databases rake tasks. 2010-10-11 11:15:38 +11:00
Santiago Pastorino
cb26eee54d Revert "Make InstanceTagMethods#value_before_type_cast raise if the model don't respond to attr_before_type_cast or attr method"
And    "Makes form_helper use overriden model accessors"

This reverts commit 3ba8e31005 and fb0bd8c109.
2010-10-10 21:13:12 -02:00
wycats
cc8e386d08 Always pull in version for frameworks (standardize autoload / require / none) 2010-10-10 16:12:04 -07:00
Barry Sears
de05e1c33c Make ActiveSupport load own version.
[#5739 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-10-10 19:46:49 -02:00
José Valim
5ec27189b8 Do not allow templates coming from Fallback resolvers to store a virtual path. 2010-10-10 23:12:23 +02:00
José Valim
682368d4ba Use identifiers for template equality. 2010-10-10 23:12:22 +02:00
Wincent Colaiuta
f659a1576f Fix misleading advice to add 'memcache' to Gemfile
[#5539 state:committed]

Commit 57144388f removed the hard-coded dependency on the memcache-client
gem, and added this warning advising people to install it if needed. The
problem is, however, that if people follow the advice literally and install
the 'memcache' gem, they will wind up with a completely different thing,
which is not API compatible with the memcache-client gem and which Rails
can't work with.

So, be explicit and tell users to install the 'memcache-client' gem.

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-10-10 14:30:22 -02:00
Andrea Campi
d80afed620 Override #store to be consistent with #[].
[#5775 state:resolved]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-10-10 14:06:44 -02:00
José Valim
621df2a1ec Merge remote branch 'drogus/engines' 2010-10-10 14:57:19 +02:00
José Valim
49b6f33f99 Clean up unused methods from AV::Base and pass in the template object on rendering. 2010-10-10 14:47:11 +02:00
José Valim
11aa515735 Add expire! and rerender to the template API. This will be used by SASS template handler. 2010-10-10 13:43:32 +02:00
José Valim
ffa32714bd Add some unit tests to Template#refresh. 2010-10-10 13:17:04 +02:00
José Valim
cba395dab9 Update CHANGELOG. 2010-10-10 12:43:26 +02:00
José Valim
940b57789f Add support to render :once.
This will be used internally by sprockets to ensure requires are executed just once.
2010-10-10 12:43:26 +02:00
José Valim
b88f4ca93b Clean up the house before moving in the new furniture.
This commit moves all the template rendering logic that was hanging around AV::Base to renderer objects.
2010-10-10 12:43:26 +02:00
David Calavera
ab2f2b22a6 prevent rake test to run the test suite three times when ENV['TEST'] is set [#3572 state:resolved]
Signed-off-by: Xavier Noria <fxn@hashref.com>
2010-10-10 12:22:40 +02:00
wycats
b3cadf338b Rendering doesn't need RackDelegation 2010-10-10 00:54:11 -07:00
wycats
8cb2cfbf71 Fix a few bugs when trying to use Head standalone 2010-10-10 00:54:11 -07:00
José Valim
38d78f99d5 Resolvers now consider timestamps.
Before this patch, every request in development caused the template
to be compiled, regardless if it was updated in the filesystem or not.
This patch now checks the timestamp and only compiles it again if
any change was done.

While this probably won't show any difference for current setups,
but it will be useful for asset template handlers (like SASS), as
compiling their templates is slower than ERb, Haml, etc.
2010-10-10 09:26:53 +02:00
Jon Leighton
3aba73fed1 Refactoring to remove duplication introduced by the last commit 2010-10-10 00:53:04 +01:00
José Valim
c7408a0e40 Deprecate old template handler API. Remove old handlers. 2010-10-10 01:14:50 +02:00
José Valim
64c7f7e392 Add more docs and tests to templates. 2010-10-09 23:56:08 +02:00
Jon Leighton
ab5a933502 Add support for nested through associations in JoinAssociation. Hence Foo.joins(:bar) will work for through associations. There is some duplicated code now, which will be refactored. 2010-10-09 22:00:33 +01:00
Piotr Sarnacki
a9bf91ea56 Add 'foo:install:migrations' task to copy migrations from foo engine 2010-10-09 22:31:26 +02:00
Piotr Sarnacki
b417cfbf01 Load rake tasks defined in superclasses in context of railties 2010-10-09 21:32:34 +02:00
Piotr Sarnacki
8636f64def Rename rake railties:copy_migrations to rake railties:install:migrations and fix it to work with new copying strategy 2010-10-09 21:32:34 +02:00
Piotr Sarnacki
022205be1d Add callback on skipped migration while copying migrations 2010-10-09 21:32:34 +02:00
Piotr Sarnacki
4377f8eba2 Change the method for copying migrations, do not add scope.
The purpose of this change is to allow copying fail on the same names.
Migrations change database and they should be treated with caution,
if 2 migrations are named the same it's much better to skip migration
and allow user decide if it should be copied or not.
2010-10-09 21:32:34 +02:00
Piotr Sarnacki
5d5eb2b18d Rename namespace method to isolate_namespace.
This change caused by confusion caused by calling engine
"namespaced". Stuff inside engine can be namespaced for every
engine. This method is not actually namespacing anything, it's
isolating engine within the given namespace.
2010-10-09 21:32:34 +02:00
Santiago Pastorino
afd76d7fe9 Fix error in routing guide edit_photo_path needs the id as param 2010-10-09 14:50:25 -02:00
Santiago Pastorino
6286629aca This test is not only testing config/database stuff anymore 2010-10-09 13:36:54 -02:00
Aditya Sanghi
36862511e0 test that skip active records does not load fixtures
[#4104 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-10-09 13:31:37 -02:00
Santiago Pastorino
e7f911d5ca Test if test/performance/browsing_test.rb exists when --skip-activerecord is used
[#4104]
2010-10-09 13:11:26 -02:00
Andrea Campi
e695c40e11 Fix example that became outdated after a code change.
[#5770 state:resolved]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-10-09 12:57:57 -02:00
Juan Maiz
b439c14516 Fixing two minor errors in Rails::Generators::Actions initializer method comments
[#5771 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-10-08 19:19:17 -02:00
Andrew White
067c1aa0e0 Refactor resource action scope methods 2010-10-08 22:00:27 +01:00
James Mead
f415b3e6d1 Remove old workaround for mocha bug. [#3886 state:committed]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-10-08 15:21:08 -02:00
Santiago Pastorino
e9793c60b6 Makes this code a bit more clear 2010-10-08 15:15:12 -02:00
Ryan Bigg
5826c17307 Remove the final initializers since initializers += will return it anyway. [#3892 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-10-08 15:15:08 -02:00
Piotr Sarnacki
e68c87bb65 Fix engines test
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-10-08 18:23:32 +02:00
Piotr Sarnacki
08f4713dba Refactored routes reloading to use RouteSet#append instead keeping block in Engine
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-10-08 18:23:25 +02:00
José Valim
f1f2fb8ae7 Cleanup logger a bit. 2010-10-08 16:14:39 +02:00
José Valim
a0e482e807 Ensure rack body responds to each. 2010-10-08 09:29:07 +02:00
José Valim
54b09e17d4 Fix 1.9.2 failures. 2010-10-08 09:24:06 +02:00
Vesa Vänskä
c3c6f58ffb Fixed rake task description typo 2010-10-08 15:14:10 +08:00
Aaron Patterson
740d7e5aa2 removing false comment 2010-10-07 16:40:15 -06:00
Michael Koziarski
581b2b6836 fix rendering a partial with an array as its :object [#5746 state:resolved]
Signed-off-by: Michael Koziarski <michael@koziarski.com>

Conflicts:

	actionpack/lib/action_view/render/partials.rb
2010-10-08 11:12:11 +13:00
José Valim
c7760809bf Allow cache to be temporarily disabled through lookup_context. 2010-10-07 21:31:31 +02:00
José Valim
c563f10f3e render :template => 'foo/bar.json' now works as it should. 2010-10-07 21:31:31 +02:00
José Valim
8f9e9118e4 Make collection rendering faster. 2010-10-07 21:31:31 +02:00
José Valim
b2600bfc18 Remove locals dependency from template.
This means that templates does not need to store its source anymore, allowing us to reduce the ammount of memory taken by our Rails processes. Naively speaking, if your app/views contains 2MB of files, each of your processes (after being hit by a bunch of requests) will take 2MB less of memory after this commit.

This is extremely important for the upcoming features. Since Rails will also render CSS and JS files, their source won't be stored as well allowing us to decrease the ammount of memory taken.
2010-10-07 21:31:31 +02:00
Santiago Pastorino
ad13eb7295 Add a TODO to remove gem "jruby-openssl" when jruby-openssl is merge in jruby
[#5762]
2010-10-07 13:50:20 -02:00
Gaston Ramos
cec6f3fe20 - update documentation
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-10-07 16:50:47 +02:00
Gaston Ramos
aee043de5a - ActiveResource::HttpMock.respond_to
do not replace the response with the same path but different method
- Fix typo

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-10-07 16:50:41 +02:00
Gaston Ramos
b9f8501f82 - Fix ActiveResource::HttpMock.respond_to replace the response
if it has the same request

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-10-07 16:50:34 +02:00
José Valim
243513f4d1 Get rid of ruby warnings in Resolvers. Move a few methods up to the abstract class. 2010-10-07 16:46:12 +02:00
Anil Wadghule
ea30da3069 Add jruby-openssl gem in Gemfile necessary for JRuby
[#5762 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-10-07 11:48:40 -02:00
Ryan Bigg
1e63a05d28 Add "a" to make it better English
[#3796 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-10-07 11:40:57 -02:00
Xavier Noria
db520042b3 Merge branch 'master' of git://github.com/lifo/docrails 2010-10-06 23:16:13 +02:00
Thomas McDonald
3ca6988b78 Fixed typo in engine documentation 2010-10-06 22:11:03 +01:00
Hemant Kumar
2a04110f26 fix ruby 1.9 deadlock problem, fixes #5736 add connection pool tests 2010-10-06 14:45:56 -06:00
Rafael Mendonça França
a0552d653b Fixes typo 2010-10-06 12:55:16 -03:00
José Valim
d649bf158b Provide a cleaner syntax for paths configuration that does not rely on method_missing. 2010-10-06 17:20:15 +02:00
Jon Leighton
c954d54e2f Merge branch 'master' into nested_has_many_through 2010-10-06 12:11:38 +01:00
Jon Leighton
f2b41914d6 Refactoring JoinDependency and friends. This improves the code (IMO) including adding some explanatory comments, but more importantly structures it in such a way as to allow a JoinAssociation to produce an arbitrary number of actual joins, which will be necessary for nested has many through support. Also added 3 tests covering functionality which existed but was not previously covered. 2010-10-06 12:06:51 +01:00
wycats
d40ca9cce2 Some initial docs 2010-10-06 03:06:12 -07:00
wycats
0904e82568 Delegate everything to the generator 2010-10-06 02:58:49 -07:00
wycats
848eb0d777 Revert "Clean up the builder abstraction in AppGenerator."
The phrase "clean up" misrepresents the fact that this removes
a feature that ships with Rails 3.0.

This reverts commit 6774e12afa.
2010-10-06 02:53:00 -07:00
José Valim
6774e12afa Clean up the builder abstraction in AppGenerator.
This commit may be reverted once documentation and a proper way to handle actions are added.
2010-10-06 11:13:57 +02:00
Aditya Sanghi
ae812e9fc9 adding test for namedspaced mailers 2010-10-06 19:45:13 +11:00
Aditya Sanghi
990719bb59 mailer comment should use namespace in comment 2010-10-06 19:45:13 +11:00
Erik Michaels-Ober
19a5f99685 Fix copy/paste bug
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-10-06 09:21:01 +02:00
Xavier Noria
3b7d48cc45 a couple of touches to the guides guidelines 2010-10-05 22:52:43 +02:00
Jon Leighton
3cc3563387 A failing test for a nested has many through association loaded via Foo.joins(:bar) 2010-10-05 20:20:27 +01:00
Xavier Noria
da34ee423f aaaaannnddd, your beloved typo only spotted in the github colored diff no matter how many passes you did before pushing 2010-10-05 19:38:05 +02:00
Xavier Noria
360a878070 new guide: Ruby on Rails Guides Guidelines 2010-10-05 19:34:27 +02:00
José Valim
68d75c3365 Don't expect an AD::Response object back from the app. 2010-10-05 09:55:51 +02:00
José Valim
4a4ff148ff Use RbConfig instead of Config for 1.9.3 compatibility. 2010-10-05 09:48:32 +02:00
Aaron Patterson
e3acdcfbf3 refactoring to use fewer intermediate variables 2010-10-04 20:05:56 -07:00
Aaron Patterson
839e2f9664 cleaning up more crazy! 2010-10-04 20:00:55 -07:00
Aaron Patterson
714fea4540 deleting more crazy 2010-10-04 19:52:17 -07:00
Aaron Patterson
333a5659e8 dry up some crazy codes 2010-10-04 19:46:38 -07:00
Aaron Patterson
5769636663 fixing a few test warnings 2010-10-04 19:32:49 -07:00
Aaron Patterson
1217339616 only forwarding enough methods to work. People should grab the delegate tempfile if they really need to do hard work 2010-10-04 19:28:40 -07:00
Aaron Patterson
3370ad0b1e making sure respond_to? works properly 2010-10-04 17:11:50 -07:00
Aaron Patterson
8a97470210 raising an argument error if tempfile is not provided 2010-10-04 17:08:25 -07:00
Aaron Patterson
876acf001a if it walks like a duck and talks like a duck, it must be a duck 2010-10-04 16:57:11 -07:00
Aaron Patterson
2a3022db7f delegate to the @tempfile instance variable 2010-10-04 16:56:45 -07:00
Aaron Patterson
f9734f2b0f adding tests for uploaded file 2010-10-04 16:30:16 -07:00
Aaron Patterson
28bb1885f5 avoid method call to compact 2010-10-04 16:08:01 -07:00
Aaron Patterson
e7d860c6be create fewer objects, call fewer methods in extract_pg_identifier_from_name 2010-10-04 15:25:20 -07:00
Aaron Patterson
d8135eb452 * + flatten is not required in >= Ruby 1.8.7 2010-10-04 15:19:27 -07:00
José Valim
232e56ce87 No need to pass self as parameter here. 2010-10-04 22:32:29 +02:00
Ernie Miller
21cb1d40b9 Test to_model being called in ActiveModel::Naming helpers
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-10-04 21:26:42 +02:00
Ernie Miller
33aaa15f62 Convert to model before calling model_name on a record in ActiveModel::Naming
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-10-04 21:26:41 +02:00
John Firebaugh
b1047888fb render :text => proc { ... } is no longer supported. 2010-10-04 11:14:42 -07:00
John Firebaugh
6644675831 Template::Error is also used if rendering fails. 2010-10-04 11:12:57 -07:00
Aaron Patterson
b7c49cedba calling correct method on minitest for test name when teardown callback fails 2010-10-04 09:34:34 -07:00
Aaron Patterson
ccf228b027 [#5406 state:resolved] calling the correct method on minitest to obtain the test name 2010-10-04 09:33:35 -07:00
José Valim
848e48ec9c Link to rack from github for this while. 2010-10-04 18:08:03 +02:00
José Valim
0b51f3cc73 Ensure the proper content type is returned for static files. 2010-10-04 18:06:04 +02:00
José Valim
10d014acb8 Update to Thor 0.14.3. 2010-10-04 13:46:37 +02:00
José Valim
3986fcb935 Initialize sid should just skip instance variables. 2010-10-04 08:47:36 +02:00
Rajinder Yadav
018bf0f575 added more items to the set to improve explanation of validates_exclusion_of 2010-10-04 00:02:09 -04:00
Rajinder Yadav
0da0aa4cd9 corrected wording for better reading, fixed ugly intented quote by using code tags 2010-10-03 20:41:56 -04:00
Aaron Patterson
69a2c6b041 converting inject([]) to map 2010-10-03 16:42:08 -07:00
Aaron Patterson
365c93b7cd speed up duplicate migration detection 2010-10-03 16:39:48 -07:00
Aaron Patterson
40761c4bf3 reduce the number of calls to camelize 2010-10-03 16:36:43 -07:00
Aaron Patterson
e6583901e5 convertion MigrationProxy to a Struct, initialize instance variables 2010-10-03 16:32:27 -07:00
Aaron Patterson
341e71a1b9 dry up some migration logic 2010-10-03 16:23:07 -07:00
Aaron Patterson
8beda11fd3 no need to differentiate between nil and false in this case 2010-10-03 16:13:45 -07:00
Nicholas E. May (on Enterprise)
66559107e1 Merge branch 'master' of github.com:lifo/docrails 2010-10-03 18:06:22 -05:00
Marcelo Giorgi
860d7c566b Correct documentation that references how *_filter of action_pack are translated into set_callback/run_callback's (from active_support) invocations. 2010-10-03 20:54:08 -02:00
Aaron Patterson
a6c42c8267 two argument String#slice is faster than single argument, also avoid creating a Range object 2010-10-03 15:38:17 -07:00
Aaron Patterson
5154a464cc lengths will be nil or an array 2010-10-03 15:35:56 -07:00
Aaron Patterson
7836616a64 remove a few function calls 2010-10-03 15:18:32 -07:00
Aaron Patterson
bd78d24bd8 be kind to the garbage collector and reuse our visitor object 2010-10-03 14:40:06 -07:00
Aaron Patterson
83633b807a avoid creating objects when we can 2010-10-03 14:40:06 -07:00
Aaron Patterson
18a7b767e8 moving fake model to the correct file 2010-10-03 14:40:06 -07:00
Piotr Sarnacki
adfd43a4da Add documentation on app_generators 2010-10-03 23:32:03 +02:00
José Valim
5f292c9441 Merge branch 'racksession' 2010-10-03 21:48:32 +02:00
José Valim
653acac069 Solve some warnings and a failing test. 2010-10-03 21:45:30 +02:00
José Valim
74dd8a3681 Move ETag and ConditionalGet logic from AD::Response to the middleware stack. 2010-10-03 21:25:22 +02:00
José Valim
50215f9525 Rely on Rack::Session stores API for more compatibility across the Ruby world. 2010-10-03 21:24:22 +02:00
Santiago Pastorino
5836af8f8b PERF: more Hash + map changes 2010-10-03 16:33:46 -02:00
Santiago Pastorino
42fad8c82b PERF: more changes from inject({}) to Hash + map 2010-10-03 15:03:59 -02:00
Santiago Pastorino
4920312643 PERF: Don't create unnecessary objects 2010-10-03 14:58:23 -02:00
Santiago Pastorino
10249d7b77 PERF: change inject({}) with Hash + map 2010-10-03 14:52:46 -02:00
Santiago Pastorino
c28bebef13 PERF: Hash[] + map is faster than this silly inject, and var[1..-1] is faster than var.sub('@', '') 2010-10-03 13:34:34 -02:00
David Chelimsky
f656796d05 Rename _assigns to view_assigns in AV::TC
- also add tests
- also deprecate _assigns

[#5751 state:resolved]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-10-03 13:30:31 -02:00
Jon Leighton
43711083dd Fix the tests (I have actually verified that these are also the 'right' fixes, rather than just making the tests pass again) 2010-10-03 11:56:32 +01:00
Nicholas E. May (on Enterprise)
467d20c897 Section 6, table, typo (extra '.rb') 2010-10-03 00:37:15 -05:00
Nicholas E. May (on Enterprise)
bcc103367b Section 4.3, wrong word used: 'contact' => 'content' 2010-10-02 23:05:08 -05:00
Nicholas E. May (on Enterprise)
ab7b99f150 Section 3.3: '# bundle install' instead of just 'bundle install' 2010-10-02 22:43:45 -05:00
Nicholas E. May (on Enterprise)
ffe24354cc Section 3.2, table: 'README.rdoc' -> 'README' 2010-10-02 22:26:26 -05:00
Nicholas E. May (on Enterprise)
a72edab3b3 Removed unnecessary 'the' in the '2.2.9 Active Suport' section of Getting Started. 2010-10-02 21:57:01 -05:00
Jon Leighton
a34391c3b4 Add support for table aliasing, with a test that needs aliasing in order to work correctly. This test incidentally provides a more complicated test case (4 inner joins, 2 using polymorphism). 2010-10-02 21:45:46 +01:00
Jon Leighton
34ee586e99 Integrate nested support into ThroughAssociationScope, using my concept of generating a 'chain' of reflections to be joined. It seems to work at the moment, all existing tests are passing. There may be further complications as we add more test cases for nested associations, though. 2010-10-02 18:50:17 +01:00
José Valim
49cc01002e Be more explicit about what is deprecated. 2010-10-02 09:40:54 -07:00
José Valim
04cbabb0a0 Deprecate generators in Railties. You should use app_generators instead. 2010-10-02 18:38:23 +02:00
José Valim
757bbd540c :'' is not valid ruby. 2010-10-02 18:30:38 +02:00
Aditya Sanghi
297cf0b266 added test for form_for with search_field
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-10-02 17:48:12 +02:00
Aditya Sanghi
8d1df887d3 Fixing search_field to remove object attribute from options hash [#5730 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-10-02 17:48:11 +02:00
José Valim
7b0c592e38 reload_routes! is part of the public API and should not be removed. 2010-10-02 17:45:26 +02:00
José Valim
609849a0f1 Fix a routing test. Reorganize middleware tests. 2010-10-02 17:42:36 +02:00
Carlos Antonio da Silva
4e93179ed3 Refactor AssociationCollection#include? with objects in memory
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-10-02 08:40:38 +02:00
José Valim
b951522018 Revert "Perf: refactor _assign method to avoid inject and defining unneeded local var."
_assigns must return a hash.

This reverts commit e66c1cee86.
2010-10-02 08:36:55 +02:00
Aaron Patterson
3eb7f9adee removing more duplicate code. :'( 2010-10-01 18:09:37 -07:00
Aaron Patterson
50cf5c11a1 fixing warnings with regexps on assert_match 2010-10-01 18:07:19 -07:00
Aaron Patterson
ffbcb84c21 removing more duplicate code 2010-10-01 18:05:59 -07:00
Aaron Patterson
44f85678e9 delete repeated code 2010-10-01 18:01:34 -07:00
Aaron Patterson
6e1df2ca46 remove another lolinject 2010-10-01 17:55:39 -07:00
Aaron Patterson
dfa331ae15 use a method that actually exists 2010-10-01 17:54:50 -07:00
Aaron Patterson
61e8b23fe5 speed up index_by by removing a lolinject 2010-10-01 17:37:34 -07:00
Aaron Patterson
ff2fdcc52b removing AS::Testing::Default in favor of just undefing default_test 2010-10-01 17:22:42 -07:00
Xavier Noria
542ddd8c89 brings csrf_meta_tags back to the generated layout
After more discussion, it has be agreed that this kind
of changes within reasonable margins are OK for 3.1.
That is, it is fine to change a little bit the generators
even if that means examples in existing books won't be
exact. (Note that the singular csrf_meta_tag exists as an
alias and thus those outdated examples will run, same for
existing applications.)
2010-10-02 00:10:32 +02:00
fastred
4ea9a8d9ad Fix syntax error in ActiveModel::Validations .validate example 2010-10-01 18:32:46 +02:00
Jon Leighton
4f69a61107 Started implementing nested :through associations by using the existing structure of ThroughAssociationScope rather than layering a module over the top 2010-10-01 13:10:41 +01:00
Evgeniy Dolzhenko
ee31847a5a Fix serialization :include option name 2010-10-01 14:26:17 +04:00
Aaron Patterson
45edeed1ee Arel::Sql::Engine.new does not do anything anymore 2010-09-30 16:28:12 -07:00
Aaron Patterson
0238228e5d type_name should check for blank because people may have messed up databases 2010-09-30 16:03:05 -07:00
Jon Leighton
14c4881f9c Prevent test_has_many_through_a_has_many_through_association_on_through_reflection failing for me due to ordering of the results 2010-09-30 23:29:37 +01:00
Jon Leighton
704961ce68 Merge branch 'master' into nested_has_many_through_2 2010-09-30 23:29:23 +01:00
Aaron Patterson
15419a5dc6 build_where should be private 2010-09-30 14:37:09 -07:00
Aaron Patterson
fb4ee9c7e5 type_name is never a blank string, so use faster .nil? call 2010-09-30 14:37:04 -07:00
Marcelo Giorgi
ef6df93a8d AssociationCollection#include? working properly for objects added with build method [#3472 state:resolved] 2010-09-30 12:13:52 -07:00
Aaron Patterson
505b532605 speeding up object instantiation by eliminating instance_eval 2010-09-30 12:13:12 -07:00
Aaron Patterson
ef8ce78ba1 changing map and include to find 2010-09-30 11:00:14 -07:00
Aaron Patterson
a8a62f87f6 [#5441 state:resolved] refactoring code to determine aggregate column 2010-09-30 10:17:38 -07:00
Aaron Patterson
cc18034c8c group clause must be more specific 2010-09-30 10:17:34 -07:00
oleg dashevskii
ab9622ee62 Tests proving #5441 2010-09-30 10:17:29 -07:00
yalab
91deff08c9 Fix 'rake db:create' is ignore encoding when using postgres [#5717 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-30 13:53:06 -03:00
Neeraj Singh
33733d5d1d no need to check for nil 2010-09-30 23:59:09 +08:00
Neeraj Singh
0495736339 assert on empty array is always true. fixing test. 2010-09-30 23:57:55 +08:00
Jaime Iniesta
ef554156c4 Action Mailer Basics guide - reformatted configuration table 2010-09-30 12:23:52 +02:00
Jaime Iniesta
ae65a1f1df Action Mailer Basics guide - fixed typos 2010-09-30 12:11:51 +02:00
José Valim
6a55ca346e Revert "removing crazy finalizer code until there is proof that we need it"
This reverts commit a40e3c1a96.
2010-09-30 11:41:53 +02:00
José Valim
6b248f6ea5 Add more information to comments. 2010-09-30 10:33:31 +02:00
José Valim
1ba22bcde1 Merge remote branch 'drogus/engines' 2010-09-30 10:30:58 +02:00
Piotr Sarnacki
9f569c60ad Try to guess application's directory while trying to run the server, but only if config.ru is not present in current dir 2010-09-30 10:27:55 +02:00
Piotr Sarnacki
3049e645e5 Moved Rails::RoutesReloader to Rails::Application::RoutesReloader 2010-09-30 09:47:06 +02:00
Piotr Sarnacki
6648babded Allow running generators for Engine with usage of other application.
After that commit, developers can set ENGINE_PATH in ENGINE/scripts/rails
file and load application's ./script/rails (most of the time it will be
dummy application used for testing). When running ./script/rails g it will
use application to boot up, but then it will use Engine's root and
configuration for generators.
2010-09-30 09:47:06 +02:00
Piotr Sarnacki
f851352318 Added config.app_generators to allow configuring application's generators from railties.
With config.generators becomes a way to configure generators
for current instance only. For example:

module Blog
  class Engine < Rails::Engine
    config.generators do |g|
      g.orm :active_record
    end

    config.app_generators do |g|
      g.test_framework :rspec
    end
  end
end

such definition sets :active_record as orm for engine and :rspec
as test_framework for application. The values set with app_generators
can be overwritten in application using config.generators as you would
normally do:

module MyApp
  class Application < Rails::Application
    config.generators do |g|
      g.test_framework :test_unit
    end
  end
end
2010-09-30 09:47:06 +02:00
Piotr Sarnacki
57aa79e6be Move routes_reloader to a class: RoutesReloader 2010-09-30 09:47:06 +02:00
Piotr Sarnacki
ec5d846ac6 Properly reload routes defined in class definition
Sometimes it's easier to define routes inside Engine or
Application class definition (e.g. one file applications). The
problem with such case is that if there is a plugin that
has config/routes.rb file, it will trigger routes reload on application.
Since routes definition for application is not in config/routes.rb
file routes_reloader will fail to reload application's routes
properly. With this commit you can pass routes definition as a block
to routes method, which will allow to properly reload it:

class MyApp::Application < Rails::Application
  routes do
    resources :users
  end
end
2010-09-30 09:47:05 +02:00
Piotr Sarnacki
22b11a41cc Allow mounting engines at '/'
Without that commit script_name always become '/', which
results in paths like //posts/1 instead of /posts/1
2010-09-30 09:47:05 +02:00
Piotr Sarnacki
74598fe7e9 Do not overwrite _railtie method on namespace while creating isolated engine or application.
In order to run Engine as standalone application, you will need
Rails::Application instance in the same namespace that engine
one. It's very important to leave _railtie bound to whatever
used "namespace" method first.
2010-09-30 09:47:05 +02:00
José Valim
69f97f4697 Use .find here as it is simpler and faster. 2010-09-30 07:25:06 +02:00
Aaron Patterson
31752f3516 avoid creating a block if possible 2010-09-29 18:32:51 -07:00
Aaron Patterson
7e057d11aa fixing regexp warnings 2010-09-29 18:23:33 -07:00
Aaron Patterson
29c32e8329 tag value can be false, so nil? check is necessary 2010-09-29 17:57:39 -07:00
Neeraj Singh
396f3a28f1 double negative is not good 2010-09-30 08:11:36 +08:00
Neeraj Singh
618407db56 another case of extra nil? check 2010-09-30 08:11:35 +08:00
Neeraj Singh
08a08d97dd no need to check for nil? 2010-09-30 08:11:35 +08:00
Neeraj Singh
692f5184c4 no need to check for nil? 2010-09-30 08:11:34 +08:00
Neeraj Singh
8efdffeda3 no need of nil check 2010-09-30 08:11:34 +08:00
Neeraj Singh
299e9f6927 no need of nil check 2010-09-29 16:43:00 -07:00
Aaron Patterson
a40e3c1a96 removing crazy finalizer code until there is proof that we need it 2010-09-29 16:40:47 -07:00
Aaron Patterson
2eef53b163 removing useless code 2010-09-29 16:17:56 -07:00
Aaron Patterson
78ac9c2be7 dry up method checking in the request object 2010-09-29 16:09:58 -07:00
Aaron Patterson
ab0d216b67 reduce function calls on Array 2010-09-29 15:43:27 -07:00
Aaron Patterson
3f88f26d1e removing more lolinject 2010-09-29 15:41:06 -07:00
Aaron Patterson
2437356cda removing lollerject 2010-09-29 15:37:38 -07:00
Aaron Patterson
e8c9cac1c3 self is implied, so remove self 2010-09-29 15:16:44 -07:00
Aaron Patterson
4d7b2ee524 dry up method missing 2010-09-29 15:07:33 -07:00
Aaron Patterson
1d9a219307 oops, missed a uniq 2010-09-29 11:53:34 -07:00
Aaron Patterson
a5f8f59081 dry up action_methods 2010-09-29 11:47:54 -07:00
Aaron Patterson
1c0be7baac fixing space error 2010-09-29 11:47:54 -07:00
Emilio Tagua
61cf11247b Use detect instead select to avoid "sh: [mysqldump]: command not found".
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-29 20:29:51 +02:00
José Valim
d2ea2e1d5f Merge remote branch 'miloops/warnings' 2010-09-29 20:28:51 +02:00
Xavier Noria
a617f6bc4c Merge branch 'master' of github.com:lifo/docrails 2010-09-29 20:26:42 +02:00
Aaron Patterson
5793d5e002 eliminating method_missing on TableDefinition 2010-09-29 11:18:43 -07:00
Aaron Patterson
c57f5d58ea no need to call e.class 2010-09-29 10:39:17 -07:00
Aaron Patterson
b9215273a9 DRY up postgresql quote logic 2010-09-29 10:36:33 -07:00
Aaron Patterson
4350a5c73f fixing where clause indentation 2010-09-29 10:36:33 -07:00
Aaron Patterson
5e77872ac9 use consistent method calls for column inspection 2010-09-29 10:36:33 -07:00
Aaron Patterson
df9abfab6f require pg when this adapter is loaded 2010-09-29 10:36:33 -07:00
Aaron Patterson
b5b7f2e442 only reopen ConnectionAdapters once 2010-09-29 10:36:33 -07:00
Aaron Patterson
b2979117e0 use inheritence to deal with custom methods 2010-09-29 10:36:32 -07:00
Aaron Patterson
2cc4b7f297 fisting test organization 2010-09-29 10:36:32 -07:00
Aaron Patterson
995ad3b378 just use if rather than nil? 2010-09-29 10:36:32 -07:00
Aaron Patterson
b3c7766df7 just require sqlite3 when the database adapter is required 2010-09-29 10:36:32 -07:00
Emilio Tagua
6371e5b99f We can't assign @view_context_class here, define super() in test instead if we want to avoid warnings. 2010-09-29 14:35:24 -03:00
José Valim
258f7b586e Fix a small typo (ht: masterkain) 2010-09-29 10:34:37 -07:00
Emilio Tagua
c37800aae1 _ is not a valid scheme name character, \w includes it and also is redundant with \d.
'The scheme name consists of a letter followed by any combination of letters, digits, and the plus ("+"), period ("."), or hyphen ("-") characters; and is terminated by a colon (":").'
2010-09-29 12:55:43 -03:00
Emilio Tagua
8823b85010 Remove redundant conditional. 2010-09-29 12:42:51 -03:00
Emilio Tagua
152580ee00 Don't try to interpolate string if there's no interpolation point at all. 2010-09-29 12:42:51 -03:00
Emilio Tagua
bc0e7f4e37 Test correct method behaviour. 2010-09-29 12:42:51 -03:00
Emilio Tagua
6268815779 Initialize @view_context_class and cache view_context_class value. 2010-09-29 12:42:23 -03:00
Joost Baaij
b1acba7bb8 Cleanup of the References section.
Removed non-functional links.
Removed links to API documentation.
Removed link to Rails 2 material.

Renamed "References" to "Further Reading".
2010-09-29 15:56:16 +02:00
Joost Baaij
3c620bed8c Removed obsolete "advanced" plugin URLs.
These plugins are obsolete even for Rails 2, they have no place in a Rails 3 guide.
Also removed "mad cool" reference.

If anyone has ideas about cache plugins that *must* be included, I would love to know.
As far as I am concerned the rails guides should stick to built-in methods and have a
simple list of references for people wishing to investigate further.

I will check out the references after this commit to see if they're up to date.
2010-09-29 15:51:09 +02:00
José Valim
f63d35fba5 Ensure that named routes do not overwrite previously defined routes. 2010-09-29 14:24:32 +02:00
José Valim
b1ae796284 Fix an error on 1.8.7. 2010-09-29 11:28:38 +02:00
José Valim
392df0fc06 @_etag is not used anywhere. 2010-09-29 11:19:22 +02:00
José Valim
14f9904e0f Avoid (@_var ||= nil) pattern by using initialize methods and ensuring everyone calls super as expected. 2010-09-29 11:18:31 +02:00
José Valim
0bbf9029e8 Merge remote branch 'miloops/warnings' 2010-09-29 10:04:42 +02:00
Santiago Pastorino
006cef7107 Add gem 'arel' from git commented out as an example of how to Bundle egde Rails with Arel edge
[#5723 state:committed]
2010-09-29 00:14:48 -03:00
Aaron Patterson
dec3a759d1 removing more useless code! yay! 2010-09-28 17:32:38 -07:00
Aaron Patterson
8d9f7b5b99 SqlLiteral is a string, so we can dry up these conditionals 2010-09-28 17:31:31 -07:00
Aaron Patterson
b50b1ef9e8 shorten up or sql literal creation statements 2010-09-28 17:12:19 -07:00
Aaron Patterson
39d98e5c09 we only care about arrays and strings 2010-09-28 17:05:32 -07:00
Aaron Patterson
957e6fbe2a dry up calls to arel.join() 2010-09-28 17:03:36 -07:00
Aaron Patterson
ef2392f60b removing unused lasgns 2010-09-28 16:59:38 -07:00
Aaron Patterson
e6ca7e7197 refactoring to remove crazy logic 2010-09-28 16:14:39 -07:00
Aaron Patterson
c2cad2d97e where_values_hash always returns a hash 2010-09-28 15:56:08 -07:00
Neeraj Singh
3f16103daf performance improvement based on discussion at fbd1d306b9
Credit goes to all the participants in the discussion
2010-09-28 15:52:26 -07:00
Aaron Patterson
9b89a436e5 Revert "porting 515917f5d8 to master"
This reverts commit bee447a5b9.
2010-09-28 15:51:07 -07:00
Aaron Patterson
16f5d29755 Revert "porting 0665182950 to master. Thanks Marcelo Giorgi"
This reverts commit 9eca11a4a5.
2010-09-28 15:51:00 -07:00
Aaron Patterson
10041e2d45 removing a conditional that is not used 2010-09-28 15:39:24 -07:00
Aaron Patterson
d0fb0d770f fisting the postgresql tests 2010-09-28 15:32:12 -07:00
Emilio Tagua
17599abc9c Enable warnings now that they can be readed. 2010-09-28 18:50:46 -03:00
Emilio Tagua
623ef13b77 Fix test that wasn't running at all. 2010-09-28 18:48:58 -03:00
Emilio Tagua
d5bb640eb0 Remove methods to avoid warnings. 2010-09-28 18:40:38 -03:00
Emilio Tagua
783e9b8de5 Change test to avoid warnings. 2010-09-28 18:38:25 -03:00
Emilio Tagua
34fc109549 Redefine duplicated test name. 2010-09-28 18:36:45 -03:00
Emilio Tagua
454960d9fb Redefine duplicated test name. 2010-09-28 18:35:02 -03:00
Emilio Tagua
3e336f9ab7 Use redefine_method since baz is already defined. 2010-09-28 18:31:52 -03:00
Emilio Tagua
0c08d8bd75 Fix more warnings by defining variables and using instance_variable_defined? instead instance_variable_get. 2010-09-28 18:25:52 -03:00
Emilio Tagua
0fa9c5392e Define @_layout if it is not defined. 2010-09-28 18:25:24 -03:00
Emilio Tagua
357f59447d Initialize @path. 2010-09-28 18:20:54 -03:00
Emilio Tagua
e804104200 Use helper method here. 2010-09-28 18:16:26 -03:00
Emilio Tagua
a0f95a887e Silence warnings here, only setting Encoding.default_external for testing. 2010-09-28 18:11:57 -03:00
Emilio Tagua
d1e976da7f Silence warnings here, only setting Encoding.default_external for testing. 2010-09-28 18:10:32 -03:00
Emilio Tagua
523f98099d Remove more warnings on AP. 2010-09-28 18:01:48 -03:00
Emilio Tagua
ad2c21089e Define @title to avoid warnings. 2010-09-28 17:44:26 -03:00
Emilio Tagua
80a98e9b25 Use instance_variable_defined? instead instance_variable_get in tests. 2010-09-28 17:35:17 -03:00
Emilio Tagua
3abd0593a6 Initialize ivars in tests. 2010-09-28 17:32:18 -03:00
Emilio Tagua
c648a4cb94 Remove useless string line causing a warning. 2010-09-28 17:18:48 -03:00
Emilio Tagua
9917356d66 Remove more warnings by initializing variables in test. 2010-09-28 17:16:18 -03:00
Emilio Tagua
3f94b45262 Remove more warnings: no need to define attr_accessor if already exists. Initialize ivar. 2010-09-28 17:08:43 -03:00
Emilio Tagua
19d9fffb9b Use redefine_method instead define_method, it may be already defined. 2010-09-28 17:08:10 -03:00
Emilio Tagua
c8db1adc0d Remove duplicated class test. copy/paste fail? 2010-09-28 16:40:28 -03:00
Emilio Tagua
4d6e178f88 Remove method if exists, avoid calling Array#first so many times. 2010-09-28 16:31:21 -03:00
Emilio Tagua
da8f9ca432 Remove more warnings on variables. 2010-09-28 16:27:05 -03:00
Emilio Tagua
dc37bd778a Initialize @trusted_proxies. 2010-09-28 16:25:06 -03:00
Emilio Tagua
eea61a030e Initialize @compiled_at if it is not. 2010-09-28 16:24:42 -03:00
Emilio Tagua
6286b63f27 Remove warings from rescues: don't define more than once debug_hash method and ask if @response if defined. 2010-09-28 16:20:48 -03:00
Emilio Tagua
540e87256d Remove remaining warnings on _trace by adding parenthesis to gsub arguments. 2010-09-28 16:12:07 -03:00
Emilio Tagua
c9416546a2 Use parenthesis to avoid ambiguous first argument warning. 2010-09-28 16:09:31 -03:00
Emilio Tagua
7129dd95d0 undef method if already defined. 2010-09-28 16:08:00 -03:00
Emilio Tagua
dda3431942 Remove useless use of :: in void context. 2010-09-28 16:02:31 -03:00
Emilio Tagua
7c8b43ed4f Ask if the instance variable is defined before asking for it, avoid *many* warnings. 2010-09-28 15:53:32 -03:00
Emilio Tagua
9027721b11 Add parenthesis to avoid syntax warnings. 2010-09-28 15:48:45 -03:00
Emilio Tagua
059d609a1a Avoid more uninitialized variable warnings. 2010-09-28 15:46:30 -03:00
Emilio Tagua
97174980e5 Remove duplicated method. 2010-09-28 15:43:03 -03:00
Emilio Tagua
04c4f47fed Initialize @sub_templates 2010-09-28 15:33:48 -03:00
Emilio Tagua
699fb81def Initialize @_virtual_path path ivar. 2010-09-28 15:31:29 -03:00
Emilio Tagua
dc2cd266cd Rename tests to avoid name collisions and warnings when running rake task. 2010-09-28 15:30:59 -03:00
Emilio Tagua
f63f90134a Rename duplicated test, and give it a correct name. Remove nonsense line. 2010-09-28 15:30:16 -03:00
Emilio Tagua
dc61ab0be5 Remove duplicated test. 2010-09-28 15:29:59 -03:00
Emilio Tagua
adcc5e11fe @selected may not be defined here, avoid warning. 2010-09-28 15:29:40 -03:00
Marcelo Giorgi
cdfd013dd7 Set attributes properly for model built from association with conditions [#5562 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-28 15:22:50 -03:00
Aaron Patterson
1ef2b47fb1 convert inject to map + join 2010-09-28 11:22:16 -07:00
Emilio Tagua
8ee27afd06 Don't define _test_case method if already defined. 2010-09-28 15:21:44 -03:00
Emilio Tagua
4bce8e3c75 No need to call super here. Use yield instead block.call 2010-09-28 15:10:55 -03:00
Emilio Tagua
b8c565fbd6 Initialize @app if it doesn't exists. 2010-09-28 15:10:15 -03:00
Aaron Patterson
2fc5c6333b each works well too 2010-09-28 10:43:18 -07:00
Aaron Patterson
e001ea0940 no need for splat and flatten 2010-09-28 10:40:43 -07:00
Aaron Patterson
9b561ab029 avoid calling to_sql when we can 2010-09-28 10:37:35 -07:00
Aaron Patterson
bf2223d0e0 removing an inject + merge in favor of Hash#[] 2010-09-28 10:30:42 -07:00
Aaron Patterson
75e52df0e8 fixing indentation warning 2010-09-28 10:26:32 -07:00
Étienne Barrié
8b8730e139 Test add_index and remove_index with a symbol name #4891 2010-09-28 10:06:57 -07:00
Aaron Patterson
9eca11a4a5 porting 0665182950 to master. Thanks Marcelo Giorgi 2010-09-28 10:04:33 -07:00
Aaron Patterson
bee447a5b9 porting 515917f5d8 to master 2010-09-28 10:02:03 -07:00
Emilio Tagua
71acc2737a Move uri parser to AS as URI.parser method to reuse it in AP and ARes. 2010-09-28 11:38:35 +08:00
Aaron Patterson
b7934afe32 use new skool Ruby instead of Ruby Classic™ 2010-09-27 18:55:28 -07:00
Aaron Patterson
7752b2fa62 be kind to the garbage collector: only instantiate objects when absolutely necessary 2010-09-27 18:07:35 -07:00
Aaron Patterson
526ade1ff6 adding test cases for the dynamic finder matcher match method 2010-09-27 17:59:28 -07:00
Aaron Patterson
65d74312c8 constructor should not do so much work; avoid allocating object if possible 2010-09-27 17:38:49 -07:00
Emilio Tagua
197a995bc5 Move uri parser to AS as URI.parser method to reuse it in AP and ARes. 2010-09-27 20:57:26 -03:00
Aaron Patterson
133742d185 @klass also uses DynamicFinderMatch, so no need for it on the relation 2010-09-27 16:51:12 -07:00
Aaron Patterson
b1f5e90839 no need for a case / when statement 2010-09-27 16:20:46 -07:00
Aaron Patterson
f6ef4d383e do not need intermediate variable, avoid lasgn 2010-09-27 16:20:46 -07:00
Aaron Patterson
ff5b3f5c3a DRY up our regular expression 2010-09-27 16:20:46 -07:00
Aaron Patterson
9e652b65c2 reduce method calls in the dynamic finder matcher 2010-09-27 16:20:46 -07:00
José Valim
8aa86babad Fix tests on 1.9.2. 2010-09-28 00:39:29 +02:00
Xavier Noria
dc5336e7f4 revises RDoc of Hash#to_param to be more precise about ordering 2010-09-28 00:36:53 +02:00
Xavier Noria
10dec0e65e let Hash#to_param and Hash#to_query sort again
This was a regression introduced in 5c85822008. We bring
sorting back because people rely on it, eg for constructing consistent cache keys.
2010-09-28 00:32:20 +02:00
Aaron Patterson
f22b40a8f2 make sure we use the engine assigned to the table when quoting 2010-09-27 14:29:07 -07:00
Neeraj Singh
bfc986811c Test for after_create callback order in ActiveSupport [#5703 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-27 23:12:10 +02:00
Neeraj Singh
72c1e19c33 after_create in ActiveModel should in the order specified
[#5650 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-27 23:11:31 +02:00
Diego Carrion
72f37bd8bc renderer calls object.to_json when rendering :json => object [#5655 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-27 23:11:29 +02:00
Neeraj Singh
4966b915fe Fix for #5579 involved the code change for both has_one and has_many relationships. The path included test only for has_one. This patch adds test for has_many relationship.
[#5706 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-27 23:11:26 +02:00
Neeraj Singh
7f743233c4 Fix for nested_attributes with has_many association fails when a single record is being updated.
[#5705 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-27 23:11:24 +02:00
Matthijs Langenberg
67a838574b Fix broken module namespacing in ActiveResource with Ruby 1.9 [#5699 state:resolved]
Following namespace use case was broken with Ruby 1.9:

  class Author < ActiveRecord::Base
    ...
  end

  module Api
    class Book < ActiveResouce::Base
    end
  end

Let's say XML contains <book><author><name>John</name></author>....

  Api::Book.first.author.class.to_s #=>
    Ruby 1.8.7: "Api::Book::Author" (namespaced, correct),
    Ruby 1.9: "Author" (toplevel, broken)

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-27 23:10:55 +02:00
José Valim
dd83140b24 Properly initialize variables inside the initialize method. 2010-09-27 22:58:31 +02:00
Emilio Tagua
8adb24016d Define @_routes inside method, makes more sense and will be initialized when called anywhere.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-27 16:43:33 -03:00
Emilio Tagua
1ab2ab07b5 Remove more warnings shadowing outer local variable.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-27 16:43:17 -03:00
Emilio Tagua
2f326b7f27 Remove warning "URI.unescape is obsolete" from actionpack.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-27 16:43:04 -03:00
José Valim
8be911c698 Merge remote branch 'gramos/ares-missing-prefix-value' 2010-09-27 21:33:03 +02:00
José Valim
8aa3684e07 Do not cache the script name outcome. 2010-09-27 21:14:18 +02:00
José Valim
fe0251e408 Merge remote branch 'miloops/warnings'
Conflicts:
	actionpack/lib/action_controller/metal/url_for.rb
2010-09-27 21:00:54 +02:00
José Valim
6067d16200 Call it compile_methods! and do the same on AM. 2010-09-27 20:43:56 +02:00
Aaron Patterson
e1b51955f1 adding a test for slug behavior 2010-09-27 11:33:35 -07:00
Gaston Ramos
f85b38a36b - added mock to test ActiveResource::MissingPrefixParam in finder_test 2010-09-27 15:25:44 -03:00
Gaston Ramos
e405dbcb48 - update exceptions documentation 2010-09-27 15:25:39 -03:00
Gaston Ramos
823a8e6e66 - check prefix options in collection_path 2010-09-27 15:25:33 -03:00
Gaston Ramos
9363931f34 - better name for prefix param test case 2010-09-27 15:25:28 -03:00
Gaston Ramos
30fb3638cc - refactoring, move prefix_options check to a custom method 2010-09-27 15:25:23 -03:00
Gaston Ramos
a71e07d61e - elmenth_path raise an ActiveResource::MissingPrefixParam exception when prefix_options does not has all required prefix_options ex: class StreetAddress < ActiveResource::Base self.site = "http://37s.sunrise.i:3000/people/:person_id/" end
StreetAddress.element_path(1)
    # => ActiveResource::MissingPrefixParam
2010-09-27 15:25:16 -03:00
José Valim
756b32ef39 Merge remote branch 'thedarkone/performance' 2010-09-27 20:10:04 +02:00
Neeraj Singh
fbd1d306b9 Three performance improvements:
* for simple cases like User.last and User.order('name desc').last no need to perform Array#join operation.

* Instead of performing String#blank? do Array#empty?

* no need to create variable relation
2010-09-27 10:49:49 -07:00
Aaron Patterson
e3d6434dd9 depending on arel 2.0.0 2010-09-27 09:27:39 -07:00
thedarkone
9c57bd8578 Fix Namind#model_name. 2010-09-27 17:46:00 +02:00
thedarkone
dc09cc055a Assume compute_asset_host returns reasonable values. 2010-09-27 17:46:00 +02:00
thedarkone
bb47927d91 Convert unless/else into if/else. 2010-09-27 17:46:00 +02:00
thedarkone
b127e0cac9 Performance: refactor convert_options_to_data_attributes. 2010-09-27 17:46:00 +02:00
thedarkone
dcabc6c043 Remove dead code. 2010-09-27 17:46:00 +02:00
thedarkone
7d9f605f80 Clean up url_for. 2010-09-27 17:45:59 +02:00
thedarkone
5b81d1f3ef Hash#empty? is faster than Enumerable#any? when used on a Hash. 2010-09-27 17:45:59 +02:00
thedarkone
70357666bc Do a single string interpolation. 2010-09-27 17:45:59 +02:00
thedarkone
e1bccc5169 Simple .empty? test will do fine here (rails_asset_id returns nice strings). 2010-09-27 17:45:59 +02:00
thedarkone
7cee1587f1 options[:action] is very likely to be nil. 2010-09-27 17:45:59 +02:00
thedarkone
77efc20a54 Make assert_valid_keys slightly faster. 2010-09-27 17:45:59 +02:00
thedarkone
4c360c15e5 No need for an extra wrapper array. 2010-09-27 17:45:59 +02:00
thedarkone
e12e2fb4f6 Cache 2 of Request's commonly called methods. 2010-09-27 17:45:59 +02:00
thedarkone
8fdb34b237 Cache url_options on a per-request basis. 2010-09-27 17:45:59 +02:00
thedarkone
86bcccf8df No need to create a separate lambda for each call. 2010-09-27 17:45:59 +02:00
thedarkone
7b2d51817d Make asset extension rewriting faster. 2010-09-27 17:45:58 +02:00
thedarkone
05e53b4c1a Optimize relative_url_root rewriting code. 2010-09-27 17:45:58 +02:00
thedarkone
f2e0b3575e Use native attr_* macros for performance reasons. 2010-09-27 17:45:58 +02:00
thedarkone
320382ccd3 Creating singleton class for every object whenever the instance-level accessor is used quite is expensive. 2010-09-27 17:45:58 +02:00
thedarkone
5a518487fe Try to use Hash's native #[] for speed. 2010-09-27 17:45:58 +02:00
thedarkone
8cda132136 Make InheritableOptions's constructor more flexible. 2010-09-27 17:45:58 +02:00
thedarkone
918dc27345 Compile ActionController::Base.config's methods to avoid method_missing overhead. 2010-09-27 17:45:58 +02:00
Emilio Tagua
50decfbc0e _routes must be inside @controller conditional. 2010-09-27 11:19:24 -03:00
Emilio Tagua
023c2020b3 Initialize @_routes if not defined yet, avoiding more warnings. 2010-09-27 11:19:24 -03:00
Emilio Tagua
bb71f182dd Rename duplicated test name. 2010-09-27 11:19:24 -03:00
Emilio Tagua
c2940a6bf4 Refactor method to avoid warnings and not run unnecessary code. 2010-09-27 11:19:24 -03:00
Emilio Tagua
d0621fde88 Avoid uninitialized variable warning. 2010-09-27 11:19:24 -03:00
Emilio Tagua
d95a16c526 Initialize @_request and @_response. 2010-09-27 11:19:23 -03:00
Emilio Tagua
2f59cd6fd6 Remove method previous method if already defined. 2010-09-27 11:19:23 -03:00
Emilio Tagua
e7c833fca9 Define @emitted_hidden_id if it doesn't exists and reuse it if it does. 2010-09-27 11:19:23 -03:00
Emilio Tagua
74d7664b60 Avoid uninitialized variable warning. 2010-09-27 11:19:23 -03:00
Emilio Tagua
1ed18fcc91 Initialize @cookies. 2010-09-27 11:19:23 -03:00
Emilio Tagua
583ddf22a2 Remove more warnings shadowing outer local variable. 2010-09-27 11:19:22 -03:00
Emilio Tagua
dafb4bd33b Don't shadow outer local variables. 2010-09-27 11:19:22 -03:00
Emilio Tagua
6b135f7e46 Remove method if already exists to avoid warnings. 2010-09-27 11:19:22 -03:00
Emilio Tagua
0cb1d87cd5 Remove duplicated test. 2010-09-27 11:19:22 -03:00
Emilio Tagua
53b91b11cc Avoid uninitialized variable warning, reuse @integration_session. 2010-09-27 11:19:21 -03:00
Emilio Tagua
24ef32fe93 Ask is @controller is defined to avoid warning. 2010-09-27 11:19:21 -03:00
Emilio Tagua
cd681681e6 Initialize @_routes if it doesn't exists. 2010-09-27 11:19:21 -03:00
Emilio Tagua
986bad6a3b Remove warning "too many arguments for format string" when interpolating with empty hash. 2010-09-27 11:19:21 -03:00
Emilio Tagua
b9fa46ca97 Initialize @_etag. 2010-09-27 11:19:21 -03:00
Emilio Tagua
bb2f53b409 Initialize @as before plural method is called. 2010-09-27 11:19:20 -03:00
Emilio Tagua
5ced275ac1 Remove old method before redefining it. 2010-09-27 11:19:20 -03:00
Emilio Tagua
5d773f8ded Remove warning "URI.unescape is obsolete" from actionpack. 2010-09-27 11:19:20 -03:00
Emilio Tagua
535371e956 Fix indentation. 2010-09-27 11:19:19 -03:00
Emilio Tagua
2d274a5208 Use parentheses when using assert_match followed by a regexp to avoid warnings. 2010-09-27 11:19:19 -03:00
Emilio Tagua
be9883b09d Don't redefine existing attributes accessors. 2010-09-27 11:19:19 -03:00
Emilio Tagua
eff68d86ad Prevent shadowing outer local variable. 2010-09-27 11:19:19 -03:00
Aaron Patterson
7918a5c966 third parameter is not used 2010-09-26 18:25:13 -07:00
Nic Benders
f8c7f4cc53 db:structure:dump should list current Rails.env adapter in errors, not always the test adapter
[#5710 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-26 20:45:30 -03:00
Tim Connor
d6f7b7d353 Fix remove_index issue when provided :name is a symbol
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-26 20:40:14 -03:00
Santiago Pastorino
56de4e9a80 Fix the precedence issue here 2010-09-26 17:54:00 -03:00
Santiago Pastorino
db23e32141 Not need to do this double ternary 2010-09-26 17:43:26 -03:00
Santiago Pastorino
29f13beda3 port is appended twice to HTTP_HOST when host already has the port 2010-09-26 12:06:19 -03:00
Bodaniel Jeanes
b689834bcf Initial nested_has_many_through support [#1152] 2010-09-26 22:25:25 +10:00
Santiago Pastorino
14d2feeeab Bump up some deps 2010-09-26 00:29:38 -03:00
Carlos Antonio da Silva
12db1a39cd Partial revert of #d650b71 'Remove deprecated stuff in ActionController'
This brings back the deprecated modules from ActionController, because
they didn't have any deprecation warning.
2010-09-26 02:13:48 +08:00
Carlos Antonio da Silva
ecc13f7c18 We don't need to check if the format exists to generate the url, it already does it internally 2010-09-26 02:13:48 +08:00
Carlos Antonio da Silva
00e7633555 More cleanup on form helpers 2010-09-26 02:13:47 +08:00
Carlos Antonio da Silva
6345899489 Remove last tests with deprecated form_for and cleanup form_for helper
This cleans up the last bits of deprecation stuff from form_for helper.
However there is still a bug when using :as => foo[], with index. The
classes and ids are being generated using [], such as foo[]_edit. This
bug already existed but it was not detected before.
2010-09-26 02:13:47 +08:00
Carlos Antonio da Silva
db57e92784 Select tags with array options are deprecated, removing 2010-09-26 02:13:46 +08:00
Carlos Antonio da Silva
eb8a24a375 Refactor form_for helper 2010-09-26 02:13:46 +08:00
Carlos Antonio da Silva
8a16485a96 Review most of the form_for deprecated tests, missing tests with index like [] 2010-09-26 02:13:45 +08:00
Carlos Antonio da Silva
7fc1edd790 Remove deprecated stuff in ActionController
This removes all deprecated classes in ActionController related to
Routing, Abstract Request/Response and Integration/IntegrationTest.
All tests and docs were changed to ActionDispatch instead of ActionController.
2010-09-26 02:13:45 +08:00
Carlos Antonio da Silva
ff3f55ee58 There is no need to open AC::Base three times to setup tests. 2010-09-26 02:13:44 +08:00
Carlos Antonio da Silva
f405df6e57 There is no DeprecatedBlockHelpers in AV, so remove it 2010-09-26 02:13:44 +08:00
José Valim
e0c344dc49 Fix active_resource assertions. 2010-09-25 17:56:56 +02:00
Piotr Sarnacki
f8294cb8ba Fix app and actions generators tests
Normally Rails.application is an instance, but for those
tests Rails.application needs to be class.

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-25 17:28:39 +02:00
Piotr Sarnacki
0134c5cc94 Refactor a few methods connected with namespacing in Rails::Generators::NamedBase
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-25 17:28:10 +02:00
Piotr Sarnacki
51c7660e08 Add namespacing to mailer generator
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-25 17:28:10 +02:00
Piotr Sarnacki
7acf64a81b Add namespacing for observer generator
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-25 17:28:10 +02:00
Piotr Sarnacki
49c3ad7f77 Add namespace for test_unit generators
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-25 17:28:10 +02:00
Jacques Crocker
51f1f550da Allow per Resource format settings
Previously, ActiveResource was using the connection level formatter for get requests. This made it impossible to use custom formatters per resource.

Additionally this commit makes the Connection request methods more consistent. It always returns a Response. The base will then decode it each the response using its format setting.

Merging this commit will allow users to add custom formatters on a per Resource basis. This enables handling pagination responses from the server side, a very common use case that was previously impossible without monkeypatching XmlFormat.

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-25 13:54:09 +02:00
Aditya Sanghi
de880302bd review comments 2010-09-25 15:04:25 +05:30
Aditya Sanghi
db8b3e71dc add section about email with name 2010-09-25 14:49:28 +05:30
Jacques Crocker
ee5ef67c44 Allow ActiveResource to work with non-generated ids [#5660 state:resolved]
This commit updates new? so that it knows whether or not the record was actually new or not, and doesn't rely solely on the presence of id. This enables the ability to set a custom primary_key that is not autogenerated by the server.

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-25 11:15:40 +02:00
Krekoten' Marjan
1b7d30bfc9 Fix 'warning: method redefined' [#5551 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-25 11:06:55 +02:00
Krekoten' Marjan
8639c10a40 Fix logging when cache key contains % sign [#5570 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-25 11:04:20 +02:00
Krekoten' Marjan
da94d0e8ca Remove duplicate helper method
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-25 11:02:46 +02:00
José Valim
e6d503bcfb Update abort message (ht: tilsammans). 2010-09-25 11:01:43 +02:00
Aditya Sanghi
c94e92e2b0 Add section about multiple recipients 2010-09-25 14:31:19 +05:30
John Firebaugh
75a960ca6e Don't act destructively on ActiveModel::Name#human options hash. [#5366 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-25 10:59:54 +02:00
John Firebaugh
308517e913 Don't duplicate Rack::Response functionality. [#5320 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-25 10:58:07 +02:00
John Firebaugh
c509379923 Add ActionDispatch::TestResponse tests.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-25 10:52:57 +02:00
Piotr Sarnacki
135d6164c5 Rails.application is set anyway, we don't need to set it manually, this was purpose of different behavior in tests and in application
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-25 10:46:22 +02:00
Piotr Sarnacki
00aa13bc0e Generators fix: properly check if module should be created when creating a namespaced model
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-25 10:46:22 +02:00
Kulbir Saini
b1603990df Fixed routing examples in Routing guide. Updated URL to RoutingAssertions module. 2010-09-25 06:24:27 +05:30
Kulbir Saini
f488499c26 Updated 'Action Controller Overview' guide to rails 3 and fixed a few URLs throwing 404s. 2010-09-25 05:06:10 +05:30
Andrew Kaspick
fb08e334d6 memoized protected methods should remain protected
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-24 20:31:12 -03:00
Marcelo Giorgi
72543b2e63 Delegate ActiveRecord::Base.offset to scoped methods (analogous to limit) [#5688 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-24 20:24:54 -03:00
Aaron Patterson
a0db7be4af attr_accessor_with_default should raise an ArgumentError not a RuntimeError 2010-09-24 14:48:57 -07:00
Kulbir Saini
c941cba170 Updated all forms to accept UTF-8 encoding in Form Helpers guide wrt Rails 3. 2010-09-25 03:03:22 +05:30
Brian Candler
a348ffcb2d Fix warning message when db/schema.rb doesn't exist [#5625 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-24 17:40:03 -03:00
Jeff Kreeftmeijer
d82d98dcd5 got rid of the "ambiguous first argument; put parentheses or even spaces" warnings in the scaffold_generator tests [#4872 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-24 16:17:39 -03:00
José Valim
127da544bb Bump thor version requirement. 2010-09-24 21:03:12 +02:00
Piotr Sarnacki
bac0826b1f Refactor namespaced generators to use module_namespacing block helper
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-24 21:02:30 +02:00
Piotr Sarnacki
e83634081a Generators are not aware of namespace of isolated engines and applications
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-24 21:02:24 +02:00
tnp
55b6fa9370 restore behavior of touch for models without :updated_xx [#5439 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-24 20:42:38 +02:00
Rodrigo Rosenfeld Rosas
8d30193b08 Properly interpolate i18n keys in modules [#5572 state:resolved] 2010-09-24 20:41:12 +02:00
Emilio Tagua
f625b87f24 These tests shouldn't depend on local time to pass or fail, we can use utc here.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-24 15:51:29 +02:00
Emilio Tagua
63039b9c33 Fix typo and add sanity test for code statistics rake task.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-24 15:51:29 +02:00
Fred Wu
51e8435e34 Ensures the app generator generates the correct @app_name. [#5434 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-24 13:10:26 +02:00
José Valim
6b3ad0cafc There is no need to use instance_eval since the proc is created in the same context it is eval'ed. 2010-09-24 12:54:31 +02:00
David Chelimsky
672ce11d68 only abort in test_help in production env
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-24 12:52:38 +02:00
Nando Vieira
7223fe7faf Make redirect_to accept blocks [#5643 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-24 12:49:27 +02:00
Obie Fernandez
275f922a23 Better shortcut options for custom validators [#5672 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-24 12:49:16 +02:00
Neeraj Singh
097240f602 reject_id option should be respected while using nested_attributes
[#5579 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-24 12:46:24 +02:00
Kulbir Saini
34908e3aef Merge branch 'master' of git@github.com:lifo/docrails 2010-09-24 07:15:00 +05:30
Kulbir Saini
b93c018947 Minor rephrasing in Active Record Quering and Layouts and Rendering guides.
Example code fixes in Layouts and Rendering guide.
2010-09-24 07:13:40 +05:30
Pedro Fayolle
78d140d06d Fixed typo (CategoriesControlleR -> CategoriesControlleR). 2010-09-23 18:26:21 -07:00
Kevin Hughes
f48c56008e Changed documentation for auto_link so that the truncate example works [#5694 state:resolved]
Signed-off-by: Xavier Noria <fxn@hashref.com>
2010-09-24 00:58:43 +02:00
Kulbir Saini
d24914c2e8 Fixes in associations_basics guide. 2010-09-24 04:27:51 +05:30
Kulbir Saini
948248a23d Updated guide to use ActiveRecord::Base.where instead of ActiveRecord::Base.find.
Added `where` as a method to has_many and has_and_belongs_to_many collections.
2010-09-24 04:04:39 +05:30
Xavier Noria
8c0c815ba7 resolves rdoc conflict 2010-09-23 22:35:08 +02:00
Aaron Patterson
afdf86e8ee Hash#to_s behaves differently between 1.8 and 1.9, so adjust accordingly 2010-09-23 08:48:10 -07:00
Carl Lerche
1da0dc2f90 Improve performance of applications using file uploads by not busting the method cache on every request containing a file upload. 2010-09-22 17:36:12 -07:00
Aaron Patterson
de9b3385fc fixing bug with rails use of rack-test 2010-09-22 17:09:06 -07:00
Aaron Patterson
a4dd0b3433 switch present in favor of empty 2010-09-22 16:14:46 -07:00
Aaron Patterson
92cb0b8be6 third parameter for rack must respond to each 2010-09-22 15:20:19 -07:00
Aaron Patterson
0a515dc68d testing poor behavior of hash serialization 2010-09-22 14:58:29 -07:00
Emilio Tagua
c88deaf5ee Use map, no need to use inject here.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-22 18:08:04 -03:00
Emilio Tagua
7047d83ec5 Perf: speed up json encoding.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-22 18:08:04 -03:00
Emilio Tagua
418190d55c Refactor inject use in hash conversions.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-22 18:08:03 -03:00
Emilio Tagua
8cfc6012f4 Perf: speed up 2 methods in railties.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-22 18:08:03 -03:00
Emilio Tagua
dc2f26ca38 Perf: refactor methods using inject when not need in activemodel.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-22 18:08:03 -03:00
Emilio Tagua
0876f39088 No need to use inject here.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-22 18:08:03 -03:00
Emilio Tagua
59296ab26d Refactor routing methods.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-22 18:08:03 -03:00
Emilio Tagua
8c97f49f2e Refactor decode_credentials to avoid inject and use map instead.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-22 18:08:03 -03:00
Emilio Tagua
6d8a6700a7 Perf: refactor _assign method to avoid inject and defining unneeded local var.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-22 18:08:03 -03:00
Emilio Tagua
10a63e2a0c Refactor methods in html node to avoid injects.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-22 18:08:02 -03:00
Emilio Tagua
f6de806537 Refactor association_collection uniq method.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-22 18:08:02 -03:00
Emilio Tagua
2da809da37 No need to use inject here.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-22 18:08:02 -03:00
Emilio Tagua
ea35ccfe20 Perf: refactor method.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-22 18:08:02 -03:00
Emilio Tagua
0580f5a6ac No need to use inject here, use map instead.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-22 18:08:02 -03:00
Emilio Tagua
4513cc142c Goodbye inject, hello map.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-22 18:08:02 -03:00
Emilio Tagua
569be76ed6 Use map instead inject.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-22 18:08:02 -03:00
eparreno
5965219ca2 some fixes in routing guide 2010-09-22 22:11:15 +02:00
Santiago Pastorino
090c9ae3a3 Missing the mysql2 gem here 2010-09-22 14:33:44 -03:00
Neeraj Singh
48a108d55b Error message should advice to use 'mysql2' gem.
If I create a new app using command
rails new demo -d mysql
then Gemfile contains 'mysql2' gem by default.

However if mysql gem is missing then error message says
raise "!!! Missing the mysql gem. Add it to your Gemfile: gem 'mysql', '2.8.1'"

[#5569 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-22 14:20:56 -03:00
Aaron Patterson
0cf45c850c avoid a proc object 2010-09-22 09:01:11 -07:00
Aaron Patterson
fe8a307088 avoid creating a range object 2010-09-22 09:01:11 -07:00
Santiago Pastorino
b73d5e81ec form_for with file_field docs fixed 2010-09-22 12:39:54 -03:00
Aaron Patterson
aa85a7a7e7 drying up construct_association 2010-09-21 21:01:48 -07:00
Aaron Patterson
8186c5736b dry up some conditionals 2010-09-21 20:44:21 -07:00
Aaron Patterson
723adecab9 fixing case / when indentation 2010-09-21 20:38:36 -07:00
Aaron Patterson
9b1a4fda6f fix case / when indentation 2010-09-21 20:32:11 -07:00
Aaron Patterson
27be777888 avoid a hash lookup 2010-09-21 20:32:00 -07:00
Aaron Patterson
e66bf6f5e3 remove more codes 2010-09-21 19:56:53 -07:00
Aaron Patterson
9b81ae6969 deleting more code 2010-09-21 19:41:15 -07:00
Aaron Patterson
8d6a6b250e use each properly to avoid splatting a variable 2010-09-21 19:37:07 -07:00
Aaron Patterson
19ff42d909 deleting repeated codes 2010-09-21 19:27:23 -07:00
Aaron Patterson
79ef26c8c9 do not pass nil values to arel 2010-09-21 19:22:37 -07:00
Aaron Patterson
31eb765640 refacoring duplicate code. <3 <3 <3 2010-09-21 16:50:22 -07:00
Aaron Patterson
50041e563a this reject can be replaced with compact 2010-09-21 15:25:09 -07:00
Aaron Patterson
fdd537e7f9 removing unused code 2010-09-21 15:25:09 -07:00
Aaron Patterson
d7877ffc30 remove some repeated code 2010-09-21 15:25:09 -07:00
Aaron Patterson
67a9ae6a66 break up giant method 2010-09-21 15:25:08 -07:00
Xavier Noria
a6aa6da5dd api guidelines: adds Test::Unit and RSpec as examples of correct spelling, also advice when in doubt 2010-09-21 23:50:57 +02:00
Aaron Patterson
88b1d51f82 removing lolinject 2010-09-21 14:42:42 -07:00
Aaron Patterson
b7e4a97ab5 fixing tests. woo 2010-09-21 14:42:28 -07:00
Hemant Kumar
953d129bb2 remove join table rows before removing owner row for habtm associations, fixes#5674 2010-09-21 13:58:09 -07:00
Aaron Patterson
96bd936b64 providing arel with column information when possible [#5392 state:resolved] 2010-09-21 13:53:47 -07:00
Xavier Noria
f4abe66d35 un-nodocs AR::Batches 2010-09-21 20:44:45 +02:00
Emilio Tagua
d64a09b443 Remove helper methods that were moved to helper.rb
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-21 15:18:12 +02:00
Joost Baaij
b39dfd5936 Document form_for behaviour when using file_field inside the block 2010-09-21 15:11:04 +02:00
Emilio Tagua
ae24ce52ae Move helper methods to helper.rb. Make test not depend on local TZ to pass or fail.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-21 15:07:43 +02:00
Piotr Sarnacki
07411ca490 List all of isolated engine changes
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-20 23:55:27 +02:00
Stevie Graham
83ecd03e7d use instance_eval, reduce method calls.
execution time in seconds for `rake test_sqlite3`:

ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]
  - before: 52.771426, 52.159505, 52.937056
  - after: 51.452584, 51.897017, 51.584431

rubinius 1.0.1 (1.8.7 release 2010-06-03 JI) [x86_64-apple-darwin10.4.0]
  - before: 284.334076
  - after: 285.753028

ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
  - before: 75.811548, 75.533153, 75.353122
  - after: 75.244243, 75.19226, 75.256925
2010-09-21 01:44:29 +08:00
Simone Carletti
f1fdc4ff0a Remove mention of Rails 3 deprecated option config.action_controller.use_accept_header.
See http://github.com/rails/rails/blob/v3.0.0/actionpack/lib/action_controller/deprecated/base.rb#L108-111
2010-09-20 17:27:26 +02:00
Piotr Sarnacki
dfac9b1404 Strengthen documantation on engine's migrations and seed data
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-20 10:41:12 +02:00
Piotr Sarnacki
d475de7e25 Add helper for loading seed data for engine and application
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-20 10:41:05 +02:00
Santiago Pastorino
0523b55ab9 file_field propagates up multipart property even inside of fields_for 2010-09-20 01:11:55 -07:00
Thiago Pradi
800bab79b3 Updating error message on ruby_version_check.rb
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-19 22:32:23 -07:00
rohit
fd53bc85e7 Send 'rails runner' help message to stdout instead of stderr.
[#5661 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-19 16:45:29 -07:00
Santiago Pastorino
88a82bcb2d application.js should be the last file on javascript_include_tag(:all) 2010-09-19 14:41:32 -07:00
Thiago Pradi
3c9bf6e1dc Exception handling more readable
[#5601 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-19 12:18:51 -07:00
Prem Sichanugrist
af6757a1ca Use Time.current to maintain consistency with AS::Duration
In [32b82e4c6f], the committer has switch
methods in AS::Duration to use `Time.current` to return the correct
duration based on the `Time.default_zone` instead of using `Time.now`.

[#5607 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-19 11:26:20 -07:00
Piotr Sarnacki
e3d38e7da2 Fix running engine_test in isolation
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-19 17:10:43 +02:00
Piotr Sarnacki
ceca0c34fa Remove unnecessary puts
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-19 17:10:41 +02:00
Xavier Noria
2b6c2e947b adds to the API guidelines the proper spelling of Arel 2010-09-19 00:05:05 +02:00
Aaron Patterson
2d65ff5af7 removing some warnings 2010-09-18 14:14:46 -07:00
Aaron Patterson
6b50bfb0f0 freeze is not necessary 2010-09-18 14:03:29 -07:00
Aaron Patterson
38f6533792 argument error is done for us 2010-09-18 14:00:00 -07:00
Prem Sichanugrist
1f6b0a554b [CI] Remove RailTies temporary directory on every run
There was an error on CI regarding unable to require `arel` gem from source when testing application build for a while ago. It seems to me like there's a permission problem on the process of cloning the application and removing Gemfile. This would make sure that the temporary application got removed every time the build is run.

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-18 21:59:29 +02:00
Santiago Pastorino
b17b980a15 file_field makes the enclosing form multipart 2010-09-18 12:31:00 -07:00
David Trasbo
e808224652 Remove existing migration when using 'rails generate model' with --force [#5526 state:committed]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-18 21:22:29 +02:00
Maxim Chernyak
20685d07ab Fix header capitalization by explicitly upcasing first letter of every word, and avoiding capitalize. [#5636 state:resolved] 2010-09-18 20:49:51 +02:00
Mike Abner
154081f0f7 make sure a Content-Length header exists and that the response.body is not nil before trying to call methods on it. Rack does not allow HTTP 204 responses to have a content-length header set. [#5038 state:resolved] 2010-09-18 20:49:45 +02:00
Neeraj Singh
39debfc854 test for #5038 2010-09-18 20:49:41 +02:00
Krekoten' Marjan
d4fa120671 Move capture to Kernel. [#5641 state:resolved] 2010-09-18 20:49:36 +02:00
rohit
76266a8184 Fix output of 'rails runner --help' [#4249 state:open] 2010-09-18 20:49:33 +02:00
Tim Connor
37de59eacf Fix issue with remove_index and add unit test [#5645 state:resolved] 2010-09-18 20:49:31 +02:00
Tim Connor
55d0d57bfc Raise errors when index creation fails 2010-09-18 20:49:28 +02:00
Neeraj Singh
9401fa0b9c expanding the test to include both type of order declaration
while declaring default_scope

Also added test for unscoped using block style with four different
combinations

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-18 20:49:19 +02:00
Neeraj Singh
8ae913664f remove irrelevant comments
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-18 20:33:40 +02:00
Andrew White
0bffd7d933 Raise ArgumentError instead of normalizing controller name when there is a leading slash [#5651 state:resolved] 2010-09-18 17:49:46 +01:00
Diego Carrion
aa654ab065 updated instructions on how to change the default session store 2010-09-18 12:46:21 -03:00
Diego Carrion
a63749483c updated instructions to generate the migration for the ActiveRecord session store table 2010-09-18 12:46:21 -03:00
Andrew Ferk
7329ceb1b9 Updated yaffle_test.rb from 2.2 to require 'test_helper' and extend ActiveSupport::TestCase 2010-09-18 09:53:08 -05:00
Andrew Ferk
8050d94907 Removed leading : from database.yml file 2010-09-18 09:46:32 -05:00
Andrew Ferk
a2fddff035 Updated output that should be seen from the initial rake 2010-09-18 09:45:12 -05:00
Andrew Ferk
97350eea03 Updated test_helper.rb to require the init.rb file from the correct folder 2010-09-18 09:40:14 -05:00
Andrew Ferk
8a045e3c82 removed leading : from database.yml file. dbfile has been updated to database in database.yml 2010-09-18 09:37:54 -05:00
Andrew Ferk
1b2b5a7055 rails/init.rb is deprecated, so keep init.rb in root of plugin. updated for 1.3 Organized Your Files 2010-09-18 08:58:24 -05:00
Andrew White
013ed1c050 Remove leading slash from controller [#5651 state:resolved] 2010-09-18 13:32:54 +01:00
Andrew Ferk
89eef55fb3 'rails generate plugin' --with-generator option has changed to --generator. Updated the output that is seen after executing 'rails generate plugin yaffle --generator' 2010-09-18 00:41:38 -05:00
Andrew Ferk
0c6ac67d2f added 'bundle install' command to h4. Create the Basic Application 2010-09-18 00:26:49 -05:00
Carl Lerche
5ff2b73b48 Small tweak the ConditionalGet documentation
Time#utc does not need to be called when passing the object to :last_modified 	since it is called internally to Rails.
2010-09-17 14:20:35 -07:00
Carl Lerche
117daba18a Update Rails' built in routes to use RouteSet#append 2010-09-17 12:27:48 -07:00
Carl Lerche
7418a44096 Add RouteSet#append
Allows specifying blocks to the routeset that will get 	appended after the RouteSet is drawn.
2010-09-17 12:05:40 -07:00
Emilio Tagua
f2765a1cb3 Refactor setup methods by extracting them in abstract_unit, remove TODO.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-17 17:03:58 +02:00
Emilio Tagua
a521a3c05a Remove TODO and support all expected attributes.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-17 17:03:51 +02:00
Alexey Mahotkin
dfebdb1b03 Tiny fixes to rdoc 2010-09-16 17:10:36 +04:00
rspeicher
6f3ac42550 Typos 2010-09-15 19:19:48 -04:00
Aaron Patterson
3480551e67 removing nonsensical tests, limit now actually adds a limit 2010-09-15 14:18:16 -07:00
Aaron Patterson
55736ef125 @join_values is passed in, so we should use the parameter 2010-09-15 14:18:15 -07:00
Sparky
eeb3246991 Only add Rack::Cache to the middleware stack if config.action_controller.perform_caching is set. 2010-09-15 12:58:49 -07:00
oamblet
bda6de2722 Updated old fashion form_for samples.
when 'form_for :resource, @resource ...' is found, remove the first argument (there is no need to use the :as option when the name is the same).
2010-09-15 10:11:07 +02:00
Fred Wu
cedc49dbd3 Updated the Cache Money repo link to one that works with Rails 3. 2010-09-15 14:22:43 +10:00
Jamison Dance
50b175030a fixed an unclear description in Sigular Resources. 2010-09-14 17:14:16 -06:00
Xavier Noria
dd6efe98b6 Merge remote branch 'docrails/master' 2010-09-14 20:07:29 +02:00
Carl Lerche
9362ef6e21 Require lazy_load_hooks.rb with the correct path. 2010-09-14 10:40:05 -07:00
Jack Dempsey
a427876606 require i18n in transliterate so it can run in isolated situations 2010-09-14 10:25:33 -07:00
rohit
b59a8d42c3 Application settings are specified in application.rb and not environment.rb 2010-09-14 10:07:34 +05:30
Xavier Noria
0207bc7cc9 get csrf_meta_tag back to the generated layout in deference to existing printed material, chomp also the generated HTML to be faithful to the output before the refactor 2010-09-14 01:35:44 +02:00
Carlhuda
d8d8334a0b Update changelog 2010-09-13 16:06:40 -07:00
Carlhuda
0fe99e87c0 Add tests for Rack::Cache 2010-09-13 16:06:03 -07:00
wycats
254ab7d916 First pass at Rack::Cache 2010-09-13 16:06:03 -07:00
W. Andrew Loe III
9cd094b8da Only send secure cookies over SSL. 2010-09-13 15:11:46 -07:00
Xavier Noria
0522b26cdf reviews 02656ac 2010-09-13 23:10:43 +02:00
Xavier Noria
2eb5476d22 copy-edits 4eb8987 2010-09-13 22:54:42 +02:00
Marcelo Giorgi
d5ef502d2a Reference watch_namespaces in comments instead of watch_modules 2010-09-13 17:53:39 -03:00
Carl Lerche
84d0c30cea Allow view helper's #initialize method to be called. [#5061 state:resolved] 2010-09-13 12:51:42 -07:00
Rohit Arondekar
3683745cbc Guides: Add test directory to load path to run individual test files. 2010-09-12 21:05:10 -07:00
Prem Sichanugrist
4eb89873c9 Add documentation for :spacer_template in Rails 3
This setting was existed since Rails 2.3.x, and seems like it have been left out when we rewriting the documentation.
2010-09-13 10:04:39 +07:00
Collin Miller
02656ac397 added documentation for :as and :object in PartialRenderer
Signed-off-by: Mikel Lindsaar <raasdnil@gmail.com>
2010-09-13 11:48:01 +10:00
Mikel Lindsaar
bca9b84a4a Fixing documentation to reflect deprecated add_to_base 2010-09-12 14:19:38 +10:00
Aaron Patterson
8c6de675e4 Remove dummy method definition in favor of RDoc hints:
http://rdoc.rubyforge.org/RDoc/Parser/Ruby.html
2010-09-11 20:51:02 -07:00
Xavier Noria
9a8861f2e4 removes /i from the TRUSTED_PROXIES regexp, adds /x and comments for readability, adds a pointer to a Wikipedia section that documents the matched IPs 2010-09-12 01:37:07 +02:00
Collin Miller
96650f704a added block arguments to ActionController::Metal#use
Useful for cases such as warden, where a block configuration is taken.

    class SomeController < ApplicationController
      use RailsWarden::Manager do |manager|
        manager.default_strategies :facebook_oauth
        manager.failure_app = SomeController.action(:authorize)
      end
    end
2010-09-12 07:35:54 +08:00
Xavier Noria
0aa66f04e4 gets rid of a double negation, no need to force exactly true/false in a predicate 2010-09-12 00:58:29 +02:00
Piotr Sarnacki
11710c0d7d Fix routing test
Signed-off-by: Mikel Lindsaar <raasdnil@gmail.com>
2010-09-11 23:26:17 +10:00
Piotr Sarnacki
b3f6c41e16 Change singular to param_key in form_helper, param_key is now used for generating field names
Signed-off-by: Mikel Lindsaar <raasdnil@gmail.com>
2010-09-11 23:26:07 +10:00
Mikel Lindsaar
8b66c91c51 Partial revert of commit #7fae0aa4ac116 removing action_dispatch.prepare_dispatcher per commit #48bf667a8b1
See line note:
7fae0aa4ac (commitcomment-145148)
2010-09-11 20:45:40 +10:00
Xavier Noria
a87b92db7b revises implementation and documentation of csrf_meta_tags, and aliases csrf_meta_tag to it for backwards compatibilty 2010-09-11 11:05:00 +02:00
wycats
f6153f74da Merge remote branch 'drogus/engines' 2010-09-11 03:24:50 -05:00
Mikel Lindsaar
477df63433 Updating ActionMailer dependency to 2.2.6 2010-09-11 15:45:28 +10:00
Aaron Patterson
ac9c715947 passing the quoted id to arel if the object has a quoted id 2010-09-10 15:28:57 -07:00
Aaron Patterson
13aa1e11a0 converting an inject to a map + Hash[] 2010-09-10 15:28:57 -07:00
Emilio Tagua
61bacc4ada Add more examples in performance script.
[#5610 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-09-10 13:15:13 -07:00
Jeremy Kemper
68a4b1eac9 Ruby 1.9 compat: convert Pathname to string 2010-09-10 12:16:56 -07:00
Jeremy Kemper
2a820f3d1f Include addressable for AR perf bench 2010-09-10 12:16:56 -07:00
Jeremy Kemper
be9831ceb1 Switch back to mysql for easier comparison 2010-09-10 12:16:56 -07:00
Aaron Patterson
a11dd8ac87 specific number of spaces should not be enforced 2010-09-10 11:51:32 -07:00
Xavier Noria
2e2ac863d8 append asset IDs to the examples of the RDoc of #javascript_include_tag, and quick edit pass 2010-09-10 20:12:00 +02:00
Aaron Patterson
a8b4bdb3d6 avoid method_missing and reduce method calls 2010-09-10 10:22:22 -07:00
Piotr Sarnacki
497b6af881 Set default asset_path only for engine 2010-09-10 17:20:16 +02:00
Marcelo Giorgi
a513f8f8bb intersection between a relation and an array works in both directions
Signed-off-by: Mikel Lindsaar <raasdnil@gmail.com>
2010-09-10 21:14:07 +10:00
kane
1c283765b6 added a test for relation which checks intersection between a relation and an array works in both directions
Signed-off-by: Mikel Lindsaar <raasdnil@gmail.com>
2010-09-10 21:13:57 +10:00
Raimonds Simanovskis
af2a011df2 fixed Subject model after_initialize callback for test_oracle_synonym test 2010-09-09 18:27:53 -07:00
Simon Jefford
7fae0aa4ac Add configuration option for tld length 2010-09-09 18:26:35 -07:00
Brian Cardarella
5949e705f4 Let YARD document the railties gem 2010-09-09 18:24:34 -07:00
wycats
74b49e87bb Simplify form_for by removing *args and extract_options! (at asakusa.rb) 2010-09-09 18:24:33 -07:00
Jeremy Kemper
e0e3adff03 Cheaper attribute reads and respond_to?. Add underscore-prefixed method aliased to the attribute name so it can be overridden but still called internally. 2010-09-09 14:39:43 -07:00
Jeremy Kemper
d79b1aa0ba Fewer object allocations 2010-09-09 14:37:58 -07:00
Jeremy Kemper
cb67d16629 Cheaper attribute_method_matchers 2010-09-09 14:37:58 -07:00
Jeremy Kemper
4b7b8d9e19 Cache unserialized attributes 2010-09-09 14:37:57 -07:00
Jeremy Kemper
cc81b04ae5 AR perf test: switch to mysql2, bundle faker and rbench 2010-09-09 14:34:47 -07:00
Jeremy Kemper
82ea5db030 Fix require for class_attribute 2010-09-09 14:34:29 -07:00
Emilio Tagua
53a90436cf Refactor finder conditions look up and assigment for apply_finder_conditions. 2010-09-09 13:45:49 -07:00
Emilio Tagua
90c114de67 Refactor Relation#only. No need to go through every option and test it. 2010-09-09 15:30:44 -03:00
Emilio Tagua
e3246ef5b5 Add tests for Relation#only. 2010-09-09 15:27:10 -03:00
Emilio Tagua
33412b6e16 No need to go through every option and test it, just don't add skipped ones. 2010-09-09 15:16:45 -03:00
Neeraj Singh
632120deb4 return is not needed here 2010-09-09 10:34:20 -07:00
Neeraj Singh
2f66b9a76c remove unnecessary call
if operation is count then column_name will never be blank
2010-09-09 10:33:52 -07:00
Aaron Patterson
be07d7b107 creating a new array is required. who knew? :-( 2010-09-09 10:33:22 -07:00
Aaron Patterson
a505c82d2f no need for Array.wrap, also avoid array creation 2010-09-09 09:44:01 -07:00
Neeraj Singh
d5c57f7c9f make apply_modules run faster 2010-09-09 09:35:40 -07:00
Mikel Lindsaar
d73b47fc22 Fixing up rails application init command - Rails Guides ticket 32 2010-09-09 23:08:01 +10:00
Mikel Lindsaar
1a8d77d825 Adding linkage to redirect_to from Base and adding status code option reference 2010-09-09 14:05:06 +10:00
Aaron Patterson
03377c755f eliminate present? for fewer method calls 2010-09-08 16:56:13 -07:00
Aaron Patterson
b4fdfcf6ad returning arrays lets us avoid Array.wrap 2010-09-08 16:53:17 -07:00
Aaron Patterson
588db0fa8f removing unnecessary conditional test 2010-09-08 16:38:54 -07:00
Aaron Patterson
0db345a39d switch to blank? to avoid method calls 2010-09-08 16:33:16 -07:00
Aaron Patterson
cb1f80591e refactor to use faster empty? 2010-09-08 16:06:48 -07:00
Aaron Patterson
4ccf491ec2 drying up joins() 2010-09-08 15:34:03 -07:00
Aaron Patterson
86384b3c4b reduce method calls, use reject + blank? instead of select + present? 2010-09-08 15:15:06 -07:00
Aaron Patterson
2faa8bbe11 refactor a couple injects to map + Hash[] 2010-09-08 14:02:47 -07:00
Aaron Patterson
c0c8a04efc avoid an inject in favor of dup 2010-09-08 13:55:30 -07:00
Piotr Sarnacki
36fcb776dd Fix warning by removing |map| from routes.draw 2010-09-08 19:28:00 +02:00
Piotr Sarnacki
6258f7c972 Change app to main_app in mounted_helpers 2010-09-08 19:27:59 +02:00
Piotr Sarnacki
18aee33335 Do not require passing :app to mounted helpers, it's actually useless and not DRY 2010-09-08 19:27:59 +02:00
Aaron Patterson
a5d894ce56 attributes should be constructed with table objects 2010-09-07 16:47:10 -07:00
Aaron Patterson
0c7a4daaa1 attributes should be associated with tables 2010-09-07 16:38:49 -07:00
Aaron Patterson
c6015cbcd8 serialized attributes should be serialized before validation [#5525 state:resolved] 2010-09-07 13:39:27 -07:00
Aaron Patterson
c8a2dd3cac no need to freeze this string 2010-09-07 13:13:13 -07:00
Jakub Suder
2524cf404c fixed some issues with JSON encoding
- as_json in ActiveModel should return a hash
  and handle :only/:except/:methods options
- Array and Hash should call as_json on their elements
- json methods should not modify options argument

[#5374 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-09-07 11:33:10 -07:00
Aaron Patterson
2e8a3d0f43 removing useless code, cleaning variable names 2010-09-07 11:28:01 -07:00
Aaron Patterson
604281221c select should raise error when no block or no parameter is passed 2010-09-07 10:48:14 -07:00
Aaron Patterson
d00f1c18eb select does not need a *args 2010-09-07 10:33:20 -07:00
ISHIKAWA Takayuki
816ea74c8e revision of typo: crytographically [#5566 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-07 11:03:37 -03:00
Santiago Pastorino
e8c7f1af0f unscoped has nothing so merging with a relation just returns the relation 2010-09-07 03:33:06 -03:00
Aaron Patterson
b541a963bd cleaning up confusing logic 2010-09-06 18:56:16 -07:00
David Trasbo
cfc8c7ab54 Wrap all occurences of <script> in a <tt> tag in docs [#5537 state:committed] 2010-09-06 18:22:33 +02:00
Piotr Sarnacki
32157a2dd2 Add documentation on serving assets from engine strategies
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-06 17:09:31 +02:00
Piotr Sarnacki
7c78cc3cca Use railties:copy_migrations instead of db:copy_migrations
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-06 14:38:45 +02:00
Piotr Sarnacki
ec6fa6d3ef Modified changelog for 3.1.0
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-06 14:38:41 +02:00
Piotr Sarnacki
24d2d6726e Added task for creating symlinks to engines' public directories
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-06 14:38:36 +02:00
Carlos Antonio da Silva
c915ddd386 Start cleanup of deprecations in ActionView
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-06 13:42:46 +02:00
Carlos Antonio da Silva
022fd876bb Cleanup Action Dispatch assertions tests
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-06 13:42:11 +02:00
Carlos Antonio da Silva
9532d746a9 Cleanup deprecations in Action Dispatch
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-06 13:41:12 +02:00
Carlos Antonio da Silva
11fccc5f06 Cleanup deprecation warnings in Action Controller
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-06 13:40:45 +02:00
Carlos Antonio da Silva
ed2650646e Refactor AR validations a bit
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-06 13:40:06 +02:00
Carlos Antonio da Silva
9b610049bb Cleanup deprecation warnings in active record
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-06 13:39:55 +02:00
Carlos Antonio da Silva
a18b73b43c Remove all deprecation warnings in activeresource
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-06 13:38:38 +02:00
Carlos Antonio da Silva
7204bb0feb Remove deprecation warnings in railties
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-06 13:38:12 +02:00
Pratik Naik
3bd3e992ff Improved indentation 2010-09-06 11:54:02 +01:00
Santiago Pastorino
0a7b481903 Use scoped here to get the scoped where 2010-09-05 20:30:43 -03:00
Carlos Antonio da Silva
c91605b15b Refactor a bit dependencies logging
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-05 18:14:47 +02:00
Carlos Antonio da Silva
9a776c2978 Improve dependencies by not calling constantize(const) twice while removing unloadable constants
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-05 18:14:47 +02:00
Carlos Antonio da Silva
69a4c67a3f Fix docs related to param_key in ActiveModel::Naming
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-05 18:14:37 +02:00
José Valim
8a3461b8c1 Remove a few tests from old router that do not make sense with the new one. 2010-09-05 15:59:35 +02:00
José Valim
9757bfff9b Merge remote branch 'drogus/remove_deprecated_routes'
This merge removes the deprecated routes mapper from Rails and update its tests.
2010-09-05 15:45:12 +02:00
Santiago Pastorino
e20012b64b Make number_to_human and number_with_precision work with negatives 2010-09-05 10:21:55 -03:00
Santiago Pastorino
d717ff9e52 Fix indentation errors 2010-09-05 10:07:37 -03:00
Santiago Pastorino
88dfe16d95 Fix code style a bit 2010-09-05 10:06:09 -03:00
Ben Sharpe
b80cf265be Fix number_to_human(0) exception [#5532 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-05 09:56:13 -03:00
Piotr Sarnacki
e909afccc9 Deleted test with extended regexp - it fails with no reason, probably rack-mount is doing something weird with that regexp 2010-09-05 13:44:39 +02:00
Łukasz Strzałkowski
5b550523b7 Fixed 2 broken tests for router.
They were broken after rebase/merge
2010-09-05 13:44:39 +02:00
Łukasz Strzałkowski
8f2c0bf1a0 This test is invalid for new router 2010-09-05 13:44:39 +02:00
Łukasz Strzałkowski
faba03850a Removed deprecated_mapper - we don't need it anymore 2010-09-05 13:44:39 +02:00
Łukasz Strzałkowski
eac8b9cf05 Removed tests for setting default value of *path in route
If we want to have this - we have to change Rack::Mount source
2010-09-05 13:44:38 +02:00
Łukasz Strzałkowski
b478ff9150 Made test_generate pass
I've removed assertions with @routes.generate(:use_route => ...). I'm not 100% sure if not supporting :use_route in new router is intentional or it should rather be supported and backported from 2.3.x.
2010-09-05 13:44:38 +02:00
Łukasz Strzałkowski
af72cf4799 If it's unused there's no reason to keep it commented. It will always remain in git history, so removing it. 2010-09-05 13:44:38 +02:00
Piotr Sarnacki
b7bfeaa9fc Fix action mailer tests after old mapper removal 2010-09-05 13:44:38 +02:00
Piotr Sarnacki
ca3936dbd6 Ported missing functionality from Rails 2.3.x, raise error on wrong regexps in :constraints in routes 2010-09-05 13:44:38 +02:00
Piotr Sarnacki
c15bb4901b Fixed routes to use new API in a few more actionpack tests 2010-09-05 13:44:37 +02:00
Łukasz Strzałkowski
442e54967c Removed rest of errors and failures in routing_test.rb. Almost all squashed, only few left 2010-09-05 13:44:37 +02:00
Piotr Sarnacki
3088b4f84f raise error on invalid HTTP methods or :head passed with :via in routes 2010-09-05 13:44:37 +02:00
Piotr Sarnacki
8958f332bb Implemented resources :foos, :except => :all option 2010-09-05 13:44:37 +02:00
Piotr Sarnacki
e6b93fa6db Removed deprecated router API from railties 2010-09-05 13:44:37 +02:00
Łukasz Strzałkowski
7c50454529 Test for recognizing routes with http method set 2010-09-05 13:44:37 +02:00
Łukasz Strzałkowski
8412886bdb Fixed about half of broken tests in routing_test 2010-09-05 13:44:37 +02:00
Piotr Sarnacki
415bacd7bf Fixed almost all resources tests 2010-09-05 13:44:36 +02:00
Łukasz Strzałkowski
8659c5e657 Fixed url_for test
Added route which matches all: controller, action, id and format
2010-09-05 13:44:36 +02:00
Łukasz Strzałkowski
aac390204a Revert "Extended default route for match in tests - now it matches controller, action, id and format if given."
This reverts commit 05e9d0df0dea68ca4655aa8723c3ee69049fac78.
2010-09-05 13:44:36 +02:00
Łukasz Strzałkowski
7ff8a2040e Extended default route for match in tests - now it matches controller, action, id and format if given.
This fixes url_for tests
2010-09-05 13:44:36 +02:00
Piotr Sarnacki
b3eb26a161 Removed deprecated RouteSet API, still many tests fail 2010-09-05 13:44:36 +02:00
Santiago Pastorino
708ee9c5ac Make scoped reorder override previous applied orders
[5528 state:committed]
2010-09-05 08:28:11 -03:00
Nick Ragaz
16e078d908 failing test for reorder overriding default_scope
[5528]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-05 08:27:51 -03:00
Neeraj Singh
91fec0d24d order should always be concatenated.
order that is declared first has highest priority in all cases.

Here are some examples.

Car.order('name desc').find(:first, :order => 'id').name

Car.named_scope_with_order.named_scope_with_another_order

Car.order('id DESC').scoping do
  Car.find(:first, :order => 'id asc')
end

No special treatment to with_scope or scoping.

Also note that if default_scope declares an order then the order
declared in default_scope has the highest priority unless
with_exclusive_scope is used.

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-05 08:13:42 -03:00
José Valim
f9c21ce658 Remove more deprecated behavior from plugins. 2010-09-04 01:11:22 +02:00
José Valim
6f194bb3a9 Small tidy up on Rails::Engine. 2010-09-04 00:52:07 +02:00
José Valim
23a9455962 This commit merges most of the work done by Piotr Sarnacki in his Ruby Summer of Code project.
His work brings several capabilities from app to engines, as routes, middleware stack, asset handling and much more. Please check Rails::Engine documentation for more refenrences.

Merge remote branch 'drogus/engines'
2010-09-04 00:31:43 +02:00
Piotr Sarnacki
c3c1a1e148 Do not use ActionController::Base.page_cache_extension in initialize to not load more ActiveSupport than we need 2010-09-04 00:07:38 +02:00
Piotr Sarnacki
9f0a1ae14e Optimize ActionDispatch::Static 2010-09-04 00:07:34 +02:00
Piotr Sarnacki
89bd715f6b Forgot to move that line to railtie on rebase 2010-09-03 22:59:16 +02:00
Piotr Sarnacki
ffa2acad5c Fixed tests after rebase 2010-09-03 22:59:16 +02:00
Piotr Sarnacki
9af189ac8f I've changed that test along the way, it should actually stay without changes 2010-09-03 22:59:16 +02:00
Piotr Sarnacki
6c906bf591 Use default_scope in isolated Engines to not force user to scope his routes 2010-09-03 22:59:15 +02:00
Piotr Sarnacki
b8d6dc3c84 Implemented RouteSet#default_scope, which allows to set the scope for the entire routes object 2010-09-03 22:59:15 +02:00
Piotr Sarnacki
b43b686b02 engines_blank_point should always be the last initializer in Engine 2010-09-03 22:59:15 +02:00
Piotr Sarnacki
a5e509d6b1 We should avoid creating additional initializers when we can, adding them makes boot process slower 2010-09-03 22:59:15 +02:00
Piotr Sarnacki
bf1ac82cec Add some documantation on new route_key and param_key in ActiveModel::Naming 2010-09-03 22:59:15 +02:00
Piotr Sarnacki
6f3119d3c2 Remove namespace for isolated namespaced models in forms 2010-09-03 22:59:15 +02:00
Piotr Sarnacki
2607def862 Use new ActiveModel::Naming.route_key in polymorphic_routes 2010-09-03 22:59:15 +02:00
Piotr Sarnacki
6e5aed057f Prepared ActiveModel::Naming to handle cases for namespaced isolated engines 2010-09-03 22:59:15 +02:00
Piotr Sarnacki
34cd8a68b1 Add some more docs on polymorphic_url with routes proxy 2010-09-03 22:59:14 +02:00
Piotr Sarnacki
706a3223a3 Add short note on using url_for instead of directly calling named route in polymorphic_url 2010-09-03 22:59:14 +02:00
Piotr Sarnacki
613cbe1f00 Add possibility to explicitly call engine's routes through polymorphic_routes, for example: polymorphic_url([blog, @post]) 2010-09-03 22:59:13 +02:00
Piotr Sarnacki
16dcaf8368 Updated tests to use scope(:module => :engine_name) instead of namespace and updated mounted engine tests to actually use the namespacing 2010-09-03 22:59:13 +02:00
Piotr Sarnacki
b1c66f060b Move RoutesProxy to separate file 2010-09-03 22:59:13 +02:00
Piotr Sarnacki
e35c2043b1 Include all helpers from non-namespaced engines 2010-09-03 22:59:13 +02:00
Piotr Sarnacki
98ab4ded37 Set only helpers_path on inherited hook in action_controller/railtie.rb and use helper(:all) just after that 2010-09-03 22:59:13 +02:00
Piotr Sarnacki
8ec2175aee Added more tests for polymorphic_url with namespaced models and implemented missing use cases 2010-09-03 22:59:13 +02:00
Piotr Sarnacki
00874a2009 This was used only to clear warning in ActionMailer tests, it shouldn't be done like that 2010-09-03 22:59:13 +02:00
Piotr Sarnacki
e5af8b7d85 Moved ActionMailer and ActionController railties options to inherited hook
This change is needed, because we must take namespace into account and if
controller's/mailer's class is namespaced, engine's paths should be set
instead of application's ones.

The nice side effect of this is removing unneeded logic in
ActionController::Base.inherited - now the helpers_path should be set
correctly even for engine's controllers, so helper(:all) will always
include correct helpers.
2010-09-03 22:59:12 +02:00
Piotr Sarnacki
8fb9df535e Modified polymorphic_url to check for model's namespace
This change allows using namespaced models with polymorphic_url,
in the way that you would use them without namespace.

Let's say that you have Blog::Post model in namespaced Engine. When you use
polymorphic_path with Blog::Post instances, like in form_for(@post),
it will look for blog_posts_path named url helper. As we are inside Blog::Engine,
it's annoying to always use the prefix. With this commit, blog_ prefix will be
removed and posts_path will be called.
2010-09-03 22:59:12 +02:00
Piotr Sarnacki
8284fd3855 Get rid of static_paths method and instead configure paths for ActionDispatch::Static in initializers 2010-09-03 22:59:12 +02:00
Piotr Sarnacki
d812677277 We don't need to clear action_methods on inherited hook as they are cleaned on method_added hook 2010-09-03 22:59:12 +02:00
Piotr Sarnacki
56ef192374 ActionMailer should not depend on ActionDispatch 2010-09-03 22:59:12 +02:00
Piotr Sarnacki
f3c703a32f Refactor RoutesProxy to avoid using _with_routes in helpers 2010-09-03 22:59:12 +02:00
Piotr Sarnacki
434139f89f Documented mounted helpers 2010-09-03 22:59:12 +02:00
Piotr Sarnacki
1a161c75ed Document engine_name 2010-09-03 22:59:11 +02:00
Piotr Sarnacki
2e4e1e7d0c Added documentation for namespaced Engine 2010-09-03 22:59:11 +02:00
Piotr Sarnacki
db8a864e69 Add table_name_prefix to Engine's namespace automatically 2010-09-03 22:59:11 +02:00
Piotr Sarnacki
a7c6fe4c2a Rename isolated_engine_for to namespace 2010-09-03 22:59:11 +02:00
Piotr Sarnacki
79bd92b783 Refactor ActionMailer to not use hide_actions 2010-09-03 22:59:11 +02:00
Piotr Sarnacki
4131a2d804 Move ActionController::Railties::RoutesHelpers and ActionMailer::Railties::RoutesHelper to AbstractController::Railties::RoutesHelpers 2010-09-03 22:59:11 +02:00
Piotr Sarnacki
32baa27892 Include routes helpers only for inherited classes in ActionMailer 2010-09-03 22:59:10 +02:00
Piotr Sarnacki
befa77fc18 Fix generating urls with mounted helpers in view context
There were actually 2 problems with this one:
* script_name was added to options as a string and then it was used
  in RouteSet#url_for with usage of <<, which was changing the original
  script_name
* the second issue was with _with_routes method. It was called in RoutesProxy
  to modify _routes in view_context, but url_helpers in views is just delegating
  it to controller, so another _with_routes call is needed there
2010-09-03 22:59:10 +02:00
Piotr Sarnacki
e063879daf Fix copying migrations to empty directory 2010-09-03 22:59:10 +02:00
Piotr Sarnacki
c7664d112f Include application's helpers and router helpers by default, but include engine's ones for controllers inside isolated namespace 2010-09-03 22:59:10 +02:00
Piotr Sarnacki
9913193931 For view_context we need to initialize RoutesProxy in context of controller, not view, quick fix, I need to dig into it later 2010-09-03 22:59:10 +02:00
Piotr Sarnacki
8fdeff0fa5 mounted helpers should be included in ActionMailer 2010-09-03 22:59:10 +02:00
Piotr Sarnacki
2734d3819f This is not needed 2010-09-03 22:59:10 +02:00
Piotr Sarnacki
937f41919c Engine's assets are now served with ActionDispatch::Static 2010-09-03 22:59:09 +02:00
Piotr Sarnacki
401cd97923 Modified ActionDispatch::Static to allow passing multiple roots 2010-09-03 22:59:09 +02:00
Piotr Sarnacki
5b6553ebb5 Set asset_path to engine_name by default 2010-09-03 22:59:09 +02:00
Piotr Sarnacki
559979b984 Always convert railtie_name to string 2010-09-03 22:59:09 +02:00
Piotr Sarnacki
43a2aef316 rake db:copy_migrations task, which copies railties migrations into application's db/migrate directory 2010-09-03 22:59:09 +02:00
Piotr Sarnacki
75f8ac6ea7 Implemented ActiveRecord::Migrations#copy based on James Adam's idea
ActiveRecord::Migration#copy allows to copy migrations from one place
to another, changing migrations versions and adding scope to filename.

For example:
ActiveRecord::Migration.copy("db/migrate",
        :blog_engine => "vendor/gems/blog/db/migrate")

will copy all migrations from vendor/gems/blog/db/migrate to db/migrate
with such format:

Versions of copied migrations will be reversioned to be appended after
migrations that already exists in db/migrate
2010-09-03 22:59:09 +02:00
Piotr Sarnacki
2068b8cb6a Added tests for railtie_name and aliased it in engine as engine_name 2010-09-03 22:59:09 +02:00
Piotr Sarnacki
bfccbc6df9 Add Rails::Railtie.railtie_name method to allow setting custom name for railtie 2010-09-03 22:59:08 +02:00
Piotr Sarnacki
b52dfc6726 Added Rails.application.config.paths.db.migrate to remove hardcoded db/migrate paths 2010-09-03 22:59:08 +02:00
Piotr Sarnacki
0c1cd15470 to_param shoul return a string 2010-09-03 22:59:08 +02:00
Piotr Sarnacki
4cd6f77526 We don't need delegating polymorphic_url and polymorphic_path anymore 2010-09-03 22:59:08 +02:00
Piotr Sarnacki
a132229d7b Added ability to set asset_path for engines 2010-09-03 22:59:08 +02:00
Piotr Sarnacki
abeb0ff2cc Ensure that Rails.application.initialize! is called only once 2010-09-03 22:59:07 +02:00
Piotr Sarnacki
153df92f9f Added documentation on endpoint, middeware stack and routes for Engine 2010-09-03 22:59:07 +02:00
Piotr Sarnacki
ccd422f792 We don't need that initializer in tests 2010-09-03 22:59:07 +02:00
Piotr Sarnacki
1e6612ef80 Ensure that url_helpers included after application's ones have higher priority 2010-09-03 22:59:07 +02:00
Piotr Sarnacki
6c95e0f879 Add mounted_helpers to routes
mounted_helpers are a bit similar to url_helpers. They're automatically
included in controllers for Rails.application and each of mounted
Engines. Mounted helper allows to call url_for and named helpers for
given application.

Given Blog::Engine mounted as blog_engine, there are 2 helpers defined:
app and blog_engine. You can call routes for app and engine using those
helpers:

app.root_url
app.url_for(:controller => "foo")
blog_engine.posts_path
blog_engine.url_for(@post)
2010-09-03 22:59:07 +02:00
Piotr Sarnacki
e9791bec82 Routes refactoring:
* added more tests for prefix generation
* fixed bug with generating host for both prefix and url
* refactored url_for method
* organized tests for prefix generation
2010-09-03 22:59:07 +02:00
Piotr Sarnacki
229a868264 Use new url_for API instead of including routes.url_helpers 2010-09-03 22:59:06 +02:00
Piotr Sarnacki
233be6572c Ensure that env is always available in controllers 2010-09-03 22:59:06 +02:00
Piotr Sarnacki
b53efd2105 Extended url_for to handle specifying which router should be used.
A few examples:
url_for Blog::Engine, :posts_path
url_for Blog::Engine, @post
url_for Blog::Engine, :action => "main", :controller => "index"
2010-09-03 22:59:06 +02:00
Piotr Sarnacki
b697ba9fd7 Added some more tests for url generation between Engine and Application 2010-09-03 22:59:06 +02:00
Piotr Sarnacki
8a077089d9 Get rid of :skip_prefix options in routes 2010-09-03 22:59:06 +02:00
Piotr Sarnacki
b1e5e233fa Refactored tests for prefix generation and added test for url generation in regular class with default_url_options[:script_name] set 2010-09-03 22:59:05 +02:00
Piotr Sarnacki
eedbf87d15 New way of generating urls for Application from Engine.
It's based specifying application's script_name with:
Rails.application.default_url_options = {:script_name => "/foo"}

default_url_options method is delegated to routes. If router
used to generate url differs from the router passed via env
it always overwrites :script_name with this value.
2010-09-03 22:59:05 +02:00
Piotr Sarnacki
177a4bd5b7 Fix url generation for mounted Engine
I added integration tests for generating urls in Engine and application
and tweaked Engines to fully cooparate with new router's behavior:
* Rails.application now sets ORIGINAL_SCRIPT_NAME
* Rails.application also sets its routes as env['action_dispatch.parent_routes']
* Engine implements responds_to? class method to respond to all the
  instance methods, like #routes
2010-09-03 22:59:05 +02:00
Piotr Sarnacki
451c9942bb Allow to generate Application routes inside Engine
This requires knowledge about original SCRIPT_NAME and
the parent router. It should be pass through the env
as ORIGIAL_SCRIPT_NAME and action_dispatch.parent_routes
2010-09-03 22:59:05 +02:00
Piotr Sarnacki
628b94fbc8 Pass routes via env['action_dispatch.routes'], it's needed by routes to determine if it should generate prefix for mounted apps 2010-09-03 22:59:05 +02:00
Piotr Sarnacki
28016d33b0 Use env['action_dispatch.routes'] to determine if we should generate prefix or not.
This technique is here to allow using routes from Engine in Application
and vice versa. When using Engine routes inside Application it should
generate prefix based on mount point. When using Engine routes inside
Engine it should use env['SCRIPT_NAME']. In any other case it should
generate prefix as env should not be even available.
2010-09-03 22:59:05 +02:00
Piotr Sarnacki
32a5b49911 Move singleton pattern to Railtie and remove Engine::Configurable and Application::Configurable in favor of unified Railtie::Configurable 2010-09-03 22:59:05 +02:00
Piotr Sarnacki
939d4255e6 Removed most of deprecated stuff from Application and Engine 2010-09-03 22:59:04 +02:00
Piotr Sarnacki
7cccfed594 Allow Engines loading its own environment file from config/environments 2010-09-03 22:59:04 +02:00
Piotr Sarnacki
15f95b98ac Ensure that plugins are not loaded twice 2010-09-03 22:59:04 +02:00
Piotr Sarnacki
efe9555cd7 We don't need to add railties initlaizers in Application as there is already done in Engine and it's called with super 2010-09-03 22:59:04 +02:00
Piotr Sarnacki
3939d6bb51 Removed ActionDispatch::Static, but left empty MiddlewareStack to unify app method between Engine and Application 2010-09-03 22:59:04 +02:00
Piotr Sarnacki
7d7263bf9d We don't need to overwrite default paths in tests 2010-09-03 22:59:04 +02:00
Piotr Sarnacki
e4bd7ed2fa Ensure that init.rb is evaled in context of Engine 2010-09-03 22:59:04 +02:00
Piotr Sarnacki
092b148b21 Engine can now serve files with ActionDispatch::Static 2010-09-03 22:59:04 +02:00
Piotr Sarnacki
c989d1a87d Engine sets routes as default rack endpoint if no endpoint was given 2010-09-03 22:59:04 +02:00
Piotr Sarnacki
b5975a4a30 Delegate non existing class methods to instance for Engine 2010-09-03 22:59:03 +02:00
Piotr Sarnacki
7c8f73d1bd Added TODO for evaling init.rb in context of Engine 2010-09-03 22:59:03 +02:00
Piotr Sarnacki
675f3ead41 Gather initializers from railties in engines to get rid of additional looping through initializers 2010-09-03 22:59:03 +02:00
Piotr Sarnacki
c787bfdf93 Engine can now load its own plugins 2010-09-03 22:59:03 +02:00
Piotr Sarnacki
ad6be08762 Made Engine valid rack app with its own middleware stack 2010-09-03 22:59:03 +02:00
Piotr Sarnacki
f7af75976a require 'active_support/dependencies' in action_dispatch/middleware/stack 2010-09-03 22:59:03 +02:00
Xavier Noria
63032c1162 too many people are looking for the 2.3 guides, put by now a link at the top of the home, and add the Rails version in the main header 2010-09-03 22:00:22 +02:00
Xavier Noria
93acbf6bf3 Merge remote branch 'docrails/master' 2010-09-03 21:30:22 +02:00
Ken Collins
d28438caf2 A few schema changes for the SQL Server adapter.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2010-09-03 14:57:16 +12:00
José Valim
599e46bf24 Revert "Setup explicit requires for files with exceptions. Removed them from autoloading."
Booting a new Rails application does not work after this commit [#5359 state:open]

This reverts commit 38a421b34d.
2010-09-02 21:11:03 +02:00
rohit
13d2a08164 Add two integration tests for GeneratedAttribute missing type error. [#5461 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-02 12:59:21 +02:00
rohit
d2fc5e2f65 Output a friendly message when no type given for GeneratedAttribute [#5461 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-02 12:59:21 +02:00
rohit
8ffa695cec Failing test for GeneratedAttribute [#5461 state:open]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-02 12:59:21 +02:00
Andreas Garnæs
1503e45e2e ActiveModel#to_xml fix (renamed parameter).
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-02 12:55:45 +02:00
José Valim
b8f3b262e0 Remove deprecated dispatch test. 2010-09-02 12:55:14 +02:00
José Valim
48bf667a8b Ensure routes are loaded only after the initialization process finishes, ensuring all configuration options were applied. 2010-09-02 12:54:21 +02:00
Łukasz Strzałkowski
38a421b34d Setup explicit requires for files with exceptions. Removed them from autoloading.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-02 11:54:04 +02:00
Łukasz Strzałkowski
c5c839f75f Cleaned up autoload definitions.
Now it's more transparent, and readable

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-02 11:53:58 +02:00
Thiago Pradi
df7f441c6e Removing RJS hack
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-02 11:51:07 +02:00
Thiago Pradi
7698596adb Removing unnecessary code from render_test
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-02 11:51:01 +02:00
Thiago Pradi
08187efa5b Removing unnecessary code
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-02 11:50:51 +02:00
Greg Hazel
3f49456f5b remove use of echo [#4410 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-02 11:50:38 +02:00
Akira Matsuda
4d9b2da5f3 "rails console t" must not load "production" but "test"
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-02 11:50:31 +02:00
Santiago Pastorino
920765c4c2 Add ruby-debug19 for mri 1.9 2010-09-01 21:24:33 -03:00
David Heinemeier Hansson
af03462b24 Dont need to spell out the dependency 2010-09-01 19:09:35 -05:00
David Heinemeier Hansson
278bc76ba6 Have sections for both Ruby 1.8.7 and 1.9.2 for the debugger since they use different gems 2010-09-01 17:39:06 -05:00
Andrew White
4e67bf26aa Reset default scope in Thread.current when class is unloaded [#5497 state:resolved]
Signed-off-by: Xavier Noria <fxn@hashref.com>
2010-09-01 22:32:41 +02:00
Andrew White
f1966337fa Add before_remove_const callback to ActiveSupport::Dependencies.remove_unloadable_constants!
Signed-off-by: Xavier Noria <fxn@hashref.com>
2010-09-01 22:32:41 +02:00
Andrew White
f8fb4651a7 Add missing lookup keys for error messages 2010-09-01 17:43:35 +01:00
Emilio Tagua
32e296b6ff Use new finders syntax in docs. 2010-09-01 12:16:08 -03:00
Emilio Tagua
2ce57fd0d9 Fix test: this should return 0 not 7, since Arel was ignoring select clause and now it's fixed.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-01 15:09:38 +02:00
Subba Rao Pasupuleti
0ae81a2124 Refactoring conditional logic
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-01 14:00:26 +02:00
Subba Rao Pasupuleti
2d74ed49f4 reader method eliminates defined? checks
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-01 13:59:53 +02:00
Andrew White
02480a897b Move implicit nested call before options handling so that nested constraints work [#5513 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-01 10:09:14 +02:00
Alex Chrome
dbf82557e4 Added :format option for form_for helper and spec for this [#5226 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-01 09:59:54 +02:00
Jack Dempsey
a79e985923 split out active_record migration logic so others can easily reuse [#5389 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-01 09:57:57 +02:00
Neeraj Singh
cacb44874f delegate method should treat :prefix => false same as :prefix => nil
[#5375 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-01 09:57:13 +02:00
yury
9a6e3ae763 Remove unnecessary code from UrlHelper#link_to.
convert_options_to_data_attributes always returns not nil stringified html_options [#5445 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-01 09:57:04 +02:00
Krekoten' Marjan
57693d1362 Make ActiveSupport::Duration#method_missing delegate blocks to value [#5498 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-01 09:56:54 +02:00
Subba Rao Pasupuleti
dba4efbd0e nested attributes tests should rely on associated objects to verify results not on assert_difference [#5206 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-01 09:56:48 +02:00
Thiago Pradi
46c14a6b03 Use join instead of looping and calling to_s [#5492 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-01 09:46:30 +02:00
Akira Matsuda
37e0c153de fix typo(?) 2010-09-01 16:00:55 +09:00
Andrew White
6c3f5eb76c Bump rack-mount to 0.6.13 and add test case for named character classes [#5509 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-08-31 21:16:21 -03:00
Xavier Noria
8b2e4fddbf Merge remote branch 'docrails/master' 2010-09-01 00:01:26 +02:00
Pratik Naik
db6190a022 Make all the Relation finder methods consistent 2010-08-31 22:25:28 +01:00
Pratik Naik
dce0cfae8b Merge remote branch 'miloops/rails_master_fixes' 2010-08-31 22:05:42 +01:00
Pratik Naik
7694b97ddf Remove default values for Relation#limit/offset/from/create_with 2010-08-31 21:56:21 +01:00
Emilio Tagua
c11eec8482 Avoid calling build_where is no argument is given. 2010-08-31 15:47:59 -03:00
Pratik Naik
c07f0ae52e Change relation merging to always append select, group and order values 2010-08-31 19:17:18 +01:00
Emilio Tagua
87e50f104a Improved conditionals usage to prevent calling methods. 2010-08-31 15:06:02 -03:00
Emilio Tagua
2431af1b7f Don't test conditional in iteration if it is not present just clone it. 2010-08-31 13:19:06 -03:00
Neeraj Singh
67a2b5ec1b If certain sections of skip_callback method are commented out then
no test was failing. Tests have been added to ensure that commenting
out the code within if loop would cause test failure.

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-31 17:45:06 +02:00
Neeraj Singh
d8db5714aa replacing superclass_delegating_accessor with class_attribute
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-31 17:45:06 +02:00
Neeraj Singh
a64cc69d61 Replacing superclass_delegating_accessoror with class_attribute.
:store_full_sti_class will have value true or false so there is no
danger of mutability here.

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-31 17:45:06 +02:00
Neeraj Singh
1620f572bf Replacing superclass_delegating_accessoror with class_attribute.
:partial_attributes will have value true or false so there is no
danger of mutability here.

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-31 17:45:06 +02:00
Neeraj Singh
8402488568 adding new test for ActiveModel::Serialization
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-31 17:45:03 +02:00
Santiago Pastorino
94b850c661 Bring back build to the initialization guide 2010-08-31 11:54:07 -03:00
Damien Mathieu
28474a7571 Fix benchmarking for rails3
* Fix the generated file examples
* Fix the generators commands
2010-08-31 13:39:08 +02:00
wycats
58d3b90423 Speed up form_for by specializing extract_options! (at asakusa.rb) 2010-08-31 20:33:28 +09:00
wycats
c05f24c824 Speed up content_tag_for by simplifying needed logic 2010-08-31 19:52:26 +09:00
Jaime Iniesta
c2ed4a9f88 Fix API docs for button_to options 2010-08-31 09:19:43 +02:00
Michael MacDonald
362371690f Corrected typo in example on rendering collections in partials changing @posts to @products to match the example 2010-08-31 11:01:05 +10:00
Pratik Naik
5076af5aa1 Fix an english fail 2010-08-31 00:16:31 +01:00
Pratik Naik
6d8fc26ce8 Fix the readonly section 2010-08-31 00:14:49 +01:00
Pratik Naik
5a310f8335 Update the section about joins 2010-08-31 00:01:41 +01:00
Pratik Naik
0bb32588b7 Fix pessimistic locking examples 2010-08-30 23:52:27 +01:00
Pratik Naik
9cd708b2cf Reword calculations section 2010-08-30 23:45:03 +01:00
Pratik Naik
d0720ad5f8 Reword the section about exists? 2010-08-30 23:45:03 +01:00
Pratik Naik
ceca3a0564 Improve example for having() 2010-08-30 23:45:03 +01:00
Pratik Naik
767eca4913 Remove {} from hash conditions. And more occurrences of [] in array conditions 2010-08-30 23:45:03 +01:00
Pratik Naik
1e554a1175 Array conditions dont need [] 2010-08-30 23:45:03 +01:00
Xavier Noria
3805d01c9b resolves merge conflict 2010-08-31 00:24:05 +02:00
Pratik Naik
c30f6c270d User.each is a lie 2010-08-30 23:05:14 +01:00
Joost Baaij
19d99971f7 Remove mention of InstantRails, it is completely obsolete.
Mention RubyInstaller instead which is actually quite pleasant and runs Rails fine.
2010-08-30 21:31:42 +02:00
Joost Baaij
49028f6112 Merge branch 'master' of github.com:lifo/docrails 2010-08-30 21:20:21 +02:00
Joost Baaij
66998c9662 Merge branch 'master' of github.com:lifo/docrails 2010-08-30 21:17:08 +02:00
Joost Baaij
7803bb015d Remove beta and RC paths in documentation 2010-08-30 21:16:53 +02:00
Xavier Noria
4c0d5d60f7 Revert "refer to guides since 3.0 is released now"
Reason: This is an exception. Thing is when you contribute to Rails you need to know how to proceed *now*, the instructions may be different than the ones published with some past release.

This reverts commit d1b239da4c.
2010-08-30 21:16:39 +02:00
Xavier Noria
e4c66d8fbf Revert "Revert "refer to guides since 3.0 is released now""
Wanted to revert a different commit with same message

This reverts commit 15d07981f6.
2010-08-30 21:14:29 +02:00
Xavier Noria
15d07981f6 Revert "refer to guides since 3.0 is released now"
Reason: This is an exception. Thing is when you contribute to Rails you need to know how to proceed *now*, the instructions may be different than the ones published with some past release.

This reverts commit 3d13dc88e2.
2010-08-30 21:08:54 +02:00
Joost Baaij
3d13dc88e2 refer to guides since 3.0 is released now 2010-08-30 21:03:07 +02:00
Joost Baaij
d1b239da4c refer to guides since 3.0 is released now 2010-08-30 21:00:24 +02:00
José Valim
d37a65307d Merge josevalim/deprecations branch.
I maintained on purpose the DeprecatedUrlOptions in ActionMailer and the Deprecated configuration in Railties because they were already addressed by Piotr in his RSoC work.
2010-08-30 15:55:10 -03:00
Damien Mathieu
414b68df1f fix the cache_fu links 2010-08-30 15:08:55 +02:00
Bryan Helmkamp
880f202591 Update README to match Rails 3 generated directory structure 2010-08-30 06:27:57 -04:00
Xavier Noria
b422cda2eb let String#strip_heredoc handle blank lines even if they are not indented 2010-08-30 10:39:34 +02:00
Akira Matsuda
db24aab624 The command for creating the sessions table has changed 2010-08-30 16:02:11 +09:00
Mikel Lindsaar
58d0e2c23c Adding option to ActiveResource to allow you to not reset the previously stored requests and responses by passing false to respond_to 2010-08-29 22:54:19 -07:00
Mikel Lindsaar
a299642293 Updating documentation on ActiveResource HTTP Mock and also adding test coverage 2010-08-29 22:54:19 -07:00
Jeremy Kemper
b861942691 Update CHANGELOGs for 3.0 release and upcoming 3.1 2010-08-29 22:06:48 -07:00
José Valim
3c8e1f99b9 Remove NonConcattingString. 2010-08-29 21:15:00 -03:00
José Valim
ba52748d05 Remove deprecated support to <% form_for %> and several ActionController::Base methods. 2010-08-29 21:08:14 -03:00
José Valim
800695ad4c Remove constants deprecation. 2010-08-29 20:48:32 -03:00
José Valim
f0ee4a6002 Remove deprecations in ActiveModel. 2010-08-29 20:45:34 -03:00
José Valim
972efa11fd Deprecate the old mailer API that was not deprecated yet. 2010-08-29 20:42:13 -03:00
Jeremy Kemper
ef572cad0a Bump arel to 1.0.1 2010-08-29 16:32:54 -07:00
José Valim
f5a43138d4 Remove the deprecated API from ActionMailer. 2010-08-29 19:57:51 -03:00
Loren Segal
01948fa8af Add .yardopts so YARD can document Rails 2010-08-30 06:59:36 +09:00
Xavier Noria
475ea14fd0 implements String#strip_heredoc 2010-08-29 23:52:38 +02:00
Xavier Noria
a302a333f8 revises a deprecation message 2010-08-29 22:47:18 +02:00
Santiago Pastorino
a70675cd94 -v=1.0.0 not needed 2010-08-29 16:53:20 -03:00
Santiago Pastorino
c1dbdecda5 Make CI install bundler stable since 1.0 is out 2010-08-29 16:19:44 -03:00
Santiago Pastorino
96c88db9f8 No more beta or rc on guides 2010-08-29 15:30:01 -03:00
David Heinemeier Hansson
e119aaecd6 Depend on Bundler 1.0 w/ tiny fixes 2010-08-29 13:25:52 -05:00
David Heinemeier Hansson
33afaa446f Depend on ARel 1.0 w/ tiny fixes 2010-08-29 13:25:45 -05:00
Sam Ruby
600cf8bebc Make rake routes gracefully handle routes with no name
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-08-29 14:38:29 -03:00
José Valim
82b700a89d Ensure we are not calling length on nil. 2010-08-28 22:54:42 -03:00
Santiago Pastorino
68a949bae7 PERF: Avoid two method calls 2010-08-28 21:35:20 -03:00
Jeremy Kemper
0d0c46abd1 Clean up CHANGELOGs 2010-08-28 15:45:14 -07:00
Mike Perham
390d285ef6 Support pluggable cache stores.
[#5486 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-08-28 15:43:10 -07:00
Joost Baaij
591e87fe7b Expanded routing documentation with current best practices 2010-08-29 00:04:14 +02:00
Joost Baaij
5ead15b075 Rework the routing documentation.
Move the default route to the bottom, as this practise should be discouraged.
Add documentation for resources, external redirects and Rack applications.
2010-08-28 23:24:02 +02:00
Jesse Storimer
730af48963 Ensure that inherited helper_methods are available after calling clear_helpers [#5348 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-28 18:07:01 -03:00
Fred Wu
83f4507cf1 Fixed the session name generated by the app_generator. Also refactored the corresponding test suites to be cleaner. [#5434 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-28 17:54:53 -03:00
yury
3e22e0b025 Micro optimization for build_named_route_call in PolymorphicRoutes:
1. use map instead of inject
2. use [].join("_") instead of '<<'. It is a little bit faster for ruby 1.9.2 and x2 faster for ruby 1.8.7. http://gist.github.com/548143

[#5450 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-28 17:54:50 -03:00
Thiago Pradi
ececa75c66 Fixing typo [#5485 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-28 17:51:22 -03:00
Santiago Pastorino
1851af84c1 password_field renders with nil value by default
This makes the use of passwords secure by default if you want to render
the value of the password_field you have to do for instance
f.password_field(:password, :value => @user.password) # =>
<input type=password id=user_password name=user[password]
value=#{@user.password} />
2010-08-28 05:23:34 -03:00
Santiago Pastorino
d630c76f3f type="password" for password_fields 2010-08-28 04:53:50 -03:00
Andrew White
5c2b6c55a0 Read the route name directly from the route instead of looking it up in the named routes hash
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-08-27 17:05:14 -07:00
Joost Baaij
4b14de72e1 The call-seq directive has no useful effect on our documentation and is not used anywhere else.
Worse still, its use breaks some rdoc, replacing method names with a curly brace.
Having just one call-seq directive doesn't add anything since this is covered by regular rdoc.
Having multiple might make sense, but these are already documented with examples.

This partly re-reverts 60de0e56b7 but does not
touch the vendorized code in html-scanner.
2010-08-28 00:50:50 +02:00
Xavier Noria
dda515fc26 Merge remote branch 'docrails/master' 2010-08-28 00:01:55 +02:00
Joost Baaij
279c395723 Use common terminology 2010-08-27 23:50:23 +02:00
Xavier Noria
27d42a56b9 Revert "call-seq directive makes rdoc cry and replaces method names with a curly brace; besides it doesn't add anything when you only list one call example since this is obviously documented already"
Reason: Part of this commit touches vendorized stuff, the rest is fine, could you please repatch?

This reverts commit 60de0e56b7.
2010-08-27 23:30:52 +02:00
Xavier Noria
3b62667e77 solves everything in guides raised by WARNINGS=1 (except for one which is abandoned atm) 2010-08-27 23:27:29 +02:00
Xavier Noria
df367adba1 adds a comment in cli.rb so that it is clear that exec_script_rails! performs an exec call 2010-08-27 23:27:29 +02:00
Joost Baaij
4a56f8f314 escape constants that should not be linked to 2010-08-27 22:47:11 +02:00
Joost Baaij
76c569344b mention the alert and notice accessors on the flash 2010-08-27 22:45:35 +02:00
Joost Baaij
9f4d3a1ebe expand cookie examples with signed and permanent methods 2010-08-27 22:31:02 +02:00
Joost Baaij
60de0e56b7 call-seq directive makes rdoc cry and replaces method names with a curly brace; besides it doesn't add anything when you only list one call example since this is obviously documented already 2010-08-27 22:20:53 +02:00
Sam Aarons
04a8601d5e Fix em_mysql2 error in rake db:create
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-27 14:57:16 -03:00
José Valim
d0e067f61b Add missing require. 2010-08-27 14:56:58 -03:00
Santiago Pastorino
f95ba5c262 Make InstanceTagMethods#value_before_type_cast raise if the model don't respond to attr_before_type_cast or attr method
[#3374] [#5471 state:committed]
2010-08-27 09:08:04 -03:00
Jeremy Kemper
f98694b624 Ruby 1.9: be sure to explicitly reference toplevel constants within BasicObject deprecation proxies 2010-08-26 23:17:03 -07:00
Łukasz Strzałkowski
1ac20839a7 Fixed broken test suite - there was problem with namespacing in DeprecatedConstant class 2010-08-26 23:15:42 -07:00
wycats
8baba5f13e Fix a subtle bug involving RAILS_ROOT 2010-08-26 23:15:31 -07:00
wycats
dbb547a056 Fix up constant deprecation to be less dependent on load order 2010-08-26 23:11:52 -07:00
Carlos Antonio da Silva
0aefbe52a0 Removing some unuseful begin/end and refactor prompt_option_tag a bit
[#5469 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-08-27 01:18:42 -03:00
Jamison Dance
6398eba240 Merge branch 'master' of github.com:lifo/docrails 2010-08-26 21:20:22 -06:00
Jamison Dance
4d8158d9e5 fix sentence fragment in validates_associated caution 2010-08-26 17:48:42 -06:00
Xavier Noria
27edd3f8bc updates de title of the generators guide in the home and index 2010-08-27 00:17:04 +02:00
Xavier Noria
90a95be252 getting started guide: adds a reference to Michael Hartl's free online book in the what's next section 2010-08-26 23:49:06 +02:00
José Valim
625f7b5a5b Be sure to call helper :all just on direct children. (Tests by Jesse Storimer) 2010-08-26 18:20:22 -03:00
José Valim
737abf25bb Doh, be sure to store the string modification. 2010-08-26 18:20:14 -03:00
Joost Baaij
6eed7b36a2 escape constant names 2010-08-26 23:10:00 +02:00
Joost Baaij
c28d46a92d Reflect how CSRF protection now works and refer to the Security Guide for more information 2010-08-26 23:03:30 +02:00
Joost Baaij
ca36326706 cleanup of ActionController::Metal inline documentation 2010-08-26 22:32:40 +02:00
Joost Baaij
930102968a Escape 'caching' when used in a sentence; remove unnessesary quotes 2010-08-26 21:58:57 +02:00
Joost Baaij
d3bc97050a Merge branch 'master' of github.com:lifo/docrails 2010-08-26 21:33:35 +02:00
Joost Baaij
80ae74dea7 Prevent any warnings from being printed during RDoc generation 2010-08-26 21:31:32 +02:00
James Miller
0631bf4baf Simplify render :partial 2010-08-26 12:27:44 -07:00
José Valim
818858ac1d Do not modify frozen strings in place. 2010-08-26 16:25:53 -03:00
James Miller
2bcac56ab4 Prefer modern idiom for rendering partials on a collection 2010-08-26 12:10:21 -07:00
José Valim
ca1f3a5596 Update CHANGELOG. 2010-08-26 16:07:54 -03:00
José Valim
66ef92272c Add clear_helpers as a way to clean up all helpers added to this controller, maintaing just the helper with the same name as the controller. 2010-08-26 16:07:54 -03:00
José Valim
84cab320bc Ensure templates like template.html are found but still uses the proper virtual path. 2010-08-26 16:07:54 -03:00
James Miller
a88fb2fd1b Getting started guide: typo 2010-08-26 10:00:11 -07:00
James Miller
8e3d23dea2 Link to gembundler.com instead of Github repo 2010-08-26 09:55:18 -07:00
Xavier Noria
68ba59fdbd Merge remote branch 'rails/master' 2010-08-26 17:38:53 +02:00
Xavier Noria
d728f08580 getting started guide: revises text wrt bundler 2010-08-26 15:58:19 +02:00
Xavier Noria
5e0b70e6b5 revises a few link texts 2010-08-26 15:54:53 +02:00
Xavier Noria
c1b5e2a2d5 Merge remote branch 'rails/master' 2010-08-26 14:26:42 +02:00
Jaime Iniesta
e72406e2ba change 'a SQL' to 'an SQL' as suggested by the api documentation guidelines 2010-08-26 14:23:58 +02:00
Jaime Iniesta
5430f5bd06 lifecycle should be two words, life cycle 2010-08-26 14:23:58 +02:00
Jaime Iniesta
d9f6e16937 Fix capture_helper.rb api documentation, unescaped script tag was breaking it on the content_for explanation 2010-08-26 14:23:58 +02:00
Jaime Iniesta
0f9eedf6de change 'a SQL' to 'an SQL' as suggested by the api documentation guidelines 2010-08-26 10:16:08 +02:00
Jaime Iniesta
fa1ba5bd5b lifecycle should be two words, life cycle 2010-08-26 09:55:26 +02:00
Jaime Iniesta
5e73ab0936 Fix capture_helper.rb api documentation, unescaped script tag was breaking it on the content_for explanation 2010-08-26 09:01:59 +02:00
Xavier Noria
5dd92726a9 Merge remote branch 'docrails/master' 2010-08-26 01:59:31 +02:00
Xavier Noria
366e0fbd8d Revert "to_json => as_json"
This reverts commit 7a6d8e4ad4.

Reason: The method that gives you a Ruby string with JSON source code is #to_json
2010-08-26 01:56:56 +02:00
Xavier Noria
cd0267cd33 adds missing require for #parameterize 2010-08-26 01:56:10 +02:00
Xavier Noria
fa8e17b5c2 Merge remote branch 'docrails/master' 2010-08-26 01:39:16 +02:00
Aleksander Pohl
ee7507b38e - Fix non-ascii characters in headers
Signed-off-by: Xavier Noria <fxn@hashref.com>
2010-08-26 01:05:52 +02:00
James Miller
4b07bc8475 to_json => as_json 2010-08-25 15:23:21 -07:00
James Miller
7a6d8e4ad4 to_json => as_json 2010-08-25 14:55:24 -07:00
James Miller
26961bc836 Merge branch 'master' of github.com:lifo/docrails 2010-08-25 14:42:53 -07:00
James Miller
6e3c339ebe mysql2 is now the default, typos 2010-08-25 14:42:11 -07:00
James Miller
9be59e49bf Fix typo, favour => favor 2010-08-25 14:36:10 -07:00
Joost Baaij
a68919ec84 Restored top-level documentation for ActionController::Base.
This information was lost in commit bd6b61be88.
This might have been intentional, but this class does represent the starting
point for all things related to actions, and as such should document it.

I couldn't find any trace of this documentation, which seems like a waste.
Updated parts here and there to conform to current best practices.
2010-08-25 23:28:56 +02:00
Xavier Noria
d2f55e7eee AS guide: Array.wrap vs splat is only valid for 1.8 2010-08-25 20:30:06 +02:00
Joost Baaij
e9eaae1a05 fixed capitalization 2010-08-25 19:51:20 +02:00
Joost Baaij
eaeda503e8 change rdoc to conform to api guidelines 2010-08-25 18:57:27 +02:00
Andrew White
1fbb0684d2 Catch mysql2 access denied errors in rake db:create [#5432 state:resolved]
Signed-off-by: Xavier Noria <fxn@hashref.com>
2010-08-25 18:06:55 +02:00
Joost Baaij
111c4a4a01 remove unwanted linebreak 2010-08-25 17:20:55 +02:00
Rémy Coutable
43532f6b25 Restore consistency with the rest of the doc. 2010-08-25 15:55:53 +02:00
Rémy Coutable
58e2fa3695 Fixed a missing simple quote. 2010-08-25 15:52:43 +02:00
Aaron Patterson
ffdda4ddfb use blank? instead of present?, mark SQL literals as SQL literals
Conflicts:

	activerecord/lib/active_record/relation/query_methods.rb
2010-08-25 05:17:49 -07:00
Aaron Patterson
b28cafe01a no need to send on a public method 2010-08-25 05:17:49 -07:00
Aaron Patterson
ce7c2f72f4 refactor select { is_a? } to grep() 2010-08-25 05:17:49 -07:00
Aaron Patterson
e1e7122271 mark SQL literals as SQL literals 2010-08-25 05:17:49 -07:00
Neeraj Singh
4e40f00565 minor formatting fixes 2010-08-25 07:39:47 -04:00
Jakub Suder
4f945e97e5 better callstack reporting in deprecation messages
now the reported line is the first line in the stack
that's outside Rails, which is the one that actually
caused the problem in the first place

[#5231 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-25 07:23:50 -03:00
Andrew White
0b9357d401 Remove rails info route from rake routes output [#5452 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-25 07:22:20 -03:00
Mikel Lindsaar
c1b49f1e18 Make ActiveResource::InvalidRequestError more user friendly
Signed-off-by: Xavier Noria <fxn@hashref.com>
2010-08-25 10:00:37 +02:00
Andrew White
1847d33b4b Use nested scope for routes defined at the :resources scope level (as in Rails 2.3)
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-24 21:15:13 -03:00
Xavier Noria
3ac6646d6f :nodoc:s #unscoped until its behavior is more clear, now sometimes works, sometimes not 2010-08-25 01:05:51 +02:00
Xavier Noria
a820bd9df6 edit pass to a recent doc patch 2010-08-25 00:22:53 +02:00
Xavier Noria
036f090df1 Merge remote branch 'docrails/master' 2010-08-25 00:17:02 +02:00
José Valim
80e1f730a2 Allow format to be skipped. This is used internally by mount. 2010-08-24 16:58:32 -03:00
José Valim
e197d6f34b Finally fix the bug where symbols and strings were not having the same behavior in the router.
If you were using symbols before for methods like match/get/post/put/delete, it is likely that this commit will break your routes.
Everything should behave the same if you are using strings, if not, please open up a ticket.
2010-08-24 16:58:25 -03:00
José Valim
4a90ecb3ad Ensure shortcuts inside resources also generates helpers. 2010-08-24 16:58:12 -03:00
José Valim
edba51cf33 Hide internal apps from rake routes [#5443 state:resolved] 2010-08-24 13:22:48 -03:00
Andrew White
1a6c81c4f9 Revert "Use symbols when specifying custom resource actions"
This reverts commit 02aabbd19e.
2010-08-24 17:12:02 +01:00
José Valim
2916521da8 Fix how routes inside namespaces are generated. 2010-08-24 13:05:29 -03:00
Santiago Pastorino
4df19b3f27 Allow actions which start with A-Za-z_ only 2010-08-24 12:43:43 -03:00
Aaron Suggs
3519d61af9 Bump rake dependency to 0.8.4. [#5279 state:resolved]
This rake version adds the Rake::RDocTask#rdoc_task_name method, used in
railties/lib/rails/tasks/documentation.rake

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-24 11:57:30 -03:00
Neeraj Singh
747e0744dd @user.touch should not fail if User does not have updated_at/updated_on column.
[#5439 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-24 11:24:32 -03:00
Andrew White
11f6179f55 Reset symbolized path parameters when a test request is recycled [#5437 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-24 11:24:32 -03:00
José Valim
542878304d Ensure prefix in routes are generated properly. 2010-08-24 11:24:31 -03:00
Neeraj Singh
f460de1d23 touch operationg if used along with belongs_to will also be invoked on associated objects 2010-08-24 10:21:58 -04:00
Joost Baaij
20333be581 fix broken relative links [#5415 state:committed]
Signed-off-by: Xavier Noria <fxn@hashref.com>
2010-08-24 16:20:32 +02:00
José Valim
6ef60bd9ff Ensure timestamps are not generated when explicitly set to false [#5440 state:resolved] 2010-08-24 10:45:16 -03:00
Wincent Colaiuta
7d71b785a9 Add test case for ActiveRecord::Base.record_timestamps = false
This is a failing test case for Lighthouse ticket #5440:

  https://rails.lighthouseapp.com/projects/8994/tickets/5440

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-24 10:32:45 -03:00
José Valim
b4f304b7b6 Fix a bug where symbols and strings were not behaving the same in the router. [#5431 state:resolved] 2010-08-24 10:26:25 -03:00
Andrew White
2fb0cbec02 When custom resource actions are specified using strings add the default name and action if the string is a valid ruby method name.
[#5431 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-24 10:26:25 -03:00
Krekoten' Marjan
a0284791df Fix test of generated Gemfile with mysql selected as DB driver
[#5435 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-08-24 09:38:20 -03:00
Andrew White
02aabbd19e Use symbols when specifying custom resource actions 2010-08-24 07:06:53 +01:00
Trevor Turk
cbacc9700e Note about how to exit the console in the Getting Started guide 2010-08-24 00:13:33 -05:00
David Heinemeier Hansson
21b1f29720 Master is now targeting 3.1.0.beta 2010-08-23 21:44:57 -05:00
David Heinemeier Hansson
96f3bcb816 Master is now targeting 3.1.0.beta 2010-08-23 21:43:47 -05:00
David Heinemeier Hansson
0d657132b0 mysql db defaults to mysql2 gem 2010-08-23 21:41:16 -05:00
David Heinemeier Hansson
3409f2c691 Depend on latest arel RC 2010-08-23 21:27:41 -05:00
Santiago Pastorino
363fe5faf9 Point guides to bundler 1.0.0.rc.6 2010-08-23 23:26:25 -03:00
David Heinemeier Hansson
b983145dfc Depend on latest Bundler RC 2010-08-23 21:24:22 -05:00
David Heinemeier Hansson
eb873f7133 Prefer the mysql2 gem for MySQL database.ymls 2010-08-23 21:19:53 -05:00
Santiago Pastorino
bb75c33754 Config is deprecated on 1.8.8 and 1.9.3 use RbConfig 2010-08-23 23:10:36 -03:00
Aaron Patterson
6f4d100761 marking sql literals as sql literals 2010-08-23 18:48:29 -07:00
Aaron Patterson
ecbdec115b making variable names a little more clear 2010-08-23 18:48:28 -07:00
José Valim
b6e28cea8c Update CHANGELOG for ActionPack. 2010-08-23 21:54:19 -03:00
Aaron Patterson
2e8e6e581f we should mark sql strings as sql literals 2010-08-23 14:28:15 -07:00
Aaron Patterson
5931a1dbd3 sql literal strings should be marked as sql literal strings 2010-08-23 13:57:22 -07:00
Aaron Patterson
ee9e1570be we should mark strings as SQL Literal values 2010-08-23 13:30:12 -07:00
Brian Lopez
6d796a71d2 mysql2 adapter is being maintained in the mysql2 gem itself
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-08-23 15:59:51 -03:00
Brian Lopez
bde3d7fbaf no need to depend on mysql2 master anymore
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-08-23 15:50:26 -03:00
Raimonds Simanovskis
2fc29524e1 use database from ARUNIT_DB_NAME environment variable when running tests on Oracle 2010-08-23 10:50:21 -07:00
Neeraj Singh
13ebf69ae4 unscoped does not work when chained with named_scope 2010-08-23 05:45:11 -04:00
Xavier Noria
3538dc0d7a removes words moved in previous edit of the generator generator USAGE 2010-08-23 09:44:56 +02:00
Xavier Noria
d0858cdf0e generators guide: edit pass 2010-08-23 09:40:37 +02:00
Xavier Noria
28c8d17d28 adds USAGE to the generator generator USAGE (not sure this meta thing is any good at 8:12 AM with little coffee) 2010-08-23 09:40:27 +02:00
Aaron Patterson
cdef4450e5 removing unused code 2010-08-22 17:15:56 -07:00
Raimonds Simanovskis
8f171b4d69 Do not use time zone in test_read_attributes_before_type_cast_on_datetime for Oracle database
As currently string_to_time method is not doing time zone conversion to database time zone
2010-08-22 16:35:55 -07:00
Raimonds Simanovskis
f82b1e756a updated test_should_record_timestamp_for_join_table for Oracle 2010-08-22 16:35:48 -07:00
Santiago Pastorino
04ee54f3fc Bump up rack-mount to 0.6.12 2010-08-22 20:28:37 -03:00
Xavier Noria
b587bfd589 Merge remote branch 'rails/master' 2010-08-23 01:21:43 +02:00
Santiago Pastorino
9992a1a4bf type fixed 2010-08-22 19:59:36 -03:00
Santiago Pastorino
8d1ee434da Silence warnings for Encoding.default_external= and Encoding.default_internal= 2010-08-22 18:43:31 -03:00
Andrew White
ae2c60734a Cache the symbolized path parameters using a instance variable in the request object rather than the environment hash. This it to prevent stale parameters in later routing constraints/redirects as only the normal path parameters are set by Rack::Mount.
Also if a constraint proc arity is more than one, pass the symbolized path parameters
as the first argument to match redirect proc args and provide easier access.

[#5157 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-22 16:17:26 -03:00
Santiago Pastorino
d79a010976 Set default_internal and default_external on AS for testing purposes 2010-08-22 02:23:41 -03:00
Santiago Pastorino
3c0158955a Set default_internal and default_external on AM for testing purposes 2010-08-21 22:53:04 -03:00
Santiago Pastorino
1d888d465b Move encoding settings for testing purposes to abstract_unit file 2010-08-21 22:37:53 -03:00
Raphomet
7a090b0216 Trifling typos
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-08-21 19:20:42 -03:00
Evgeniy Dolzhenko
c0549ed2e5 Fix docs to reference ActiveRecord::LogSubscriber
since Rails::LogSubscriber doesn't seem to be defined anymore
2010-08-21 09:39:37 +04:00
Brian Lopez
82e389ed30 reload bob after his journy to a new timezone 2010-08-20 20:00:03 -07:00
Jeremy Kemper
c211d904ba Revert "Just add connection management middleware if running in a concurrent environment."
This reverts commit 6b29dc876f.
2010-08-20 18:55:02 -07:00
Xavier Noria
3cd9627bd8 prevent RDoc from autolinking "Rails" in the API home page 2010-08-21 02:25:45 +02:00
Xavier Noria
63bb639036 requires horo 1.0.2 2010-08-21 02:25:45 +02:00
Nick Sieger
2277c51555 Fix hash modification during iteration in Mapper [#5420]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-08-20 18:27:02 -03:00
Andrew White
7c9bf45b0d Support routing constraints in functional tests
Extend assert_recognizes and assert_generates to support passing
full urls as the path argument. This allows testing of routing
constraints such as subdomain and host within functional tests.

[#5005 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-20 14:51:25 -03:00
Aaron Patterson
0420fb5647 adding FOUND_ROWS to the connect flags for mysql2 2010-08-20 10:16:22 -07:00
Xavier Noria
0c75ec51a9 Merge remote branch 'rails/master' 2010-08-20 17:18:57 +02:00
Neeraj Singh
87398e531d Patch for Lighthouse ticket #5419 has been been applied. So reverting this one.
Revert "documentation regarding after_validation"

This reverts commit c24aa2f2dc.
2010-08-20 11:08:25 -04:00
Neeraj Singh
2ffa50f5a9 after_validation should be called irrespective of the result of validation.
I confirmed that this is the behavior on 2.3.x .

[5419 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-20 11:24:43 -03:00
Neeraj Singh
c24aa2f2dc documentation regarding after_validation 2010-08-20 09:48:07 -04:00
Andrew White
0d0fbf1e64 Don't add the standard https port when using redirect in routes.rb and ensure that request.scheme returns https when using a reverse proxy.
[#5408 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-20 10:40:34 -03:00
Andrew White
771d2f918f Allow symbols for :path resource(s) option [#5306 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-20 09:32:48 -03:00
Xavier Noria
43291469cb deletes the rdoc task of each component, they are no longer published separately 2010-08-20 13:30:31 +02:00
Xavier Noria
f6222ead47 the pdoc task is no longer needed 2010-08-20 13:14:57 +02:00
Aaron Patterson
949c7e2d0e fisting after_rollback and after commit callbacks 2010-08-20 00:06:49 -07:00
Santiago Pastorino
b91dcb63d0 Bump up tzinfo to 0.3.23 2010-08-20 02:39:09 -03:00
Aaron Patterson
bfd8be7fab updates return number of rows matched rather than number of rows affected 2010-08-19 19:13:50 -07:00
Andrew White
0b73f2af0e Optimize find_sti_class when store_full_sti_class is true
[#5403]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-08-19 16:03:15 -05:00
Trevor Turk
99c092d4e8 Note about validates_presence_of and nested attributes 2010-08-19 14:49:10 -05:00
Trevor Turk
e6b6d3adad Note about using attr_accessible with nested attributes 2010-08-19 14:25:15 -05:00
José Valim
de0f47afb2 Use attribute readers as they are faster in general. 2010-08-19 15:16:11 -03:00
Andrew White
c019db8ca1 Move regexps in options hash to :constraints hash so that they are pushed into the scope [#5208 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-19 15:05:57 -03:00
Andrew White
0cc483aa14 Move edit route before show route so that it will have precedence if the :id parameter allows slashes [#5409 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-19 15:05:33 -03:00
Neeraj Singh
2e45542942 While creating a new record using has_many create method default scope of child should be respected.
author.posts.create should take into account default_scope
defined on post.

[#3939: state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-19 14:52:15 -03:00
Santiago Pastorino
43f44c1a03 Bump up rack-mount to 0.6.10 2010-08-19 14:49:16 -03:00
Aaron Patterson
a4458f5d21 removing useless ternary 2010-08-19 10:46:10 -07:00
Aaron Patterson
a70248c3d8 we should wrap strings as sql literals 2010-08-19 10:35:09 -07:00
Santiago Pastorino
57d5cd258e We need bundle update only here 2010-08-19 14:04:29 -03:00
Jeremy Kemper
d3e30a18b2 Memoize STI class lookups for the duration of a request 2010-08-19 11:07:09 -05:00
Aaron Patterson
072cd60379 refactor if / else to ||= 2010-08-18 23:37:37 -07:00
Xavier Noria
5a1d957dce avoids warnings about mismatched indentations in Ruby 1.9.2 2010-08-19 03:44:55 +02:00
Xavier Noria
5914875e77 now for real, the suite loads everything and these went unpatched 2010-08-19 02:57:10 +02:00
Xavier Noria
eab4860e9b avoids a ton o warnings activesupport/lib/active_support/dependencies.rb:239: warning: loading in progress, circular require considered harmful ... activesupport/lib/active_support/core_ext/hash/indifferent_access.rb while running the suite in Ruby 1.9.2 2010-08-19 02:46:42 +02:00
Xavier Noria
c510f05967 get rid of the warning "+ after local variable is interpreted as binary operator even though it seems like unary operator" in Ruby 1.9.2 2010-08-19 02:08:28 +02:00
wycats
483b60b9ff Revert "It's snowing!"
This reverts commit e4283007d6.
2010-08-18 16:49:06 -07:00
Aaron Patterson
e4f424d577 refactoring to remove duplicate logic 2010-08-18 12:10:48 -07:00
Aaron Patterson
93f335b6fb call to present? is not necessary 2010-08-18 11:51:59 -07:00
Javier Martín
3e871eee80 Don't pluralize resource methods [#4704 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-08-18 13:56:46 -03:00
Santiago Pastorino
cad8bef5ea Bump up rdoc to 2.5.10 2010-08-18 11:44:12 -03:00
Carlos Antonio da Silva
0dfb8ff347 Use COALESCE in update_counters docs to reflect the implementation 2010-08-18 10:15:26 -03:00
Neeraj Singh
7d0b69d916 correcting the documentation which wrongly states that rails/init.rb file of a gem is loaded 2010-08-18 00:08:00 -04:00
Neeraj Singh
2a4eb69ff4 fixing typo 2010-08-17 21:29:37 -04:00
Aaron Patterson
a197d1c874 run the AS tests in verbose mode 2010-08-17 17:21:52 -07:00
wycats
c6db3486c3 1.8 block variable shadowing strikes again 2010-08-17 16:51:35 -07:00
wycats
dbe08026e1 Sadly, this segv's in 1.8 :( 2010-08-17 16:51:35 -07:00
Andre Arko
fca617af14 Allow member actions (get, etc) to accept strings, with test 2010-08-17 20:41:13 -03:00
Xavier Noria
a0ca3d1067 Merge remote branch 'docrails/master' 2010-08-18 00:25:32 +02:00
Xavier Noria
23f6e51b69 commit review: now that there are two supported, just mention them 2010-08-18 00:16:39 +02:00
Xavier Noria
ea2ad26a8d you rarely want ^ or $ in validations, use \A when you mean \A 2010-08-18 00:15:01 +02:00
Matthew Mongeau
dd55830bb2 to_sentence should return a duplicate 2010-08-17 13:52:37 -07:00
Jeff Lawson
c017041e68 Bug Fix -- clean up connection after stored procedure [#3151 state:resolved] 2010-08-17 13:16:03 -07:00
Jeff Lawson
7ce1539934 Bug Fix -- clean up connection after stored procedure [#3151 state:resolved] 2010-08-17 13:15:58 -07:00
Sunny Ripert
c924068714 Testing Guide: rake test:uncommitted now supports git 2010-08-17 21:49:40 +02:00
Trey Bean
bee414748c Missing object for comparison in ActiveModel::EachValidator example code. 2010-08-17 12:51:13 -06:00
Xavier Noria
137e4e759a Merge remote branch 'docrails/master' 2010-08-17 13:28:33 +02:00
Xavier Noria
285690143e debugging guide: revises the section on debugging RJS 2010-08-17 13:19:00 +02:00
Luke Brown
95ecc08a30 Added an example and explaination for using an optional path scope for the locale 2010-08-17 09:48:12 +01:00
Josiah Ivey
9a665aa6d2 Debugging Guide: Highlight using config over ActionView::Base 2010-08-16 21:32:08 -05:00
Santiago Pastorino
f1b33f7f22 Restore pet -> owner relationship to the previous state
[#5365]
2010-08-16 22:46:55 -03:00
Mark Turner
6177a0be96 added testcase for belongs_to with a counter_cache and touch
[#5365 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-08-16 22:41:12 -03:00
Peter Wagenet
ad53b68457 Class Attribute setter returns set value
Signed-off-by: wycats <wycats@gmail.com>
2010-08-16 18:36:12 -07:00
Xavier Noria
fb6b805620 code gardening: we have assert_(nil|blank|present), more concise, with better default failure messages - let's use them 2010-08-17 03:32:11 +02:00
Xavier Noria
d14e2987b5 the (public) routing DSL does not accept symbols for get|post|put|delete|match 2010-08-17 02:37:28 +02:00
Raimonds Simanovskis
c7dd49eb2a Replaced hardcoded SessionStore table creation SQL with calls to ActiveRecord adapter migration methods
Otherwise hardcoded table creation SQL was failing on Oracle database
2010-08-16 15:21:58 -07:00
Raimonds Simanovskis
4e3d220da3 added dependencies in Gemfile for running ActiveRecord tests with Oracle database 2010-08-16 15:21:54 -07:00
Santiago Pastorino
8010e4f476 assert_equal here 2010-08-16 19:09:23 -03:00
José Valim
6e41cfb4e9 annoted_source_code may return nil if an error happens during template compiling. 2010-08-16 14:11:42 -03:00
Josiah Ivey
2a55edc725 Debugging Guide: Improve grammar for the RJS section 2010-08-16 05:25:40 -05:00
wycats
aaec007292 Make sure apps upgrading from 2.3 get defaulted to UTF-8 (ht: parndt) 2010-08-15 16:31:24 -07:00
Xavier Noria
a1fdf402c0 routing guide: wildcard segments are quite flexible, go beyond the simple use case 2010-08-16 01:14:09 +02:00
Subba Rao Pasupuleti
54477c9848 select tags coerce the :selected option, options to strings before comparison [#5056 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-15 16:46:32 -03:00
Bryce Thornton
fd78bb7270 Allow for any possible TLD when using the :all option with the cookie session store. This works for subdomain.mysite.local, google.co.uk, google.com.au, etc. [#5147 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-15 16:42:02 -03:00
José Valim
ada8c66ba0 Improve routes task code and print the application as :to => RackApp. [#5338 state:resolved] 2010-08-15 16:36:12 -03:00
Mark Turner
99f3997520 make rake routes print the name of a Rack endpoint app [#5338 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-15 16:22:57 -03:00
Santiago Pastorino
2f9f0829c6 Object#returning has gone, it's already deprecated on 3-0-stable 2010-08-15 12:08:17 -03:00
Santiago Pastorino
3c8b50020a Revert "Makes AR use AMo to_key implementation"
This reverts commit 36a84a4f15.
2010-08-15 11:33:21 -03:00
José Valim
d0cf212cb5 to_key should return all exists keys (if any exists), regardless if the object is persisted or not. If you need it to reflect persistance, you should use to_param. 2010-08-15 11:29:15 -03:00
Mikel Lindsaar
fd9f3ad36b Making time_zone_options_for_select return a html_safe string
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-08-15 09:58:40 -03:00
Santiago Pastorino
1607a8b08c This is not needed anymore 2010-08-15 09:18:08 -03:00
Santiago Pastorino
2ad3d96cb0 recommended is the right word here 2010-08-15 08:44:14 -03:00
Santiago Pastorino
f939fb5e31 Makes use of class << self instead of def self. 2010-08-15 08:41:39 -03:00
Xavier Noria
331c5da7f0 getting started guide: typos reported by Abder-Rahman Ali 2010-08-15 13:03:05 +02:00
Santiago Pastorino
a81c956bf1 remove already defined method to avoid warnings 2010-08-15 07:59:40 -03:00
Santiago Pastorino
69de30d01f Revert "connection reader is defined later"
This reverts commit f4cce71d96.
2010-08-15 07:47:52 -03:00
Santiago Pastorino
f4cce71d96 connection reader is defined later 2010-08-15 07:19:53 -03:00
Santiago Pastorino
bcd62cdafd Makes topics.written_on null => true back again some tests rely on that 2010-08-15 07:19:06 -03:00
Santiago Pastorino
3c2fcacc85 MySQL2 added to CI 2010-08-14 21:55:35 -03:00
Xavier Noria
6f929ef801 Merge remote branch 'rails/master' 2010-08-15 02:53:26 +02:00
Xavier Noria
3ba61ecb7f Revert "Add example label to activesupport/configurable"
This reverts commit f480b2cea6.

Reason: API guidelines discourage this, see http://edgeguides.rubyonrails.org/api_documentation_guidelines.html#example-code
2010-08-15 02:22:38 +02:00
Xavier Noria
dd18840b79 Revert "Add example label to active_support/configurable"
This reverts commit 693f770afe.

Reason: to be able to revert f480b2cea6
2010-08-15 02:22:38 +02:00
Josep M. Bach
9f9a02af86 Whitespace and example identation 2010-08-15 02:22:38 +02:00
Josep M. Bach
e8ef58a697 Add example label to active_support/configurable 2010-08-15 02:22:38 +02:00
Josep M. Bach
664afe37dd Add example label to activesupport/configurable 2010-08-15 02:22:38 +02:00
Xavier Noria
21bbcfe42c reviews commit dcc9d38 2010-08-15 02:22:37 +02:00
Josep M. Bach
c7adc96186 Documented active_support/configurable 2010-08-15 02:22:37 +02:00
Josep M. Bach
ca87d0a395 Documentation just before Concern module 2010-08-15 02:22:37 +02:00
Josep M. Bach
98818f92b8 Documented active_support/concern dependency handling 2010-08-15 02:22:37 +02:00
Santiago Pastorino
9a7e7e5fdb Add missing model 2010-08-14 18:49:04 -03:00
Santiago Pastorino
59a0700b56 Both tests are using the same model, move the model to another file and add the missing require 2010-08-14 18:48:06 -03:00
Santiago Pastorino
ad4272922d object/try should be required after abstract_unit to have AS in the load path 2010-08-14 18:33:38 -03:00
Xavier Noria
0d5a060710 Revert "Add example label to activesupport/configurable"
This reverts commit f480b2cea6.

Reason: API guidelines discourage this, see http://edgeguides.rubyonrails.org/api_documentation_guidelines.html#example-code
2010-08-14 18:35:01 +02:00
Xavier Noria
f725ae3fef Revert "Add example label to active_support/configurable"
This reverts commit 693f770afe.

Reason: to be able to revert f480b2cea6
2010-08-14 18:34:32 +02:00
Josep M. Bach
68e1b72f7a Whitespace and example identation 2010-08-14 17:52:52 +02:00
Josep M. Bach
693f770afe Add example label to active_support/configurable 2010-08-14 17:19:04 +02:00
Josep M. Bach
a83fcc1134 Merge branch 'master' of github.com:lifo/docrails 2010-08-14 17:15:15 +02:00
Josep M. Bach
f480b2cea6 Add example label to activesupport/configurable 2010-08-14 17:15:03 +02:00
Xavier Noria
d6fd0f7fa7 reviews commit dcc9d38 2010-08-14 17:08:14 +02:00
Josep M. Bach
25145d6f5f Documented active_support/configurable 2010-08-14 17:02:39 +02:00
Josep M. Bach
b5175566af Documentation just before Concern module 2010-08-14 16:52:05 +02:00
Josep M. Bach
dcc9d38b8b Documented active_support/concern dependency handling 2010-08-14 16:28:30 +02:00
Xavier Noria
b7e7e56eb7 Merge remote branch 'docrails/master' 2010-08-14 13:22:41 +02:00
Subba Rao Pasupuleti
e516378410 Adding missing required statement
[#5056 state:resolved]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-08-14 13:17:32 +02:00
Santiago Pastorino
9dc88aba47 Fixes some ActionMailer tests 2010-08-14 13:17:32 +02:00
Santiago Pastorino
b95d6e84b0 Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;) 2010-08-14 13:17:32 +02:00
Santiago Pastorino
36a84a4f15 Makes AR use AMo to_key implementation
[#5249]
2010-08-14 13:17:31 +02:00
Santiago Pastorino
48c7ad17b0 This method is actually not used, it's implemented on the concrete adapters
[#5331 state:committed]
2010-08-14 13:17:31 +02:00
Aaron Patterson
22b9bbc828 converting to a symbol is not necessary 2010-08-14 13:17:31 +02:00
Prem Sichanugrist
6a14eee918 Removing most of the symbol to proc usage in Active Record
This will hopefully make Active Record run a bit more faster.
2010-08-14 13:17:31 +02:00
Aaron Patterson
cfbfb86730 removing a lolinject 2010-08-14 13:17:31 +02:00
Santiago Pastorino
4c2bbe9a1a Moves local_request? to require.local?
[#5361 state:committed]
2010-08-14 13:17:31 +02:00
Aaron Patterson
e8ffe7d6b6 avoid direct use of arel constants 2010-08-14 13:17:30 +02:00
Aaron Patterson
c8d5ee3e9e removing references to arel constants 2010-08-14 13:17:30 +02:00
Aaron Patterson
d6c84845b3 avoiding symbol to proc again 2010-08-14 13:17:30 +02:00
Aaron Patterson
6c50ad0234 do not use arel constants directly 2010-08-14 13:17:30 +02:00
Aaron Patterson
5baf75b650 symbol to proc is slow, we should avoid it 2010-08-14 13:17:30 +02:00
Jeremy Kemper
17a6dfb745 It's snowing! 2010-08-14 13:17:30 +02:00
Subba Rao Pasupuleti
f8f437191f no callbacks should be created for empty array [#5289 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-14 13:17:30 +02:00
Subba Rao Pasupuleti
b61ff257e9 tidy up validations length code [#5297 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-14 13:17:29 +02:00
Greg Campbell
1577eafe77 Add missing ActiveModel::Validations require
[#5311 state: resolved]

ActiveModel::Validations uses Hash#except, but does not require it from
ActiveSupport.  (This wasn't showing up in the tests, because it was
required in the helper, and was also required in
ActiveModel::Serialization).

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-14 13:17:29 +02:00
Neeraj Singh
8fdecaaef2 Ensure we can nest include calls [#5285 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-14 13:17:29 +02:00
Subba Rao Pasupuleti
b7fdc937fa Adding missing required statement
[#5056 state:resolved]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-08-14 06:27:15 -03:00
Santiago Pastorino
0a22576970 Fixes some ActionMailer tests 2010-08-14 05:58:34 -03:00
Santiago Pastorino
b451de0d6d Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;) 2010-08-14 04:12:33 -03:00
Santiago Pastorino
535082fe3e deprected -> deprecated 2010-08-14 03:55:14 -03:00
Santiago Pastorino
1590377886 Makes AR use AMo to_key implementation
[#5249]
2010-08-13 22:26:44 -03:00
Santiago Pastorino
27fb88aa22 This method is actually not used, it's implemented on the concrete adapters
[#5331 state:committed]
2010-08-13 21:19:47 -03:00
Aaron Patterson
be5d1608cb converting to a symbol is not necessary 2010-08-13 16:50:31 -07:00
Prem Sichanugrist
a7eb8d97a4 Removing most of the symbol to proc usage in Active Record
This will hopefully make Active Record run a bit more faster.
2010-08-13 16:24:49 -07:00
Aaron Patterson
1f250415fe removing a lolinject 2010-08-13 14:45:57 -07:00
Santiago Pastorino
919888503d Moves local_request? to require.local?
[#5361 state:committed]
2010-08-13 17:35:52 -03:00
Aaron Patterson
b9eec677c4 avoid direct use of arel constants 2010-08-13 13:33:08 -07:00
Aaron Patterson
af3e39358c removing references to arel constants 2010-08-13 12:37:18 -07:00
Aaron Patterson
e18bd86314 avoiding symbol to proc again 2010-08-13 12:37:07 -07:00
Aaron Patterson
4439e57ee0 do not use arel constants directly 2010-08-13 12:37:03 -07:00
Aaron Patterson
5651e4c835 symbol to proc is slow, we should avoid it 2010-08-13 12:36:59 -07:00
Jeremy Kemper
c49144b2f7 It's snowing! 2010-08-12 13:32:00 -07:00
Mark Hayes
b680d153d2 in Rendering objects with RecordIdentifier example, locals should reference @account not @buyer 2010-08-12 12:52:17 -07:00
Xavier Noria
fddcd21bd1 be more precise re :validate and :autosave 2010-08-12 19:31:47 +02:00
Xavier Noria
08c37ebf6f be more precise re :validate and :autosave 2010-08-12 19:30:51 +02:00
Subba Rao Pasupuleti
ef0da581e9 no callbacks should be created for empty array [#5289 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-12 13:12:26 -03:00
Subba Rao Pasupuleti
e82b38cd57 tidy up validations length code [#5297 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-12 13:12:03 -03:00
Greg Campbell
90a7915ab2 Add missing ActiveModel::Validations require
[#5311 state: resolved]

ActiveModel::Validations uses Hash#except, but does not require it from
ActiveSupport.  (This wasn't showing up in the tests, because it was
required in the helper, and was also required in
ActiveModel::Serialization).

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-12 13:11:48 -03:00
Neeraj Singh
6ed1ba472e Ensure we can nest include calls [#5285 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-12 13:10:58 -03:00
Xavier Noria
4134d7db34 Merge remote branch 'docrails/master' 2010-08-12 17:36:09 +02:00
Xavier Noria
8af2186d26 revises some autosave docs, style and content 2010-08-12 17:31:04 +02:00
Paco Guzman
8a2b69b727 applied guidelines to "# =>" 2010-08-12 17:09:58 +02:00
José Valim
e4943e93c2 Make update_attribute behave as in Rails 2.3 and document the behavior intrinsic to its implementation. 2010-08-12 12:04:16 -03:00
Xavier Noria
599c505837 commit review: applies guidelines to "# =>" 2010-08-12 16:41:34 +02:00
Neeraj Singh
cfad74cfef updating documentation for named_scope and default_scope 2010-08-12 10:23:20 -04:00
Mark Turner
1049bae132 fixed indentation in test cases
Signed-off-by: wycats <wycats@gmail.com>
2010-08-11 23:55:53 -07:00
wycats
c6160898c8 Replace snowman with utf8=✓ 2010-08-11 18:37:57 -07:00
Paul Hieromnimon
007c4da9ae Raising exception if fixture file can't be found 2010-08-11 15:47:34 -07:00
Aaron Patterson
7de03ec765 subtracting blank strings is slightly faster than blank? 2010-08-11 15:45:06 -07:00
Xavier Noria
ccc89f4899 AS guide: some revisions 2010-08-12 00:17:20 +02:00
Xavier Noria
1ee3593d65 no need to assign if we are gonna return 2010-08-12 00:17:10 +02:00
Aaron Patterson
06dc884454 avoid multiple hash lookups 2010-08-11 15:00:08 -07:00
Aaron Patterson
ce529b4759 dry up the hash dup and avoid sending nil values 2010-08-11 15:00:02 -07:00
Aaron Patterson
0f502ab88f avoiding tap saves us time 2010-08-11 11:44:08 -07:00
Aaron Patterson
2b8f24998e unless Array#empty? is faster than if Array#present? 2010-08-11 11:44:04 -07:00
Aaron Patterson
3c11e92616 stop using private methods 2010-08-11 11:43:57 -07:00
José Valim
25f1e015c0 Ensure @config is not a reserved instance variable in controllers. [#5342 state:resolved] 2010-08-11 10:26:07 -03:00
José Valim & Carlos Antonio da Silva
f08b58dd0c layout_for works again with objects as specified in the documentation and Rails 2.3 [#5357 state:resolved] 2010-08-11 10:23:07 -03:00
Nick Sieger
f5c5cdd4ae Missed one spot for --skip-active-record, which means that new Gemfile isn't set up right
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-08-11 00:42:45 -03:00
Gonçalo Silva
58add1b63c added support for more printers 2010-08-10 10:23:40 -07:00
Gonçalo Silva
aff821508a added support for more printers 2010-08-10 18:21:51 +01:00
Gonçalo Silva
6265850004 Merge branch 'master' of http://github.com/rails/rails 2010-08-10 18:15:12 +01:00
Santiago Pastorino
a6c6cbfb55 ActiveModel::Base doesn't exist, include_root_in_json is a class_attribute for the classes which includes this module 2010-08-10 11:53:58 -03:00
José Valim
e86cced311 Revert "require_dependency should require using the normal mechanism if possible to avoid double-requires"
This was causing double requires since 991cd59a22 was reverted.
This reverts commit 8bf79739b4.
2010-08-10 11:18:58 -03:00
Xavier Noria
fff917e37d fixes a typo reported by rymai 2010-08-10 15:34:54 +02:00
Xavier Noria
2a984806ca AS guide: removes some duplication, and makes a second pass on method delegation 2010-08-10 11:52:37 +02:00
Xavier Noria
347d604792 adds the AS guide to the guides index 2010-08-10 04:10:32 +02:00
Xavier Noria
5fc8af4712 AS guide: documents Module#redefine_method 2010-08-10 04:10:32 +02:00
Xavier Noria
ae147b45bb AS guide: documents Module#(instance_)method_names 2010-08-10 04:10:32 +02:00
Tobias Lütke
cb9295c8a1 Added test case to verify that transaction callbacks are correctly propagated to class observers 2010-08-09 21:36:06 -04:00
Xavier Noria
a5d401aa99 AS guide: documents Module#delegate 2010-08-10 03:28:59 +02:00
Xavier Noria
41328815c0 AS guide: documents Process.daemon 2010-08-10 01:55:09 +02:00
Xavier Noria
898bd38d7a AS guide: documents date/datetime/time arithmetic with durations 2010-08-10 01:30:37 +02:00
Brandon Tilley
dd1b33078a Fixed problem with markup that caused an extra symbol in a function name when rendered. 2010-08-09 15:46:39 -07:00
Jeremy Kemper
394f4c9679 Merge remote branch 'brianmario/mysql2' 2010-08-09 15:17:17 -07:00
Brian Lopez
188855501b move mysql2 adapter into core 2010-08-09 14:52:00 -07:00
Brian Lopez
94cff67bd1 ignore this test for mysql2 2010-08-09 12:50:09 -07:00
Brian Lopez
ee9c950f2f bringing over latest from master 2010-08-09 12:43:49 -07:00
wycats
7171161124 rename _snowman to _e 2010-08-09 12:06:25 -07:00
wycats
6767946374 Improve best_standards_support to use only IE=Edge in development mode 2010-08-09 11:48:31 -07:00
Neeraj Singh
190e270db2 adding more documentation for autosave option 2010-08-09 13:37:51 -04:00
Xavier Noria
4f7565c4de adds missing requires for Object#try 2010-08-09 15:25:21 +02:00
Xavier Noria
505546af70 form helpers guide: fixes an example 2010-08-09 14:11:05 +02:00
Xavier Noria
4434e407e9 adds URL to the body generated by the redirect macro in the routes mapper as per the RFC, extracts common test pattern into a test macro, adds a test to cover the :status option 2010-08-09 13:31:42 +02:00
Xavier Noria
d87c57bf3e AC guide: commit review, block examples go at column 0, use .example.com as example domain 2010-08-09 12:21:21 +02:00
Adam Meehan
9a43640ed1 typo in AM 2010-08-09 13:44:04 +10:00
Daniel McNevin
678aeb7e48 updated the action_controller guide with the new session configuration options 2010-08-08 19:57:42 -04:00
Xavier Noria
4d3b2ea68b Merge remote branch 'rails/master' 2010-08-08 18:35:43 +02:00
Xavier Noria
b7c4523a94 Merge remote branch 'docrails/master' 2010-08-08 18:33:55 +02:00
Xavier Noria
ddeaf6c887 routing guide: documents the CONTROLLER environment variable understood by the routes task 2010-08-08 18:31:19 +02:00
Xavier Noria
5598d3ac2e updates horo dependency to 1.0.1 2010-08-08 11:28:50 +02:00
Xavier Noria
997021eb29 undoes one of the modifications to RDoc::Parser.binary? 2010-08-07 20:10:01 +02:00
Xavier Noria
0953c04cf5 quick hack: hijacks the predicate RDoc::Parser.binary? so that it does not consider a handful of ordinary Ruby files in the Rails tree as binary (and thus excluded from the API) 2010-08-07 15:18:22 +02:00
Xavier Noria
aed698a7c8 adds Abstract Controller to the API 2010-08-07 01:42:09 +02:00
Aaron Patterson
334452098e reduce the number of times current_connection_id is called in with_connection() 2010-08-06 16:39:12 -07:00
Aaron Patterson
e1596be323 test to ensure that respond_to? delegates to arel 2010-08-06 15:23:25 -07:00
Aaron Patterson
d082a9a2b8 sorry AR, my privates are none of your business 2010-08-06 14:53:01 -07:00
Xavier Noria
672c796ac4 fix reference to time/calculations.rb in AS guide 2010-08-06 22:46:43 +02:00
Neeraj Singh
fc01adee79 correcting wrong example 2010-08-06 15:51:52 -04:00
Neeraj Singh
74dde5951a updating documentation for method configure_dependency_for_has_many 2010-08-06 15:24:53 -04:00
Aaron Patterson
12b3eca420 do not rely on arel class structure 2010-08-06 11:31:05 -07:00
Xavier Noria
62bb83d0a2 AS guide: documents calculations with Time objects 2010-08-06 17:29:52 +02:00
Xavier Noria
3e678240f4 edit pass to AMo::Serializers::JSON 2010-08-06 13:56:38 +02:00
Xavier Noria
23abf46112 AR guide: fixes a query 2010-08-06 13:33:02 +02:00
Xavier Noria
e0a0638094 commit review: say clearly that AS::OrderedHash is about insertion order, be more neutral in wording, do not imply lack of ordering is a problem 2010-08-06 13:11:44 +02:00
Neeraj Singh
cdbc880055 adding documentation for OrderedHash and OrderedOptions 2010-08-06 01:51:11 -04:00
Neeraj Singh
d0ac56b5b4 adding an example of skipping a callback 2010-08-06 01:51:11 -04:00
Xavier Noria
d62700f7dc Merge remote branch 'docrails/master' 2010-08-05 22:56:15 +02:00
Xavier Noria
02e711bf1c documents that :terminator is a string to be eval'ed, and that it sees the result variable 2010-08-05 22:54:43 +02:00
Xavier Noria
232218f465 Revert "correcting the documentation that default to false. it does not default to false. returing either false or nil will not halt the chain unless :terminator is explicitly mentioned"
This reverts commit cd87cf771a.

Reason: it does default to "false".
2010-08-05 22:46:04 +02:00
Neeraj Singh
86842fd1ce fixing typo 2010-08-05 16:35:40 -04:00
Neeraj Singh
5130b0cf45 more documentation for class_inheritable_* 2010-08-05 11:55:45 -04:00
Neeraj Singh
cd87cf771a correcting the documentation that default to false. it does not default to false. returing either false or nil will not halt the chain unless :terminator is explicitly mentioned 2010-08-05 11:55:45 -04:00
Aaron Patterson
1ca18a6f85 fixing whitespace errors 2010-08-05 08:15:22 -07:00
Xavier Noria
8a657c0dc7 adds test coverage to ensure DateTime#advance processes first the date deltas, and then the time deltas 2010-08-05 16:12:43 +02:00
Xavier Noria
9989d3337f Merge remote branch 'docrails/master' 2010-08-05 15:56:42 +02:00
Xavier Noria
02572399a5 AS guide: documents DateTime#advance 2010-08-05 14:10:07 +02:00
Tom Stuart
f544c0a32d Fix ActiveSupport::Callbacks' define_callbacks and ActiveSupport::Concern documentation to look like native English 2010-08-05 09:06:47 +01:00
Aaron Patterson
117b096d0a avoid passing lists of lists to the group clause 2010-08-04 16:24:01 -07:00
Xavier Noria
3cbe111439 Merge remote branch 'docrails/master' 2010-08-05 01:15:57 +02:00
Aaron Patterson
ec736dff7b call to_a since we are not passing anything to all() 2010-08-04 14:22:29 -07:00
Aaron Patterson
30abb01d07 fisting indentation 2010-08-04 14:11:30 -07:00
Piotr Sarnacki
84f0a0bc30 Reload action_methods in AbstractController after defining new method.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-04 14:44:34 -03:00
José Valim
462666b737 Revert "If a file is in the load path, require it without its full path (in more places)"
Caused failures in ActionMailer test suite.

This reverts commit 991cd59a22.
2010-08-04 14:17:46 -03:00
Aaron Patterson
cff7f53fbc do not pass AR objects to ARel 2010-08-04 08:44:53 -07:00
José Valim
7e2399a42f Revert "Put lib back on the autoload path"
This was causing engines/gems to eager load everything in lib. Another fix is comming soon.

This reverts commit 02a5842cd0.
2010-08-04 14:13:50 +02:00
wycats
c25c3879ce I'm unsure how cloning was working in Rails 3 before 2010-08-04 04:05:54 -07:00
wycats
847c123ca5 Concernify SanitizeHelper and TextHelper so including TextHelper correctly include SanitizeHelper and extends its ClassMethods 2010-08-04 03:25:57 -07:00
wycats
991cd59a22 If a file is in the load path, require it without its full path (in more places) 2010-08-04 03:25:57 -07:00
wycats
8bf79739b4 require_dependency should require using the normal mechanism if possible to avoid double-requires 2010-08-04 03:25:57 -07:00
Aaron Patterson
6d6ed55324 avoid passing AR::Base objects to Arel when we can 2010-08-03 17:58:56 -07:00
RainerBlessing
7e4e1f0ca5 query value is converted to_s instead of to_yaml
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-08-03 21:08:43 -03:00
wycats
02a5842cd0 Put lib back on the autoload path 2010-08-03 14:57:55 -07:00
wycats
c0fa4de65b Allow :name to be a Symbol (was this removed by accident?) 2010-08-03 12:22:36 -07:00
Subba Rao Pasupuleti
8d9d8bc93c Tidy up error.rb code
[#5288 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-08-03 14:54:13 -03:00
Aaron Patterson
41c1aa607d order query is already a string, no need to to_s 2010-08-03 09:16:01 -07:00
Santiago Pastorino
b8634dddab Stub is_a? not instance_of? here 2010-08-03 12:17:53 -03:00
José Valim
84081fcc54 Freeze options so we raise an error when people modify it in place. 2010-08-03 15:36:23 +02:00
José Valim
f23bc8444b validates_length_of should not change the options hash in place. [#5283 state:resolved] 2010-08-03 15:22:54 +02:00
rohit
621246f997 Failing test for validates_length_of, when both too_short and too_long messages are set [#5283 state:open]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-03 15:11:51 +02:00
Samuel Lebeau
f01184ad9e Avoid potentially expensive inspect call in router. [#4491 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-03 11:52:19 +02:00
Brian Lopez
d8b90114dd skip the before_type_cast_on_datetime test entirely for mysql2 2010-08-02 15:11:00 -07:00
Brian Lopez
42035fd112 move reload after touch 2010-08-02 15:10:34 -07:00
Brian Lopez
ab64499911 reload the owner model after update 2010-08-02 14:51:57 -07:00
Brian Lopez
954de9940b Merge branch 'master' into mysql2
* master:
  Bring returning back to ease migration.
  Remove duplicated logic.
  Eager loading an association should not change the count of children
  fix loading of different elements in array then int and string [#5036 state:resolved]
  Tidy up previous commit.
  test and fix collection_singular_ids= with string primary keys [#5125 state:resolved]
  Handle edge cases in the previous patch.
  Improved how AppGenerator generates the application name. It now detects the current app name whenever possible. This means that renaming the residing directory will not effect the app name generated by AppGenerator.
  ActiveModel::Errors json serialization to work as Rails 3b4 [#5254 state:resolved]
  Add missing require in ActiveSupport::HashWithIndifferentAccess [#5189 state:resolved]
  Add an internal (private API) after_touch callback. [#5271 state:resolved]
  added failing touch propagation test
  Makes rails destroy scaffold don't duplicate routes.draw do |map| |map| when using the deprecated syntax
  Failing test to check for route file corruption if legacy map parameter is used. [#5263 state:open]
  Corrected the rake test:units and test:functionals description [#5251 state:committed]
  Use AS::OrderedHash when trusting in the order of the hash
  Fix label form helper to use I18n and html options, without the need of 'nil' text param:
2010-08-02 13:30:08 -07:00
Brian Lopez
2353e826b0 typo 2010-08-02 01:58:29 -07:00
Brian Lopez
21e81da335 update tests for mysql2 support 2010-08-02 01:37:57 -07:00
Gonçalo Silva
cd2bbed984 Merge branch 'master' of http://github.com/rails/rails 2010-07-10 17:36:10 +01:00
Gonçalo Silva
d2c633ba0b Merge branch 'master' of http://github.com/rails/rails 2010-06-30 23:01:30 +01:00
Gonçalo Silva
92c0f17d6d performance tests now working accurately on 1.9, using Ruby with the GCdata patch 2010-06-18 22:23:11 +01:00
1324 changed files with 55330 additions and 59793 deletions

6
.gitignore vendored
View File

@@ -1,5 +1,7 @@
pkg
.bundle
Gemfile.lock
.Gemfile
debug.log
doc/rdoc
activemodel/doc
@@ -9,6 +11,7 @@ activerecord/sqlnet.log
actionpack/doc
actionmailer/doc
activesupport/doc
activesupport/test/tmp
activemodel/test/fixtures/fixture_database.sqlite3
actionpack/test/tmp
activesupport/test/fixtures/isolation_test
@@ -19,3 +22,6 @@ railties/test/initializer/root/log
railties/doc
railties/guides/output
railties/tmp
.rvmrc
.rbenv-version
RDOC_MAIN.rdoc

View File

@@ -1,3 +1,4 @@
--exclude /templates/
--quiet
act*/lib/**/*.rb
railties/lib/**/*.rb

93
Gemfile
View File

@@ -1,53 +1,90 @@
source 'http://rubygems.org'
source "http://rubygems.org"
gemspec
gem "rake", ">= 0.8.7"
gem 'mocha', '>= 0.13.0', :require => false
gem "pry"
group :doc do
gem "rdoc", "~> 3.4"
gem "horo", "= 1.0.3"
gem "RedCloth", "~> 4.2" if RUBY_VERSION < "1.9.3"
if ENV['AREL']
gem "arel", :path => ENV['AREL']
end
# for perf tests
gem "faker"
gem "rbench"
gem "addressable"
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.10.5"
group :doc do
# The current sdoc cannot generate GitHub links due
# to a bug, but the PR that fixes it has been there
# for some weeks unapplied. As a temporary solution
# this is our own fork with the fix.
gem "sdoc", :git => 'git://github.com/fxn/sdoc.git'
gem "RedCloth", "~> 4.2" if RUBY_VERSION < "1.9.3"
gem "w3c_validators"
end
# AS
gem "memcache-client", ">= 1.8.5"
platforms :ruby do
gem 'json'
gem 'yajl-ruby'
gem "nokogiri", ">= 1.4.4"
platforms :mri_18 do
gem "system_timer"
gem "json"
end
# AR
gem "sqlite3", "~> 1.3.3"
# Add your own local bundler stuff
instance_eval File.read ".Gemfile" if File.exists? ".Gemfile"
group :db do
gem "pg", ">= 0.9.0"
gem "mysql", ">= 2.8.1"
gem "mysql2", :git => "git://github.com/brianmario/mysql2.git", :branch => "0.2.x"
platforms :mri do
group :test do
gem 'ruby-prof', '~> 0.11.2'
end
end
env :AREL do
gem "arel", :path => ENV['AREL']
platforms :ruby do
if ENV["RB_FSEVENT"]
gem "rb-fsevent"
end
gem "json"
gem "yajl-ruby"
gem "nokogiri", ">= 1.4.4"
# AR
gem "sqlite3", "~> 1.3.4"
group :db do
gem "pg", ">= 0.11.0"
gem "mysql", ">= 2.8.1"
gem "mysql2", ">= 0.3.10"
end
end
platforms :jruby do
gem "json"
gem "activerecord-jdbcsqlite3-adapter", ">= 1.2.0"
# This is needed by now to let tests work on JRuby
# TODO: When the JRuby guys merge jruby-openssl in
# jruby this will be removed
gem "jruby-openssl"
group :db do
gem "activerecord-jdbcmysql-adapter", ">= 1.2.0"
gem "activerecord-jdbcpostgresql-adapter", ">= 1.2.0"
end
end
# gems that are necessary for ActiveRecord tests with Oracle database
if ENV['ORACLE_ENHANCED_PATH'] || ENV['ORACLE_ENHANCED']
platforms :ruby do
gem 'ruby-oci8', ">= 2.0.4"
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,124 +0,0 @@
GIT
remote: git://github.com/brianmario/mysql2.git
revision: 3c7548851f5bf124eb23307286ef95d61172ac4b
branch: 0.2.x
specs:
mysql2 (0.2.22)
PATH
remote: .
specs:
actionmailer (3.0.20)
actionpack (= 3.0.20)
mail (~> 2.2)
actionpack (3.0.20)
activemodel (= 3.0.20)
activesupport (= 3.0.20)
builder (~> 3.2.0)
erubis (~> 2.7.0)
i18n (~> 0.6.0)
rack (~> 1.4.1)
rack-mount (~> 0.6.14)
rack-test (~> 0.6.1)
tzinfo (~> 0.3.23)
activemodel (3.0.20)
activesupport (= 3.0.20)
builder (~> 3.2.0)
i18n (~> 0.6.0)
activerecord (3.0.20)
activemodel (= 3.0.20)
activesupport (= 3.0.20)
arel (~> 2.0.10)
tzinfo (~> 0.3.23)
activeresource (3.0.20)
activemodel (= 3.0.20)
activesupport (= 3.0.20)
activesupport (3.0.20)
rails (3.0.20)
actionmailer (= 3.0.20)
actionpack (= 3.0.20)
activerecord (= 3.0.20)
activeresource (= 3.0.20)
activesupport (= 3.0.20)
bundler (~> 1.0)
railties (= 3.0.20)
railties (3.0.20)
actionpack (= 3.0.20)
activesupport (= 3.0.20)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.18)
GEM
remote: http://rubygems.org/
specs:
addressable (2.3.6)
arel (2.0.10)
builder (3.2.2)
coderay (1.1.0)
erubis (2.7.0)
faker (1.3.0)
i18n (~> 0.5)
horo (1.0.3)
rdoc (>= 2.5)
i18n (0.6.9)
json (1.8.1)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
memcache-client (1.8.5)
metaclass (0.0.4)
method_source (0.8.2)
mime-types (1.25.1)
mini_portile (0.5.3)
mocha (1.0.0)
metaclass (~> 0.0.1)
mysql (2.9.1)
nokogiri (1.6.1)
mini_portile (~> 0.5.0)
pg (0.17.1)
polyglot (0.3.4)
pry (0.9.12.6)
coderay (~> 1.0)
method_source (~> 0.8)
slop (~> 3.4)
rack (1.4.5)
rack-mount (0.6.14)
rack (>= 1.0.0)
rack-test (0.6.2)
rack (>= 1.0)
rake (10.2.2)
rbench (0.2.3)
rdoc (3.12.2)
json (~> 1.4)
slop (3.5.0)
sqlite3 (1.3.9)
thor (0.19.1)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.39)
yajl-ruby (1.2.0)
PLATFORMS
ruby
DEPENDENCIES
addressable
arel
faker
horo (= 1.0.3)
json
memcache-client (>= 1.8.5)
mocha (>= 0.13.0)
mysql (>= 2.8.1)
mysql2!
nokogiri (>= 1.4.4)
pg (>= 0.9.0)
pry
rails!
rake (>= 0.8.7)
rbench
rdoc (~> 3.4)
sqlite3 (~> 1.3.3)
yajl-ruby

View File

@@ -1 +1 @@
3.0.20
3.1.8

View File

@@ -1,38 +1,43 @@
== Welcome to \Rails
== 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.
Rails is a web-application framework that includes everything needed to create
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
1. Install \Rails at the command prompt if you haven't yet:
1. Install Rails at the command prompt if you haven't yet:
gem install rails
2. At the command prompt, create a new \Rails application:
2. At the command prompt, create a new Rails application:
rails new myapp
@@ -44,25 +49,25 @@ more separate. Each of these packages can be used independently outside of
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!"
5. Follow the guidelines to start developing your application. You can find the following resources handy:
5. Follow the guidelines to start developing your application. You may find the following resources handy:
* The README file created within your application.
* The {Getting Started with Rails}[http://guides.rubyonrails.org/getting_started.html].
* The {Ruby on Rails Tutorial}[http://railstutorial.org/book].
* The {Ruby on Rails guides}[http://guides.rubyonrails.org/getting_started.html].
* The {API documentation}[http://api.rubyonrails.org].
* The {Ruby on Rails Guides}[http://guides.rubyonrails.org].
* The {API Documentation}[http://api.rubyonrails.org].
== Contributing
We encourage you to contribute to Ruby on \Rails! Please check out the {Contributing to Rails
guide}[http://edgeguides.rubyonrails.org/contributing_to_rails.html] for guidelines about how
We encourage you to contribute to Ruby on Rails! Please check out the {Contributing to Rails
guide}[http://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html] for guidelines about how
to proceed. {Join us}[http://contributors.rubyonrails.org]!
== License
Ruby on \Rails is released under the MIT license.
Ruby on Rails is released under the MIT license.

114
Rakefile Normal file → Executable file
View File

@@ -1,8 +1,8 @@
gem 'rdoc', '>= 2.5.10'
require 'rdoc'
#!/usr/bin/env rake
require 'rake'
require 'rdoc/task'
require 'sdoc'
require 'net/http'
$:.unshift File.expand_path('..', __FILE__)
require "tasks/release"
@@ -13,31 +13,6 @@ task :build => "all:build"
desc "Release all gems to gemcutter and create a tag"
task :release => "all:release"
# RDoc skips some files in the Rails tree due to its binary? predicate. This is a quick
# hack for edge docs, until we decide which is the correct way to address this issue.
# If not fixed in RDoc itself, via an option or something, we should probably move this
# to railties and use it also in doc:rails.
def hijack_rdoc!
require "rdoc/parser"
class << RDoc::Parser
def binary?(file)
s = File.read(file, 1024) or return false
if s[0, 2] == Marshal.dump('')[0, 2] then
true
elsif file =~ /erb\.rb$/ then
false
elsif s.index("\x00") then # ORIGINAL is s.scan(/<%|%>/).length >= 4 || s.index("\x00")
true
elsif 0.respond_to? :fdiv then
s.count("^ -~\t\r\n").fdiv(s.size) > 0.3
else # HACK 1.8.6
(s.count("^ -~\t\r\n").to_f / s.size) > 0.3
end
end
end
end
PROJECTS = %w(activesupport activemodel actionpack actionmailer activeresource activerecord railties)
desc 'Run all tests by default'
@@ -75,35 +50,67 @@ end
desc "Generate documentation for the Rails framework"
RDoc::Task.new do |rdoc|
hijack_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')
# 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
rdoc.rdoc_files.include(RDOC_MAIN)
end
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 << '-m' << 'README.rdoc'
rdoc.options << '-g' # SDoc flag, link methods to GitHub
rdoc.options << '-m' << RDOC_MAIN
rdoc.rdoc_files.include('README.rdoc')
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')
@@ -111,17 +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
@@ -159,3 +167,27 @@ task :update_versions do
end
end
end
#
# We have a webhook configured in Github that gets invoked after pushes.
# This hook triggers the following tasks:
#
# * updates the local checkout
# * updates Rails Contributors
# * generates and publishes edge docs
# * if there's a new stable tag, generates and publishes stable docs
#
# Everything is automated and you do NOT need to run this task normally.
#
# We publish a new version by tagging, and pushing a tag does not trigger
# that webhook. Stable docs would be updated by any subsequent regular
# push, but if you want that to happen right away just run this.
#
desc 'Publishes docs, run this AFTER a new stable tag has been pushed'
task :publish_docs do
Net::HTTP.new('rails-hooks.hashref.com').start do |http|
request = Net::HTTP::Post.new('/rails-master-hook')
response = http.request(request)
puts response.body
end
end

View File

@@ -1,485 +0,0 @@
## Rails 3.0.20 (unreleased)
## Rails 3.0.19 (Jan 8, 2013)
* No changes.
## Rails 3.0.18 (Jan 2, 2013)
* No changes.
## Rails 3.0.17 (Aug 9, 2012)
* No changes.
## Rails 3.0.16 (Jul 26, 2012)
* No changes.
## Rails 3.0.14 (Jun 12, 2012)
* No changes.
* Rails 3.0.13 (May 31, 2012)
* No changes.
*Rails 3.0.10 (August 16, 2011)*
*No changes.
*Rails 3.0.9 (June 16, 2011)*
*No changes.
*Rails 3.0.8 (June 7, 2011)*
* Mail dependency increased to 2.2.19
*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.
*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

@@ -1,4 +1,4 @@
Copyright (c) 2004-2010 David Heinemeier Hansson
Copyright (c) 2004-2011 David Heinemeier Hansson
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

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
@@ -32,7 +32,7 @@ This can be as simple as:
end
The body of the email is created by using an Action View template (regular
ERb) that has the instance variables that are declared in the mailer action.
ERB) that has the instance variables that are declared in the mailer action.
So the corresponding body template for the method above could look like this:
@@ -59,7 +59,9 @@ generated would look like this:
Mr. david@loudthinking.com
In previous version of rails you would call <tt>create_method_name</tt> and
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.
@@ -72,12 +74,25 @@ Or you can just chain the methods together like:
Notifier.welcome.deliver # Creates the email and sends it immediately
== 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 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.
Example:
class Authenticationmailer < ActionMailer::Base
default :from => "awesome@application.com", :subject => Proc.new { "E-mail was generated at #{Time.now}" }
.....
end
== Receiving emails
To receive emails, you need to implement a public instance method called <tt>receive</tt> that takes a
tmail object as its single parameter. The Action Mailer framework has a corresponding class method,
To receive emails, you need to implement a public instance method called <tt>receive</tt> that takes an
email object as its single parameter. The Action Mailer framework has a corresponding class method,
which is also called <tt>receive</tt>, that accepts a raw, unprocessed email as a string, which it then turns
into the tmail object and calls the receive instance method.
into the email object and calls the receive instance method.
Example:
@@ -89,7 +104,7 @@ Example:
)
if email.has_attachments?
for attachment in email.attachments
email.attachments.each do |attachment|
page.attachments.create({
:file => attachment, :description => email.subject
})
@@ -104,7 +119,7 @@ trivial case like this:
rails runner 'Mailman.receive(STDIN.read)'
However, invoking Rails in the runner for each mail to be received is very resource intensive. A single
instance of Rails should be run within a daemon if it is going to be utilized to process more than just
instance of Rails should be run within a daemon, if it is going to be utilized to process more than just
a limited number of email.
== Configuration
@@ -128,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
* http://github.com/rails/rails/tree/master/actionmailer/
* https://github.com/rails/rails/tree/master/actionmailer
== License
@@ -144,4 +159,5 @@ API documentation is at
Bug reports and feature requests can be filed with the rest for the Ruby on Rails project here:
* https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets
* https://github.com/rails/rails/issues

2
actionmailer/Rakefile Normal file → Executable file
View File

@@ -1,4 +1,4 @@
require 'rake'
#!/usr/bin/env rake
require 'rake/testtask'
require 'rake/packagetask'
require 'rubygems/package_task'

View File

@@ -11,12 +11,11 @@ Gem::Specification.new do |s|
s.author = 'David Heinemeier Hansson'
s.email = 'david@loudthinking.com'
s.homepage = 'http://www.rubyonrails.org'
s.rubyforge_project = 'actionmailer'
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.2')
s.add_dependency('mail', '~> 2.5')
end

View File

@@ -1,5 +1,5 @@
#--
# Copyright (c) 2004-2010 David Heinemeier Hansson
# Copyright (c) 2004-2011 David Heinemeier Hansson
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -44,7 +44,6 @@ module ActionMailer
autoload :Collector
autoload :Base
autoload :DeliveryMethods
autoload :DeprecatedApi
autoload :MailHelper
autoload :OldApi
autoload :TestCase

View File

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

View File

@@ -5,6 +5,7 @@ require 'active_support/core_ext/array/wrap'
require 'active_support/core_ext/object/blank'
require 'active_support/core_ext/proc'
require 'active_support/core_ext/string/inflections'
require 'active_support/core_ext/hash/except'
require 'action_mailer/log_subscriber'
module ActionMailer #:nodoc:
@@ -57,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:
@@ -88,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.
#
@@ -100,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
@@ -122,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>:
@@ -151,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
@@ -181,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
@@ -223,7 +225,7 @@ module ActionMailer #:nodoc:
#
# An interceptor object must implement the <tt>:delivering_email(message)</tt> method which will be
# called before the email is sent, allowing you to make modifications to the email before it hits
# the delivery agents. Your object should make and needed modifications directly to the passed
# the delivery agents. Your object should make any needed modifications directly to the passed
# in Mail::Message instance.
#
# = Default Hash
@@ -247,7 +249,7 @@ module ActionMailer #:nodoc:
# but Action Mailer translates them appropriately and sets the correct values.
#
# As you can pass in any header, you need to either quote the header as a string, or pass it in as
# an underscorised symbol, so the following will work:
# an underscored symbol, so the following will work:
#
# class Notifier < ActionMailer::Base
# default 'Content-Transfer-Encoding' => '7bit',
@@ -292,14 +294,18 @@ module ActionMailer #:nodoc:
# * <tt>:authentication</tt> - If your mail server requires authentication, you need to specify the
# authentication type here.
# This is a symbol and one of <tt>:plain</tt> (will send the password in the clear), <tt>:login</tt> (will
# send password BASE64 encoded) or <tt>:cram_md5</tt> (combines a Challenge/Response mechanism to exchange
# send password Base64 encoded) or <tt>:cram_md5</tt> (combines a Challenge/Response mechanism to exchange
# information and a cryptographic Message Digest 5 algorithm to hash important information)
# * <tt>:enable_starttls_auto</tt> - When set to true, detects if STARTTLS is enabled in your SMTP server
# and starts to use it.
# * <tt>:openssl_verify_mode</tt> - When using TLS, you can set how OpenSSL checks the certificate. This is
# really useful if you need to validate a self-signed and/or a wildcard certificate. You can use the name
# of an OpenSSL verify constant ('none', 'peer', 'client_once','fail_if_no_peer_cert') or directly the
# constant (OpenSSL::SSL::VERIFY_NONE, OpenSSL::SSL::VERIFY_PEER,...).
#
# * <tt>sendmail_settings</tt> - Allows you to override options for the <tt>:sendmail</tt> delivery method.
# * <tt>:location</tt> - The location of the sendmail executable. Defaults to <tt>/usr/sbin/sendmail</tt>.
# * <tt>:arguments</tt> - The command line arguments. Defaults to <tt>-i -t</tt> with <tt>-f sender@addres</tt>
# * <tt>:arguments</tt> - The command line arguments. Defaults to <tt>-i -t</tt> with <tt>-f sender@address</tt>
# added automatically before the message is sent.
#
# * <tt>file_settings</tt> - Allows you to override options for the <tt>:file</tt> delivery method.
@@ -344,10 +350,10 @@ module ActionMailer #:nodoc:
include AbstractController::Translation
include AbstractController::AssetPaths
helper ActionMailer::MailHelper
self.protected_instance_variables = %w(@_action_has_layout)
helper ActionMailer::MailHelper
include ActionMailer::OldApi
include ActionMailer::DeprecatedApi
private_class_method :new #:nodoc:
@@ -378,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)
@@ -427,14 +433,14 @@ module ActionMailer #:nodoc:
end
end
def respond_to?(method, *args) #:nodoc:
def respond_to?(method, include_private = false) #:nodoc:
super || action_methods.include?(method.to_s)
end
protected
def set_payload_for_mail(payload, mail) #:nodoc:
payload[:mailer] = self.name
payload[:mailer] = name
payload[:message_id] = mail.message_id
payload[:subject] = mail.subject
payload[:to] = mail.to
@@ -446,11 +452,8 @@ module ActionMailer #:nodoc:
end
def method_missing(method, *args) #:nodoc:
if action_methods.include?(method.to_s)
new(method, *args).message
else
super
end
return super unless respond_to?(method)
new(method, *args).message
end
end
@@ -471,31 +474,8 @@ module ActionMailer #:nodoc:
super
end
class DeprecatedHeaderProxy < ActiveSupport::BasicObject
def initialize(message)
@message = message
end
def []=(key, value)
unless value.is_a?(::String)
::ActiveSupport::Deprecation.warn("Using a non-String object for a header's value is deprecated. " \
"You specified #{value.inspect} (a #{value.class}) for #{key}", caller)
value = value.to_s
end
@message[key] = value
end
def headers(hash = {})
hash.each_pair do |k,v|
self[k] = v
end
end
def method_missing(meth, *args, &block)
@message.send(meth, *args, &block)
end
def mailer_name
self.class.mailer_name
end
# Allows you to pass random and unusual headers to the new +Mail::Message+ object
@@ -514,9 +494,9 @@ module ActionMailer #:nodoc:
# X-Special-Domain-Specific-Header: SecretValue
def headers(args=nil)
if args
DeprecatedHeaderProxy.new(@_message).headers(args)
@_message.headers(args)
else
DeprecatedHeaderProxy.new(@_message)
@_message
end
end
@@ -706,6 +686,9 @@ module ActionMailer #:nodoc:
end
end
# Translates the +subject+ using Rails I18n class under <tt>[:actionmailer, mailer_scope, action_name]</tt> scope.
# If it does not find a translation for the +subject+ under the specified scope it will default to a
# humanized version of the <tt>action_name</tt>.
def default_i18n_subject #:nodoc:
mailer_scope = self.class.mailer_name.gsub('/', '.')
I18n.t(:subject, :scope => [mailer_scope, action_name], :default => action_name.humanize)
@@ -742,15 +725,8 @@ module ActionMailer #:nodoc:
end
def each_template(paths, name, &block) #:nodoc:
Array.wrap(paths).each do |path|
templates = lookup_context.find_all(name, path)
templates = templates.uniq_by { |t| t.formats }
unless templates.empty?
templates.each(&block)
return
end
end
templates = lookup_context.find_all(name, Array.wrap(paths))
templates.uniq_by { |t| t.formats }.each(&block)
end
def create_parts_from_responses(m, responses) #:nodoc:
@@ -772,28 +748,6 @@ module ActionMailer #:nodoc:
container.add_part(part)
end
module DeprecatedUrlOptions
def default_url_options
deprecated_url_options
end
def default_url_options=(val)
deprecated_url_options
end
def deprecated_url_options
raise "You can no longer call ActionMailer::Base.default_url_options " \
"directly. You need to set config.action_mailer.default_url_options. " \
"If you are using ActionMailer standalone, you need to include the " \
"routing url_helpers directly."
end
end
# This module will complain if the user tries to set default_url_options
# directly instead of through the config object. In Action Mailer's Railtie,
# we include the router's url_helpers, which will override this module.
extend DeprecatedUrlOptions
ActiveSupport.run_load_hooks(:action_mailer, self)
end
end

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

@@ -1,147 +0,0 @@
require 'active_support/core_ext/object/try'
module ActionMailer
# This is the API which is deprecated and is going to be removed on Rails 3.1 release.
# Part of the old API will be deprecated after 3.1, for a smoother deprecation process.
# Check those in OldApi instead.
module DeprecatedApi #:nodoc:
extend ActiveSupport::Concern
included do
[:charset, :content_type, :mime_version, :implicit_parts_order].each do |method|
class_eval <<-FILE, __FILE__, __LINE__ + 1
def self.default_#{method}
@@default_#{method}
end
def self.default_#{method}=(value)
ActiveSupport::Deprecation.warn "ActionMailer::Base.default_#{method}=value is deprecated, " <<
"use default :#{method} => value instead"
@@default_#{method} = value
end
@@default_#{method} = nil
FILE
end
end
module ClassMethods
# Deliver the given mail object directly. This can be used to deliver
# a preconstructed mail object, like:
#
# email = MyMailer.create_some_mail(parameters)
# email.set_some_obscure_header "frobnicate"
# MyMailer.deliver(email)
def deliver(mail, show_warning=true)
if show_warning
ActiveSupport::Deprecation.warn "#{self}.deliver is deprecated, call " <<
"deliver in the mailer instance instead", caller[0,2]
end
raise "no mail object available for delivery!" unless mail
wrap_delivery_behavior(mail)
mail.deliver
mail
end
def template_root
self.view_paths && self.view_paths.first
end
def template_root=(root)
ActiveSupport::Deprecation.warn "template_root= is deprecated, use prepend_view_path instead", caller[0,2]
self.view_paths = ActionView::Base.process_view_paths(root)
end
def respond_to?(method_symbol, include_private = false)
matches_dynamic_method?(method_symbol) || super
end
def method_missing(method_symbol, *parameters)
if match = matches_dynamic_method?(method_symbol)
case match[1]
when 'create'
ActiveSupport::Deprecation.warn "#{self}.create_#{match[2]} is deprecated, " <<
"use #{self}.#{match[2]} instead", caller[0,2]
new(match[2], *parameters).message
when 'deliver'
ActiveSupport::Deprecation.warn "#{self}.deliver_#{match[2]} is deprecated, " <<
"use #{self}.#{match[2]}.deliver instead", caller[0,2]
new(match[2], *parameters).message.deliver
else super
end
else
super
end
end
private
def matches_dynamic_method?(method_name)
method_name = method_name.to_s
/^(create|deliver)_([_a-z]\w*)/.match(method_name) || /^(new)$/.match(method_name)
end
end
# Delivers a Mail object. By default, it delivers the cached mail
# object (from the <tt>create!</tt> method). If no cached mail object exists, and
# no alternate has been given as the parameter, this will fail.
def deliver!(mail = @_message)
ActiveSupport::Deprecation.warn "Calling deliver in the AM::Base object is deprecated, " <<
"please call deliver in the Mail instance", caller[0,2]
self.class.deliver(mail, false)
end
alias :deliver :deliver!
def render(*args)
options = args.last.is_a?(Hash) ? args.last : {}
if file = options[:file] and !file.index("/")
ActiveSupport::Deprecation.warn("render :file is deprecated except for absolute paths. " \
"Please use render :template instead")
options[:prefix] = _prefix
end
if options[:body].is_a?(Hash)
ActiveSupport::Deprecation.warn(':body in render deprecated. Please use instance ' <<
'variables as assigns instead', caller[0,1])
options[:body].each { |k,v| instance_variable_set(:"@#{k}", v) }
end
super
end
# Render a message but does not set it as mail body. Useful for rendering
# data for part and attachments.
#
# Examples:
#
# render_message "special_message"
# render_message :template => "special_message"
# render_message :inline => "<%= 'Hi!' %>"
#
def render_message(*args)
ActiveSupport::Deprecation.warn "render_message is deprecated, use render instead", caller[0,2]
render(*args)
end
private
def initialize_defaults(*)
@charset ||= self.class.default_charset.try(:dup)
@content_type ||= self.class.default_content_type.try(:dup)
@implicit_parts_order ||= self.class.default_implicit_parts_order.try(:dup)
@mime_version ||= self.class.default_mime_version.try(:dup)
super
end
def create_parts
if @body.is_a?(Hash) && !@body.empty?
ActiveSupport::Deprecation.warn "Giving a hash to body is deprecated, please use instance variables instead", caller[0,2]
@body.each { |k, v| instance_variable_set(:"@#{k}", v) }
end
super
end
end
end

View File

@@ -4,7 +4,7 @@ module ActionMailer
# each line, and wrapped at 72 columns.
def block_format(text)
formatted = text.split(/\n\r\n/).collect { |paragraph|
simple_format(paragraph)
format_paragraph(paragraph)
}.join("\n")
# Make list points stand on their own line
@@ -29,8 +29,15 @@ module ActionMailer
@_message.attachments
end
private
def simple_format(text, len = 72, indent = 2)
# Returns +text+ wrapped at +len+ columns and indented +indent+ spaces.
#
# === Examples
#
# my_text = "Here is a sample text with more than 40 characters"
#
# format_paragraph(my_text, 25, 4)
# # => " Here is a sample text with\n more than 40 characters"
def format_paragraph(text, len = 72, indent = 2)
sentences = [[]]
text.split.each do |word|

View File

@@ -8,9 +8,7 @@ module ActionMailer
included do
extend ActionMailer::AdvAttrAccessor
@@protected_instance_variables = %w(@parts)
cattr_reader :protected_instance_variables
self.protected_instance_variables.concat %w(@parts @mail_was_called @headers)
# Specify the BCC addresses for the message
adv_attr_accessor :bcc
@@ -42,11 +40,11 @@ module ActionMailer
# The recipient addresses for the message, either as a string (for a single
# address) or an array (for multiple addresses).
adv_attr_accessor :recipients
adv_attr_accessor :recipients, "Please pass :to as hash key to mail() instead"
# The date on which the message was sent. If not set (the default), the
# header will be set by the delivery agent.
adv_attr_accessor :sent_on
adv_attr_accessor :sent_on, "Please pass :date as hash key to mail() instead"
# Specify the subject of the message.
adv_attr_accessor :subject
@@ -54,20 +52,12 @@ module ActionMailer
# Specify the template name to use for current message. This is the "base"
# template name, without the extension or directory, and may be used to
# have multiple mailer methods share the same template.
adv_attr_accessor :template
# Override the mailer name, which defaults to an inflected version of the
# mailer's class name. If you want to use a template in a non-standard
# location, you can use this to specify that location.
adv_attr_accessor :mailer_name
adv_attr_accessor :template, "Please pass :template_name or :template_path as hash key to mail() instead"
# Define the body of the message. This is either a Hash (in which case it
# specifies the variables to pass to the template when it is rendered),
# or a string, in which case it specifies the actual text of the message.
adv_attr_accessor :body
# Alias controller_path to mailer_name so render :partial in views work.
alias :controller_path :mailer_name
end
def process(method_name, *args)
@@ -84,6 +74,8 @@ module ActionMailer
# part itself is yielded to the block so that other properties (charset,
# body, headers, etc.) can be set on it.
def part(params)
ActiveSupport::Deprecation.warn "part() is deprecated and will be removed in future versions. " <<
"Please pass a block to mail() instead."
params = {:content_type => params} if String === params
if custom_headers = params.delete(:headers)
@@ -99,6 +91,8 @@ module ActionMailer
# Add an attachment to a multipart message. This is simply a part with the
# content-disposition set to "attachment".
def attachment(params, &block)
ActiveSupport::Deprecation.warn "attachment() is deprecated and will be removed in future versions. " <<
"Please use the attachments[] API instead."
params = { :content_type => params } if String === params
params[:content] ||= params.delete(:data) || params.delete(:body)
@@ -148,11 +142,11 @@ module ActionMailer
def create_mail
m = @_message
set_fields!({:subject => subject, :to => recipients, :from => from,
:bcc => bcc, :cc => cc, :reply_to => reply_to}, charset)
set_fields!({:subject => @subject, :to => @recipients, :from => @from,
:bcc => @bcc, :cc => @cc, :reply_to => @reply_to}, @charset)
m.mime_version = mime_version unless mime_version.nil?
m.date = sent_on.to_time rescue sent_on if sent_on
m.mime_version = @mime_version if @mime_version
m.date = @sent_on.to_time rescue @sent_on if @sent_on
@headers.each { |k, v| m[k] = v }
@@ -191,6 +185,8 @@ module ActionMailer
@implicit_parts_order ||= self.class.default[:parts_order].try(:dup)
@mime_version ||= self.class.default[:mime_version].try(:dup)
@cc, @bcc, @reply_to, @subject, @from, @recipients = nil, nil, nil, nil, nil, nil
@mailer_name ||= self.class.mailer_name.dup
@template ||= method_name
@mail_was_called = false
@@ -205,7 +201,7 @@ module ActionMailer
if String === @body
@parts.unshift create_inline_part(@body)
elsif @parts.empty? || @parts.all? { |p| p.content_disposition =~ /^attachment/ }
lookup_context.find_all(@template, @mailer_name).each do |template|
lookup_context.find_all(@template, [@mailer_name]).each do |template|
self.formats = template.formats
@parts << create_inline_part(render(:template => template), template.mime_type)
end
@@ -216,7 +212,7 @@ module ActionMailer
# If this is a multipart e-mail add the mime_version if it is not
# already set.
@mime_version ||= "1.0" if !@parts.empty?
@mime_version ||= "1.0" unless @parts.empty?
end
end
@@ -246,13 +242,13 @@ module ActionMailer
ct.to_s.split("/")
end
def parse_content_type(defaults=nil)
def parse_content_type
if @content_type.blank?
[ nil, {} ]
else
ctype, *attrs = @content_type.split(/;\s*/)
attrs = attrs.inject({}) { |h,s| k,v = s.split(/\=/, 2); h[k] = v; h }
[ctype, {"charset" => @charset}.merge(attrs)]
attrs = Hash[attrs.map { |attr| attr.split(/=/, 2) }]
[ctype, {"charset" => @charset}.merge!(attrs)]
end
end
end

View File

@@ -1,5 +1,6 @@
require "action_mailer"
require "rails"
require "abstract_controller/railties/routes_helpers"
module ActionMailer
class Railtie < Rails::Railtie
@@ -13,12 +14,18 @@ module ActionMailer
paths = app.config.paths
options = app.config.action_mailer
options.assets_dir ||= paths.public.to_a.first
options.javascripts_dir ||= paths.public.javascripts.to_a.first
options.stylesheets_dir ||= paths.public.stylesheets.to_a.first
options.assets_dir ||= paths["public"].first
options.javascripts_dir ||= paths["public/javascripts"].first
options.stylesheets_dir ||= paths["public/stylesheets"].first
# make sure readers methods get compiled
options.asset_path ||= app.config.asset_path
options.asset_host ||= app.config.asset_host
ActiveSupport.on_load(:action_mailer) do
include app.routes.url_helpers
include AbstractController::UrlFor
extend ::AbstractController::Railties::RoutesHelpers.with(app.routes)
include app.routes.mounted_helpers
register_interceptors(options.delete(:interceptors))
register_observers(options.delete(:observers))
@@ -26,5 +33,11 @@ module ActionMailer
options.each { |k,v| send("#{k}=", v) }
end
end
initializer "action_mailer.compile_config_methods" do
ActiveSupport.on_load(:action_mailer) do
config.compile_methods! if config.respond_to?(:compile_methods!)
end
end
end
end
end

View File

@@ -1,3 +1,5 @@
require 'active_support/core_ext/class/attribute'
module ActionMailer
class NonInferrableMailerError < ::StandardError
def initialize(name)
@@ -15,11 +17,11 @@ module ActionMailer
module ClassMethods
def tests(mailer)
write_inheritable_attribute(:mailer_class, mailer)
self._mailer_class = mailer
end
def mailer_class
if mailer = read_inheritable_attribute(:mailer_class)
if mailer = self._mailer_class
mailer
else
tests determine_default_mailer(name)
@@ -65,6 +67,7 @@ module ActionMailer
end
included do
class_attribute :_mailer_class
setup :initialize_test_deliveries
setup :set_expected_mail
end

View File

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

View File

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

View File

@@ -1,4 +1,5 @@
Description:
============
Stubs out a new mailer and its views. Pass the mailer name, either
CamelCased or under_scored, and an optional list of emails as arguments.
@@ -6,10 +7,12 @@ Description:
engine and test framework generators.
Example:
`rails generate mailer Notifications signup forgot_password invoice`
========
rails generate mailer Notifications signup forgot_password invoice
creates a Notifications mailer class, views, test, and fixtures:
Mailer: app/mailers/notifications.rb
Views: app/views/notifications/signup.erb [...]
Test: test/functional/notifications_test.rb
Fixtures: test/fixtures/notifications/signup [...]

View File

@@ -1,6 +1,7 @@
<% module_namespacing do -%>
class <%= class_name %> < ActionMailer::Base
default :from => "from@example.com"
<% for action in actions -%>
default <%= key_value :from, '"from@example.com"' %>
<% actions.each do |action| -%>
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
@@ -10,7 +11,8 @@ class <%= class_name %> < ActionMailer::Base
def <%= action %>
@greeting = "Hi"
mail :to => "to@example.org"
mail <%= key_value :to, '"to@example.org"' %>
end
<% end -%>
end
<% end -%>

View File

@@ -23,11 +23,6 @@ if "ruby".encoding_aware?
end
end
silence_warnings do
# These external dependencies have warnings :/
require 'mail'
end
lib = File.expand_path("#{File.dirname(__FILE__)}/../lib")
$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib)
@@ -35,6 +30,11 @@ require 'test/unit'
require 'action_mailer'
require 'action_mailer/test_case'
silence_warnings do
# These external dependencies have warnings :/
require 'mail'
end
# Show backtraces for deprecated behavior for quicker cleanup.
ActiveSupport::Deprecation.debug = true
@@ -77,3 +77,5 @@ end
def restore_delivery_method
ActionMailer::Base.delivery_method = @old_delivery_method
end
ActiveSupport::Deprecation.silenced = true

View File

@@ -3,9 +3,9 @@ require 'action_controller'
class AssetHostMailer < ActionMailer::Base
def email_with_asset
recipients 'test@localhost'
subject "testing email containing asset path while asset_host is set"
from "tester@example.com"
mail :to => 'test@localhost',
:subject => 'testing email containing asset path while asset_host is set',
:from => 'tester@example.com'
end
end
@@ -29,7 +29,7 @@ class AssetHostTest < Test::Unit::TestCase
assert_equal %Q{<img alt="Somelogo" src="http://www.example.com/images/somelogo.png" />}, mail.body.to_s.strip
end
def test_asset_host_as_one_arguement_proc
def test_asset_host_as_one_argument_proc
AssetHostMailer.config.asset_host = Proc.new { |source|
if source.starts_with?('/images')
"http://images.example.com"
@@ -41,7 +41,7 @@ class AssetHostTest < Test::Unit::TestCase
assert_equal %Q{<img alt="Somelogo" src="http://images.example.com/images/somelogo.png" />}, mail.body.to_s.strip
end
def test_asset_host_as_two_arguement_proc
def test_asset_host_as_two_argument_proc
ActionController::Base.config.asset_host = Proc.new {|source,request|
if request && request.ssl?
"https://www.example.com"

View File

@@ -7,9 +7,6 @@ require 'mailers/proc_mailer'
require 'mailers/asset_mailer'
class BaseTest < ActiveSupport::TestCase
# TODO Add some tests for implicity layout render and url helpers
# so we can get rid of old base tests altogether with old base.
def teardown
ActionMailer::Base.asset_host = nil
ActionMailer::Base.assets_dir = nil
@@ -35,21 +32,21 @@ class BaseTest < ActiveSupport::TestCase
end
test "mail() with bcc, cc, content_type, charset, mime_version, reply_to and date" do
@time = Time.now.beginning_of_day.to_datetime
time = Time.now.beginning_of_day.to_datetime
email = BaseMailer.welcome(:bcc => 'bcc@test.lindsaar.net',
:cc => 'cc@test.lindsaar.net',
:content_type => 'multipart/mixed',
:charset => 'iso-8559-1',
:mime_version => '2.0',
:reply_to => 'reply-to@test.lindsaar.net',
:date => @time)
:date => time)
assert_equal(['bcc@test.lindsaar.net'], email.bcc)
assert_equal(['cc@test.lindsaar.net'], email.cc)
assert_equal('multipart/mixed; charset=iso-8559-1', email.content_type)
assert_equal('iso-8559-1', email.charset)
assert_equal('2.0', email.mime_version)
assert_equal(['reply-to@test.lindsaar.net'], email.reply_to)
assert_equal(@time, email.date)
assert_equal(time, email.date)
end
test "mail() renders the template using the method being processed" do
@@ -76,11 +73,6 @@ class BaseTest < ActiveSupport::TestCase
assert_equal("Not SPAM", email['X-SPAM'].decoded)
end
test "deprecated non-String custom headers" do
email = assert_deprecated { BaseMailer.welcome_with_fixnum_header }
assert_equal("2", email['X-SPAM-COUNT'].decoded)
end
test "can pass random headers in as a hash to mail" do
hash = {'X-Special-Domain-Specific-Header' => "SecretValue",
'In-Reply-To' => '1234@mikel.me.com' }
@@ -111,7 +103,6 @@ class BaseTest < ActiveSupport::TestCase
end
test "attachment with hash" do
skip "failed already"
email = BaseMailer.attachment_with_hash
assert_equal(1, email.attachments.length)
assert_equal('invoice.jpg', email.attachments[0].filename)
@@ -162,8 +153,8 @@ class BaseTest < ActiveSupport::TestCase
assert_equal(2, email.parts.length)
assert_equal("multipart/related", email.mime_type)
assert_equal("multipart/alternative", email.parts[0].mime_type)
assert_equal("text/plain", email.parts[0].parts[0].mime_type)
assert_equal("text/html", email.parts[0].parts[1].mime_type)
assert_equal("text/plain", email.parts[0].parts[0].mime_type)
assert_equal("text/html", email.parts[0].parts[1].mime_type)
assert_equal("logo.png", email.parts[1].filename)
end
@@ -440,13 +431,6 @@ class BaseTest < ActiveSupport::TestCase
assert_equal("TEXT Implicit Multipart", mail.text_part.body.decoded)
end
test "render :file uses render :template semantics and is deprecated" do
mail = nil
assert_deprecated { mail = BaseMailer.implicit_different_template_with_file('implicit_multipart').deliver }
assert_equal("HTML Implicit Multipart", mail.html_part.body.decoded)
assert_equal("TEXT Implicit Multipart", mail.text_part.body.decoded)
end
test "you can specify a different template for explicit render" do
mail = BaseMailer.explicit_different_template('explicit_multipart_templates').deliver
assert_equal("HTML Explicit Multipart Templates", mail.html_part.body.decoded)

View File

@@ -1,6 +1,5 @@
require 'abstract_unit'
require 'action_controller'
require 'action_dispatch/testing/integration'
class I18nTestMailer < ActionMailer::Base
configure do |c|
@@ -16,16 +15,6 @@ class I18nTestMailer < ActionMailer::Base
end
class TestController < ActionController::Base
Routes = ActionDispatch::Routing::RouteSet.new
Routes.draw do
match ':controller(/:action(/:id))'
end
def self._routes
Routes
end
def send_mail
I18nTestMailer.mail_with_i18n_subject("test@localhost").deliver
render :text => 'Mail sent'
@@ -33,8 +22,13 @@ class TestController < ActionController::Base
end
class ActionMailerI18nWithControllerTest < ActionDispatch::IntegrationTest
Routes = ActionDispatch::Routing::RouteSet.new
Routes.draw do
match ':controller(/:action(/:id))'
end
def app
TestController::Routes
Routes
end
def setup

View File

@@ -14,6 +14,14 @@ class HelperMailer < ActionMailer::Base
end
end
def use_format_paragraph
@text = "But soft! What light through yonder window breaks?"
mail_with_defaults do |format|
format.html { render(:inline => "<%= format_paragraph @text, 15, 1 %>") }
end
end
def use_mailer
mail_with_defaults do |format|
format.html { render(:inline => "<%= mailer.message.subject %>") }
@@ -50,5 +58,10 @@ class MailerHelperTest < ActionMailer::TestCase
mail = HelperMailer.use_message
assert_match "using helpers", mail.body.encoded
end
def test_use_format_paragraph
mail = HelperMailer.use_format_paragraph
assert_match " But soft! What\r\n light through\r\n yonder window\r\n breaks?", mail.body.encoded
end
end

View File

@@ -1,53 +1,45 @@
require 'abstract_unit'
class AutoLayoutMailer < ActionMailer::Base
default :to => 'test@localhost',
:subject => "You have a mail",
:from => "tester@example.com"
def hello
recipients 'test@localhost'
subject "You have a mail"
from "tester@example.com"
mail()
end
def spam
recipients 'test@localhost'
subject "You have a mail"
from "tester@example.com"
@world = "Earth"
body render(:inline => "Hello, <%= @world %>", :layout => 'spam')
mail(:body => render(:inline => "Hello, <%= @world %>", :layout => 'spam'))
end
def nolayout
recipients 'test@localhost'
subject "You have a mail"
from "tester@example.com"
@world = "Earth"
body render(:inline => "Hello, <%= @world %>", :layout => false)
mail(:body => render(:inline => "Hello, <%= @world %>", :layout => false))
end
def multipart(type = nil)
recipients 'test@localhost'
subject "You have a mail"
from "tester@example.com"
content_type(type) if type
mail(:content_type => type) do |format|
format.text { render }
format.html { render }
end
end
end
class ExplicitLayoutMailer < ActionMailer::Base
layout 'spam', :except => [:logout]
default :to => 'test@localhost',
:subject => "You have a mail",
:from => "tester@example.com"
def signup
recipients 'test@localhost'
subject "You have a mail"
from "tester@example.com"
mail()
end
def logout
recipients 'test@localhost'
subject "You have a mail"
from "tester@example.com"
mail()
end
end
@@ -91,19 +83,6 @@ class LayoutMailerTest < Test::Unit::TestCase
assert_equal "Hello from layout text/html multipart", mail.parts.last.body.to_s
end
def test_should_fix_multipart_layout
mail = AutoLayoutMailer.multipart("text/plain")
assert_equal "multipart/alternative", mail.mime_type
assert_equal 2, mail.parts.size
assert_equal 'text/plain', mail.parts.first.mime_type
assert_equal "text/plain layout - text/plain multipart", mail.parts.first.body.to_s
assert_equal 'text/html', mail.parts.last.mime_type
assert_equal "Hello from layout text/html multipart", mail.parts.last.body.to_s
end
def test_should_pickup_layout_given_to_render
mail = AutoLayoutMailer.spam
assert_equal "Spammer layout Hello, Earth", mail.body.to_s.strip

View File

@@ -10,11 +10,6 @@ class BaseMailer < ActionMailer::Base
mail({:subject => "The first email on new API!"}.merge!(hash))
end
def welcome_with_fixnum_header(hash = {})
headers['X-SPAM-COUNT'] = 2
mail({:template_name => "welcome", :subject => "The first email on new API!"}.merge!(hash))
end
def welcome_with_headers(hash = {})
headers hash
mail
@@ -103,13 +98,6 @@ class BaseMailer < ActionMailer::Base
mail(:template_name => template_name)
end
def implicit_different_template_with_file(template_name='')
mail do |format|
format.text { render :file => template_name }
format.html { render :file => template_name }
end
end
def explicit_different_template(template_name='')
mail do |format|
format.text { render :template => "#{mailer_name}/#{template_name}" }
@@ -125,6 +113,6 @@ class BaseMailer < ActionMailer::Base
end
def email_with_translations
body render("email_with_translations.html")
mail :body => render("email_with_translations.html")
end
end

View File

@@ -11,9 +11,14 @@ class AdvAttrTest < ActiveSupport::TestCase
end
def setup
ActiveSupport::Deprecation.silenced = true
@person = Person.new
end
def teardown
ActiveSupport::Deprecation.silenced = false
end
def test_adv_attr
assert_nil @person.name
@person.name 'Bob'

View File

@@ -19,18 +19,6 @@ class RenderMailer < ActionMailer::Base
body render(:file => "templates/signed_up")
end
def rxml_template
recipients 'test@localhost'
subject "rendering rxml template"
from "tester@example.com"
end
def included_subtemplate
recipients 'test@localhost'
subject "Including another template in the one being rendered"
from "tester@example.com"
end
def no_instance_variable
recipients 'test@localhost'
subject "No Instance Variable"
@@ -41,11 +29,6 @@ class RenderMailer < ActionMailer::Base
end
end
def initialize_defaults(method_name)
super
mailer_name "test_mailer"
end
def multipart_alternative
recipients 'test@localhost'
subject 'multipart/alternative'
@@ -97,11 +80,13 @@ class RenderHelperTest < Test::Unit::TestCase
set_delivery_method :test
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.deliveries.clear
ActiveSupport::Deprecation.silenced = true
@recipient = 'test@localhost'
end
def teardown
ActiveSupport::Deprecation.silenced = false
restore_delivery_method
end
@@ -115,35 +100,16 @@ class RenderHelperTest < Test::Unit::TestCase
assert_equal "Hello there,\n\nMr. test@localhost", mail.body.to_s.strip
end
def test_rxml_template
mail = RenderMailer.rxml_template.deliver
assert_equal %(<?xml version="1.0" encoding="UTF-8"?>\n<test/>), mail.body.to_s.strip
end
def test_included_subtemplate
mail = RenderMailer.included_subtemplate.deliver
assert_equal "Hey Ho, let's go!", mail.body.to_s.strip
end
def test_no_instance_variable
mail = RenderMailer.no_instance_variable.deliver
assert_equal "Look, subject.nil? is true!", mail.body.to_s.strip
end
def test_legacy_multipart_alternative
mail = RenderMailer.multipart_alternative.deliver
assert_equal(2, mail.parts.size)
assert_equal("multipart/alternative", mail.mime_type)
assert_equal("text/plain", mail.parts[0].mime_type)
assert_equal("foo: bar", mail.parts[0].body.encoded)
assert_equal("text/html", mail.parts[1].mime_type)
assert_equal("<strong>foo</strong> bar", mail.parts[1].body.encoded)
end
end
class FirstSecondHelperTest < Test::Unit::TestCase
def setup
set_delivery_method :test
ActiveSupport::Deprecation.silenced = true
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.deliveries.clear
@@ -151,6 +117,7 @@ class FirstSecondHelperTest < Test::Unit::TestCase
end
def teardown
ActiveSupport::Deprecation.silenced = false
restore_delivery_method
end

View File

@@ -328,21 +328,20 @@ class ActionMailerTest < Test::Unit::TestCase
mail
end
# Replacing logger work around for mocha bug. Should be fixed in mocha 0.3.3
def setup
set_delivery_method :test
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.deliveries.clear
ActiveSupport::Deprecation.silenced = true
@original_logger = TestMailer.logger
@recipient = 'test@localhost'
TestMailer.delivery_method = :test
end
def teardown
TestMailer.logger = @original_logger
ActiveSupport::Deprecation.silenced = false
restore_delivery_method
end
@@ -515,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
@@ -526,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
@@ -659,8 +660,6 @@ class ActionMailerTest < Test::Unit::TestCase
end
def test_performs_delivery_via_sendmail
skip "failed already"
IO.expects(:popen).once.with('/usr/sbin/sendmail -i -t -f "system@loudthinking.com" test@localhost', 'w+')
TestMailer.delivery_method = :sendmail
TestMailer.signed_up(@recipient).deliver
@@ -715,7 +714,7 @@ Content-Transfer-Encoding: quoted-printable
The=3Dbody
EOF
mail = Mail.new(msg.strip)
mail = Mail.new(msg)
assert_equal "The=body", mail.body.to_s.strip
assert_equal "The=3Dbody=", mail.body.encoded.strip
end
@@ -982,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))
@@ -992,10 +991,10 @@ EOF
def test_recursive_multipart_processing
fixture = File.read(File.dirname(__FILE__) + "/../fixtures/raw_email7")
mail = Mail.new(fixture.strip)
mail = Mail.new(fixture)
assert_equal(2, mail.parts.length)
assert_equal(4, mail.parts.first.parts.length)
assert_equal("This is the first part.\n", mail.parts.first.parts.first.body.to_s)
assert_equal("This is the first part.", mail.parts.first.parts.first.body.to_s)
assert_equal("test.rb", mail.parts.first.parts.second.filename)
assert_equal("flowed", mail.parts.first.parts.fourth.content_type_parameters[:format])
assert_equal('smime.p7s', mail.parts.second.filename)
@@ -1098,113 +1097,3 @@ EOF
TestMailer.smtp_settings.merge!(:enable_starttls_auto => true)
end
end
class InheritableTemplateRootTest < ActiveSupport::TestCase
def test_attr
expected = File.expand_path("#{File.dirname(__FILE__)}/../fixtures/path.with.dots")
assert_equal expected, FunkyPathMailer.template_root.to_s
sub = Class.new(FunkyPathMailer)
assert_deprecated do
sub.template_root = 'test/path'
end
assert_equal File.expand_path('test/path'), sub.template_root.to_s
assert_equal expected, FunkyPathMailer.template_root.to_s
end
end
class MethodNamingTest < ActiveSupport::TestCase
include ActionMailer::TestHelper
class TestMailer < ActionMailer::Base
def send
body 'foo'
end
end
def setup
set_delivery_method :test
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.deliveries.clear
end
def teardown
restore_delivery_method
end
def test_send_method
skip "failed already"
assert_nothing_raised do
assert_emails 1 do
assert_deprecated do
TestMailer.deliver_send
end
end
end
end
end
class RespondToTest < Test::Unit::TestCase
class RespondToMailer < ActionMailer::Base; end
def setup
set_delivery_method :test
end
def teardown
restore_delivery_method
end
def test_should_respond_to_new
assert_respond_to RespondToMailer, :new
end
def test_should_respond_to_create_with_template_suffix
assert_respond_to RespondToMailer, :create_any_old_template
end
def test_should_respond_to_deliver_with_template_suffix
assert_respond_to RespondToMailer, :deliver_any_old_template
end
def test_should_not_respond_to_new_with_template_suffix
assert !RespondToMailer.respond_to?(:new_any_old_template)
end
def test_should_not_respond_to_create_with_template_suffix_unless_it_is_separated_by_an_underscore
assert !RespondToMailer.respond_to?(:createany_old_template)
end
def test_should_not_respond_to_deliver_with_template_suffix_unless_it_is_separated_by_an_underscore
assert !RespondToMailer.respond_to?(:deliverany_old_template)
end
def test_should_not_respond_to_create_with_template_suffix_if_it_begins_with_a_uppercase_letter
assert !RespondToMailer.respond_to?(:create_Any_old_template)
end
def test_should_not_respond_to_deliver_with_template_suffix_if_it_begins_with_a_uppercase_letter
assert !RespondToMailer.respond_to?(:deliver_Any_old_template)
end
def test_should_not_respond_to_create_with_template_suffix_if_it_begins_with_a_digit
assert !RespondToMailer.respond_to?(:create_1_template)
end
def test_should_not_respond_to_deliver_with_template_suffix_if_it_begins_with_a_digit
assert !RespondToMailer.respond_to?(:deliver_1_template)
end
def test_should_not_respond_to_method_where_deliver_is_not_a_suffix
assert !RespondToMailer.respond_to?(:foo_deliver_template)
end
def test_should_still_raise_exception_with_expected_message_when_calling_an_undefined_method
error = assert_raise NoMethodError do
RespondToMailer.not_a_method
end
assert_match(/method.*not_a_method/, error.message)
end
end

View File

@@ -1,6 +1,14 @@
require 'abstract_unit'
class TmailCompatTest < ActiveSupport::TestCase
def setup
@silence = ActiveSupport::Deprecation.silenced
ActiveSupport::Deprecation.silenced = false
end
def teardown
ActiveSupport::Deprecation.silenced = @silence
end
def test_set_content_type_raises_deprecation_warning
mail = Mail.new
@@ -31,5 +39,4 @@ class TmailCompatTest < ActiveSupport::TestCase
end
assert_equal mail.content_transfer_encoding, "base64"
end
end

View File

@@ -2,11 +2,10 @@ require 'abstract_unit'
class TestHelperMailer < ActionMailer::Base
def test
recipients "test@example.com"
from "tester@example.com"
@world = "Earth"
render(:inline => "Hello, <%= @world %>")
mail :body => render(:inline => "Hello, <%= @world %>"),
:to => "test@example.com",
:from => "tester@example.com"
end
end

View File

@@ -18,13 +18,10 @@ class UrlTestMailer < ActionMailer::Base
end
def signed_up_with_url(recipient)
@recipients = recipient
@subject = "[Signed up] Welcome #{recipient}"
@from = "system@loudthinking.com"
@sent_on = Time.local(2004, 12, 12)
@recipient = recipient
@welcome_url = url_for :host => "example.com", :controller => "welcome", :action => "greeting"
mail(:to => recipient, :subject => "[Signed up] Welcome #{recipient}",
:from => "system@loudthinking.com", :date => Time.local(2004, 12, 12))
end
end
@@ -47,6 +44,7 @@ class ActionMailerUrlTest < ActionMailer::TestCase
set_delivery_method :test
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.deliveries.clear
ActiveSupport::Deprecation.silenced = false
@recipient = 'test@localhost'
end
@@ -58,12 +56,10 @@ class ActionMailerUrlTest < ActionMailer::TestCase
def test_signed_up_with_url
UrlTestMailer.delivery_method = :test
# assert_deprecated do
AppRoutes.draw do |map|
map.connect ':controller/:action/:id'
map.welcome 'welcome', :controller=>"foo", :action=>"bar"
end
# end
AppRoutes.draw do
match ':controller(/:action(/:id))'
match '/welcome' => "foo#bar", :as => "welcome"
end
expected = new_mail
expected.to = @recipient
@@ -71,6 +67,7 @@ class ActionMailerUrlTest < ActionMailer::TestCase
expected.body = "Hello there,\n\nMr. #{@recipient}. Please see our greeting at http://example.com/welcome/greeting http://www.basecamphq.com/welcome\n\n<img alt=\"Somelogo\" src=\"/images/somelogo.png\" />"
expected.from = "system@loudthinking.com"
expected.date = Time.local(2004, 12, 12)
expected.content_type = "text/html"
created = nil
assert_nothing_raised { created = UrlTestMailer.signed_up_with_url(@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

@@ -1,4 +1,4 @@
Copyright (c) 2004-2010 David Heinemeier Hansson
Copyright (c) 2004-2011 David Heinemeier Hansson
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@@ -19,9 +19,8 @@ It consists of several modules:
* Action View, which handles view template lookup and rendering, and provides
view helpers that assist when building HTML forms, Atom feeds and more.
Template formats that Action View handles are ERb (embedded Ruby, typically
used to inline short Ruby snippets inside HTML), XML Builder and RJS
(dynamically generated JavaScript from Ruby code).
Template formats that Action View handles are ERB (embedded Ruby, typically
used to inline short Ruby snippets inside HTML), and XML Builder.
With the Ruby on Rails framework, users only directly interface with the
Action Controller module. Necessary Action Dispatch functionality is activated
@@ -34,7 +33,7 @@ A short rundown of some of the major features:
* Actions grouped in controller as methods instead of separate command objects
and can therefore share helper methods
CustomersController < ActionController::Base
class CustomersController < ActionController::Base
def show
@customer = find_customer
end
@@ -57,9 +56,9 @@ A short rundown of some of the major features:
{Learn more}[link:classes/ActionController/Base.html]
* ERb templates (static content mixed with dynamic output from ruby)
* ERB templates (static content mixed with dynamic output from ruby)
<% for post in @posts %>
<% @posts.each do |post| %>
Title: <%= post.title %>
<% end %>
@@ -82,7 +81,7 @@ A short rundown of some of the major features:
xml.language "en-us"
xml.ttl "40"
for item in @recent_items
@recent_items.each do |item|
xml.item do
xml.title(item_title(item))
xml.description(item_description(item))
@@ -262,7 +261,7 @@ methods:
layout "weblog/layout"
def index
@posts = Post.find(:all)
@posts = Post.all
end
def show
@@ -294,7 +293,7 @@ And the templates look like this:
</body></html>
weblog/index.html.erb:
<% for post in @posts %>
<% @posts.each do |post| %>
<p><%= link_to(post.title, :action => "show", :id => post.id) %></p>
<% end %>
@@ -323,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
* http://github.com/rails/rails/tree/master/actionpack/
* https://github.com/rails/rails/tree/master/actionpack
== License
@@ -339,4 +338,4 @@ API documentation is at
Bug reports and feature requests can be filed with the rest for the Ruby on Rails project here:
* https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets
* https://github.com/rails/rails/issues

View File

@@ -8,15 +8,18 @@ Rake can be found at http://rake.rubyforge.org
== Running by hand
If you only want to run a single test suite, or don't want to bother with Rake,
you can do so with something like:
To run a single test suite
ruby -Itest test/controller/base_tests.rb
rake test TEST=path/to/test.rb
== Dependency on ActiveRecord and database setup
which can be further narrowed down to one test:
rake test TEST=path/to/test.rb TESTOPTS="--name=test_something"
== Dependency on Active Record and database setup
Test cases in the test/controller/active_record/ directory depend on having
activerecord and sqlite installed. If ActiveRecord is not in
activerecord and sqlite installed. If Active Record is not in
actionpack/../activerecord directory, or the sqlite rubygem is not installed,
these tests are skipped.

5
actionpack/Rakefile Normal file → Executable file
View File

@@ -1,4 +1,4 @@
require 'rake'
#!/usr/bin/env rake
require 'rake/testtask'
require 'rake/packagetask'
require 'rubygems/package_task'
@@ -18,7 +18,8 @@ Rake::TestTask.new(:test_action_pack) do |t|
# this will not happen automatically and the tests (as a whole) will error
t.test_files = Dir.glob('test/{abstract,controller,dispatch,template}/**/*_test.rb').sort
# t.warning = true
t.warning = true
t.verbose = true
end
namespace :test do

View File

@@ -11,19 +11,21 @@ Gem::Specification.new do |s|
s.author = 'David Heinemeier Hansson'
s.email = 'david@loudthinking.com'
s.homepage = 'http://www.rubyonrails.org'
s.rubyforge_project = 'actionpack'
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('builder', '~> 3.2.0')
s.add_dependency('i18n', '~> 0.6.0')
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.6.14')
s.add_dependency('tzinfo', '~> 0.3.23')
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

@@ -24,4 +24,5 @@ module AbstractController
autoload :Translation
autoload :AssetPaths
autoload :ViewPaths
autoload :UrlFor
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
config_accessor :asset_host, :asset_path, :assets_dir, :javascripts_dir,
:stylesheets_dir, :default_asset_host_protocol
end
end
end
end

View File

@@ -1,3 +1,4 @@
require 'erubis'
require 'active_support/configurable'
require 'active_support/descendants_tracker'
require 'active_support/core_ext/module/anonymous'
@@ -9,7 +10,7 @@ module AbstractController
# <tt>AbstractController::Base</tt> is a low-level API. Nobody should be
# using it directly, and subclasses (like ActionController::Base) are
# expected to provide their own +render+ method, since rendering means
# different things depending on the context.
# different things depending on the context.
class Base
attr_internal :response_body
attr_internal :action_name
@@ -18,6 +19,7 @@ module AbstractController
include ActiveSupport::Configurable
extend ActiveSupport::DescendantsTracker
undef_method :not_implemented
class << self
attr_reader :abstract
alias_method :abstract?, :abstract
@@ -61,13 +63,13 @@ module AbstractController
def action_methods
@action_methods ||= begin
# All public instance methods of this class, including ancestors
methods = public_instance_methods(true).map { |m| m.to_s }.to_set -
methods = (public_instance_methods(true) -
# Except for public instance methods of Base and its ancestors
internal_methods.map { |m| m.to_s } +
internal_methods +
# Be sure to include shadowed public instance methods of this class
public_instance_methods(false).map { |m| m.to_s } -
public_instance_methods(false)).uniq.map { |x| x.to_s } -
# And always exclude explicitly hidden actions
hidden_actions
hidden_actions.to_a
# Clear out AS callback method pollution
methods.reject { |method| method =~ /_one_time_conditions/ }
@@ -128,17 +130,29 @@ module AbstractController
self.class.action_methods
end
# Returns true if a method for the action is available and
# can be dispatched, false otherwise.
#
# Notice that <tt>action_methods.include?("foo")</tt> may return
# false and <tt>available_action?("foo")</tt> returns true because
# available action consider actions that are also available
# through other means, for example, implicit render ones.
def available_action?(action_name)
method_for_action(action_name).present?
end
private
# Returns true if the name can be considered an action. This can
# be overridden in subclasses to modify the semantics of what
# can be considered an action.
# Returns true if the name can be considered an action because
# it has a method defined in the controller.
#
# ==== Parameters
# * <tt>name</tt> - The name of an action to be tested
#
# ==== Returns
# * <tt>TrueClass</tt>, <tt>FalseClass</tt>
#
# :api: private
def action_method?(name)
self.class.action_methods.include?(name)
end
@@ -146,6 +160,9 @@ module AbstractController
# Call the action. Override this in a subclass to modify the
# behavior around processing an action. This, and not #process,
# is the intended way to override action dispatching.
#
# Notice that the first argument is the method to be dispatched
# which is *not* necessarily the same as the action name.
def process_action(method_name, *args)
send_action(method_name, *args)
end
@@ -160,12 +177,10 @@ module AbstractController
# If the action name was not found, but a method called "action_missing"
# was found, #method_for_action will return "_handle_action_missing".
# This method calls #action_missing with the current action name.
def _handle_action_missing
action_missing(@_action_name)
def _handle_action_missing(*args)
action_missing(@_action_name, *args)
end
CVE_2014_0130 = Class.new(StandardError)
# Takes an action name and returns the name of the method that will
# handle the action. In normal cases, this method returns the same
# name as it receives. By default, if #method_for_action receives
@@ -190,10 +205,6 @@ module AbstractController
# * <tt>string</tt> - The name of the method that handles the action
# * <tt>nil</tt> - No method name could be found. Raise ActionNotFound.
def method_for_action(action_name)
if action_name.include?("/")
raise CVE_2014_0130
end
if action_method?(action_name) then action_name
elsif respond_to?(:action_missing, true) then "_handle_action_missing"
end

View File

@@ -13,7 +13,7 @@ module AbstractController
# Override AbstractController::Base's process_action to run the
# process_action callbacks around the normal behavior.
def process_action(method_name, *args)
def process_action(*args)
run_callbacks(:process_action, action_name) do
super
end
@@ -29,7 +29,7 @@ module AbstractController
#
# ==== Options
# * <tt>only</tt> - The callback should be run only for this action
# * <tt>except<tt> - The callback should be run for all actions except this action
# * <tt>except</tt> - The callback should be run for all actions except this action
def _normalize_callback_options(options)
if only = options[:only]
only = Array(only).map {|o| "action_name == '#{o}'"}.join(" || ")
@@ -81,29 +81,29 @@ module AbstractController
class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
# Append a before, after or around filter. See _insert_callbacks
# for details on the allowed parameters.
def #{filter}_filter(*names, &blk) # def before_filter(*names, &blk)
_insert_callbacks(names, blk) do |name, options| # _insert_callbacks(names, blk) do |name, options}
options[:if]=(Array.wrap(options[:if]) << "!halted") if #{filter == :after}
set_callback(:process_action, :#{filter}, name, options) # set_callback(:process_action, :before_filter, name, options)
end # end
end # end
def #{filter}_filter(*names, &blk)
_insert_callbacks(names, blk) do |name, options|
options[:if] = (Array.wrap(options[:if]) << "!halted") if #{filter == :after}
set_callback(:process_action, :#{filter}, name, options)
end
end
# Prepend a before, after or around filter. See _insert_callbacks
# for details on the allowed parameters.
def prepend_#{filter}_filter(*names, &blk) # def prepend_before_filter(*names, &blk)
_insert_callbacks(names, blk) do |name, options| # _insert_callbacks(names, blk) do |name, options|
options[:if]=(Array.wrap(options[:if]) << "!halted") if #{filter == :after}
set_callback(:process_action, :#{filter}, name, options.merge(:prepend => true)) # set_callback(:process_action, :before, name, options.merge(:prepend => true))
end # end
end # end
def prepend_#{filter}_filter(*names, &blk)
_insert_callbacks(names, blk) do |name, options|
options[:if] = (Array.wrap(options[:if]) << "!halted") if #{filter == :after}
set_callback(:process_action, :#{filter}, name, options.merge(:prepend => true))
end
end
# Skip a before, after or around filter. See _insert_callbacks
# for details on the allowed parameters.
def skip_#{filter}_filter(*names, &blk) # def skip_before_filter(*names, &blk)
_insert_callbacks(names, blk) do |name, options| # _insert_callbacks(names, blk) do |name, options|
skip_callback(:process_action, :#{filter}, name, options) # skip_callback(:process_action, :before, name, options)
end # end
end # end
def skip_#{filter}_filter(*names, &blk)
_insert_callbacks(names, blk) do |name, options|
skip_callback(:process_action, :#{filter}, name, options)
end
end
# *_filter is the same as append_*_filter
alias_method :append_#{filter}_filter, :#{filter}_filter

View File

@@ -4,8 +4,6 @@ module AbstractController
module Helpers
extend ActiveSupport::Concern
include Rendering
included do
class_attribute :_helpers
self._helpers = Module.new
@@ -112,17 +110,6 @@ module AbstractController
default_helper_module! unless anonymous?
end
private
# Makes all the (instance) methods in the helper module available to templates
# rendered through this controller.
#
# ==== Parameters
# * <tt>module</tt> - The module to include into the current helper module
# for the class
def add_template_helper(mod)
_helpers.module_eval { include mod }
end
# Returns a list of modules, normalized from the acceptable kinds of
# helpers with the following behavior:
#
@@ -155,6 +142,17 @@ module AbstractController
end
end
private
# Makes all the (instance) methods in the helper module available to templates
# rendered through this controller.
#
# ==== Parameters
# * <tt>module</tt> - The module to include into the current helper module
# for the class
def add_template_helper(mod)
_helpers.module_eval { include mod }
end
def default_helper_module!
module_name = name.sub(/Controller$/, '')
module_path = module_name.underscore

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.
@@ -265,11 +267,11 @@ module AbstractController
raise ArgumentError, "Layouts must be specified as a String, Symbol, false, or nil"
when nil
if name
_prefix = "layouts" unless _implied_layout_name =~ /\blayouts/
_prefixes = _implied_layout_name =~ /\blayouts/ ? [] : ["layouts"]
self.class_eval <<-RUBY, __FILE__, __LINE__ + 1
def _layout
if template_exists?("#{_implied_layout_name}", #{_prefix.inspect})
if template_exists?("#{_implied_layout_name}", #{_prefixes.inspect})
"#{_implied_layout_name}"
else
super
@@ -292,15 +294,15 @@ module AbstractController
end
end
attr_writer :action_has_layout
attr_internal_writer :action_has_layout
def initialize(*)
@action_has_layout = true
@_action_has_layout = true
super
end
def action_has_layout?
@action_has_layout
@_action_has_layout
end
private
@@ -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_logout</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)
@@ -344,8 +339,7 @@ module AbstractController
begin
layout_name = _layout if action_has_layout?
rescue NameError => e
raise NoMethodError,
"You specified #{@_layout.inspect} as the layout, but no such method was found"
raise e, "Could not render layout: #{e.message}"
end
if require_layout && action_has_layout? && !layout_name

View File

@@ -0,0 +1,18 @@
module AbstractController
module Railties
module RoutesHelpers
def self.with(routes)
Module.new do
define_method(:inherited) do |klass|
super(klass)
if namespace = klass.parents.detect {|m| m.respond_to?(:_railtie) }
klass.send(:include, namespace._railtie.routes.url_helpers)
else
klass.send(:include, routes.url_helpers)
end
end
end
end
end
end
end

View File

@@ -1,5 +1,6 @@
require "abstract_controller/base"
require "action_view"
require "active_support/core_ext/object/instance_variables"
module AbstractController
class DoubleRenderError < Error
@@ -12,7 +13,6 @@ module AbstractController
# This is a class to fix I18n global state. Whenever you provide I18n.locale during a request,
# it will trigger the lookup_context and consequently expire the cache.
# TODO Add some deprecation warnings to remove I18n.locale from controllers
class I18nProxy < ::I18n::Config #:nodoc:
attr_reader :original_config, :lookup_context
@@ -32,9 +32,13 @@ module AbstractController
module Rendering
extend ActiveSupport::Concern
include AbstractController::ViewPaths
included do
config_accessor :protected_instance_variables, :instance_reader => false
self.protected_instance_variables = []
end
# Overwrite process to setup I18n proxy.
def process(*) #:nodoc:
old_config, I18n.config = I18n.config, I18nProxy.new(I18n.config, lookup_context)
@@ -46,31 +50,27 @@ module AbstractController
module ClassMethods
def view_context_class
@view_context_class ||= begin
controller = self
Class.new(ActionView::Base) do
if controller.respond_to?(:_routes)
include controller._routes.url_helpers
end
if controller.respond_to?(:_helpers)
include controller._helpers
# TODO: Fix RJS to not require this
self.helpers = controller._helpers
end
end
routes = _routes if respond_to?(:_routes)
helpers = _helpers if respond_to?(:_helpers)
ActionView::Base.prepare(routes, helpers)
end
end
end
attr_writer :view_context_class
attr_internal_writer :view_context_class
# Explicitly define protected_instance_variables so it can be
# inherited and overwritten by other modules if needed.
def protected_instance_variables
config.protected_instance_variables
end
def view_context_class
@view_context_class || self.class.view_context_class
@_view_context_class || self.class.view_context_class
end
def initialize(*)
@view_context_class = nil
@_view_context_class = nil
super
end
@@ -84,21 +84,26 @@ module AbstractController
#
# Override this method in a module to change the default behavior.
def view_context
view_context_class.new(lookup_context, view_assigns, self)
view_context_class.new(view_renderer, view_assigns, self)
end
# Returns an object that is able to render templates.
def view_renderer
@_view_renderer ||= ActionView::Renderer.new(lookup_context)
end
# Normalize arguments, options and then delegates render_to_body and
# sticks the result in self.response_body.
def render(*args, &block)
self.response_body = render_to_string(*args, &block)
options = _normalize_render(*args, &block)
self.response_body = render_to_body(options)
end
# Raw rendering of a template to a string. Just convert the results of
# render_to_body into a String.
# render_response into a String.
# :api: plugin
def render_to_string(*args, &block)
options = _normalize_args(*args, &block)
_normalize_options(options)
options = _normalize_render(*args, &block)
render_to_body(options)
end
@@ -112,15 +117,13 @@ module AbstractController
# Find and renders a template based on the options given.
# :api: private
def _render_template(options) #:nodoc:
view_context.render(options)
view_renderer.render(view_context, options)
end
# The prefix used in render "foo" shortcuts.
def _prefix
controller_path
end
private
DEFAULT_PROTECTED_INSTANCE_VARIABLES = %w(
@_action_name @_response_body @_formats @_prefixes @_config
@_view_context_class @_view_renderer @_lookup_context
)
# This method should return a hash with assigns.
# You can overwrite this configuration per controller.
@@ -128,42 +131,58 @@ module AbstractController
def view_assigns
hash = {}
variables = instance_variable_names
variables -= protected_instance_variables if respond_to?(:protected_instance_variables)
variables.each { |name| hash[name.to_s[1..-1]] = instance_variable_get(name) }
variables -= protected_instance_variables
variables -= DEFAULT_PROTECTED_INSTANCE_VARIABLES
variables.each { |name| hash[name.to_s[1, name.length]] = instance_variable_get(name) }
hash
end
# Normalize options by converting render "foo" to render :action => "foo" and
private
# Normalize args and options.
# :api: private
def _normalize_render(*args, &block)
options = _normalize_args(*args, &block)
_normalize_options(options)
options
end
# Normalize args by converting render "foo" to render :action => "foo" and
# render "foo/bar" to render :file => "foo/bar".
# :api: plugin
def _normalize_args(action=nil, options={})
case action
when NilClass
when Hash
options, action = action, nil
options = action
when String, Symbol
action = action.to_s
key = action.include?(?/) ? :file : :action
options[key] = action
else
options.merge!(:partial => action)
options[:partial] = action
end
options
end
# Normalize options.
# :api: plugin
def _normalize_options(options)
if options[:partial] == true
options[:partial] = action_name
end
if (options.keys & [:partial, :file, :template]).empty?
options[:prefix] ||= _prefix
options[:prefixes] ||= _prefixes
end
options[:template] ||= (options[:action] || action_name).to_s
options
end
# Process extra options.
# :api: plugin
def _process_options(options)
end
end

View File

@@ -0,0 +1,33 @@
# Includes +url_for+ into the host class (e.g. an abstract controller or mailer). The class
# has to provide a +RouteSet+ by implementing the <tt>_routes</tt> methods. Otherwise, an
# exception will be raised.
#
# Note that this module is completely decoupled from HTTP - the only requirement is a valid
# <tt>_routes</tt> implementation.
module AbstractController
module UrlFor
extend ActiveSupport::Concern
include ActionDispatch::Routing::UrlFor
def _routes
raise "In order to use #url_for, you must include routing helpers explicitly. " \
"For instance, `include Rails.application.routes.url_helpers"
end
module ClassMethods
def _routes
nil
end
def action_methods
@action_methods ||= begin
if _routes
super - _routes.named_routes.helper_names
else
super
end
end
end
end
end
end

View File

@@ -11,11 +11,36 @@ module AbstractController
delegate :find_template, :template_exists?, :view_paths, :formats, :formats=,
:locale, :locale=, :to => :lookup_context
module ClassMethods
def parent_prefixes
@parent_prefixes ||= begin
parent_controller = superclass
prefixes = []
until parent_controller.abstract?
prefixes << parent_controller.controller_path
parent_controller = parent_controller.superclass
end
prefixes
end
end
end
# The prefixes used in render "foo" shortcuts.
def _prefixes
@_prefixes ||= begin
parent_prefixes = self.class.parent_prefixes
parent_prefixes.dup.unshift(controller_path)
end
end
# LookupContext is the object responsible to hold all information required to lookup
# templates, i.e. view paths and details. Check ActionView::LookupContext for more
# information.
def lookup_context
@lookup_context ||= ActionView::LookupContext.new(self.class._view_paths, details_for_lookup)
@_lookup_context ||=
ActionView::LookupContext.new(self.class._view_paths, details_for_lookup, _prefixes)
end
def details_for_lookup
@@ -36,7 +61,7 @@ module AbstractController
# ==== Parameters
# * <tt>path</tt> - If a String is provided, it gets converted into
# the default view path. You may also provide a custom view path
# (see ActionView::ViewPathSet for more information)
# (see ActionView::PathSet for more information)
def append_view_path(path)
self.view_paths = view_paths.dup + Array(path)
end
@@ -46,7 +71,7 @@ module AbstractController
# ==== Parameters
# * <tt>path</tt> - If a String is provided, it gets converted into
# the default view path. You may also provide a custom view path
# (see ActionView::ViewPathSet for more information)
# (see ActionView::PathSet for more information)
def prepend_view_path(path)
self.view_paths = Array(path) + view_paths.dup
end
@@ -59,12 +84,12 @@ module AbstractController
# Set the view paths.
#
# ==== Parameters
# * <tt>paths</tt> - If a ViewPathSet is provided, use that;
# otherwise, process the parameter into a ViewPathSet.
# * <tt>paths</tt> - If a PathSet is provided, use that;
# otherwise, process the parameter into a PathSet.
def view_paths=(paths)
self._view_paths = ActionView::Base.process_view_paths(paths)
self._view_paths.freeze
end
end
end
end
end

View File

@@ -13,7 +13,9 @@ module ActionController
autoload :Compatibility
autoload :ConditionalGet
autoload :Cookies
autoload :DataStreaming
autoload :Flash
autoload :ForceSSL
autoload :Head
autoload :Helpers
autoload :HideActions
@@ -21,6 +23,7 @@ module ActionController
autoload :ImplicitRender
autoload :Instrumentation
autoload :MimeResponds
autoload :ParamsWrapper
autoload :RackDelegation
autoload :Redirecting
autoload :Renderers
@@ -34,14 +37,13 @@ module ActionController
autoload :UrlFor
end
autoload :Dispatcher, 'action_controller/deprecated/dispatcher'
autoload :UrlWriter, 'action_controller/deprecated/url_writer'
autoload :UrlRewriter, 'action_controller/deprecated/url_writer'
autoload :Integration, 'action_controller/deprecated/integration_test'
autoload :IntegrationTest, 'action_controller/deprecated/integration_test'
autoload :PerformanceTest, 'action_controller/deprecated/performance_test'
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
@@ -74,4 +76,5 @@ require 'active_support/core_ext/load_error'
require 'active_support/core_ext/module/attr_internal'
require 'active_support/core_ext/module/delegation'
require 'active_support/core_ext/name_error'
require 'active_support/core_ext/uri'
require 'active_support/inflector'

View File

@@ -24,14 +24,14 @@ module ActionController
#
# Actions, by default, render a template in the <tt>app/views</tt> directory corresponding to the name of the controller and action
# after executing code in the action. For example, the +index+ action of the PostsController would render the
# template <tt>app/views/posts/index.erb</tt> by default after populating the <tt>@posts</tt> instance variable.
# template <tt>app/views/posts/index.html.erb</tt> by default after populating the <tt>@posts</tt> instance variable.
#
# Unlike index, the create action will not render a template. After performing its main purpose (creating a
# new post), it initiates a redirect instead. This redirect works by returning an external
# "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.
@@ -93,9 +93,9 @@ module ActionController
# * ActiveRecord::SessionStore - Sessions are stored in your database, which works better than PStore with multiple app servers and,
# unlike CookieStore, hides your session contents from the user. To use ActiveRecord::SessionStore, set
#
# config.action_controller.session_store = :active_record_store
# MyApplication::Application.config.session_store :active_record_store
#
# in your <tt>config/environment.rb</tt> and run <tt>rake db:sessions:create</tt>.
# in your <tt>config/initializers/session_store.rb</tt> and run <tt>script/rails g session_migration</tt>.
#
# == Responses
#
@@ -105,7 +105,7 @@ module ActionController
# == Renders
#
# Action Controller sends content to the user by using one of five rendering methods. The most versatile and common is the rendering
# of a template. Included in the Action Pack is the Action View, which enables rendering of ERb templates. It's automatically configured.
# of a template. Included in the Action Pack is the Action View, which enables rendering of ERB templates. It's automatically configured.
# The controller passes objects to the view by assigning instance variables:
#
# def show
@@ -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])
@@ -128,13 +128,13 @@ module ActionController
# end
# end
#
# Read more about writing ERb and Builder templates in ActionView::Base.
# Read more about writing ERB and Builder templates in ActionView::Base.
#
# == 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.
#
@@ -198,7 +200,9 @@ module ActionController
Cookies,
Flash,
RequestForgeryProtection,
ForceSSL,
Streaming,
DataStreaming,
RecordIdentifier,
HttpAuthentication::Basic::ControllerMethods,
HttpAuthentication::Digest::ControllerMethods,
@@ -208,12 +212,16 @@ module ActionController
# also include them at the bottom.
AbstractController::Callbacks,
# The same with rescue, append it at the end to wrap as much as possible.
# 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
Instrumentation,
# Params wrapper should come before instrumentation so they are
# properly showed in logs
ParamsWrapper
]
MODULES.each do |mod|
@@ -223,13 +231,6 @@ module ActionController
# Rails 2.x compatibility
include ActionController::Compatibility
def self.inherited(klass)
super
klass.helper :all if klass.superclass == ActionController::Base
end
require "action_controller/deprecated/base"
ActiveSupport.run_load_hooks(:action_controller, self)
end
end

View File

@@ -3,7 +3,7 @@ require 'uri'
require 'set'
module ActionController #:nodoc:
# Caching is a cheap way of speeding up slow applications by keeping the result of
# \Caching is a cheap way of speeding up slow applications by keeping the result of
# calculations, renderings, and database calls around for subsequent requests.
# Action Controller affords you three approaches in varying levels of granularity:
# Page, Action, Fragment.
@@ -14,7 +14,7 @@ module ActionController #:nodoc:
# Note: To turn off all caching and sweeping, set
# config.action_controller.perform_caching = false.
#
# == Caching stores
# == \Caching stores
#
# All the caching stores from ActiveSupport::Cache are available to be used as backends
# for Action Controller caching. This setting only affects action and fragment caching

View File

@@ -31,8 +31,8 @@ module ActionController #:nodoc:
# the subdomain-as-account-key pattern.
#
# Different representations of the same resource, e.g.
# <tt>http://david.somewhere.com/lists</tt> and
# <tt>http://david.somewhere.com/lists.xml</tt>
# <tt>http://david.example.com/lists</tt> and
# <tt>http://david.example.com/lists.xml</tt>
# are treated like separate requests and so are cached separately.
# Keep in mind when expiring an action cache that
# <tt>:action => 'lists'</tt> is not the same as
@@ -56,19 +56,18 @@ module ActionController #:nodoc:
#
# caches_page :public
#
# caches_action :index, :if => proc do |c|
# !c.request.format.json? # cache if is not a JSON request
# caches_action :index, :if => proc do
# !request.format.json? # cache if is not a JSON request
# end
#
# caches_action :show, :cache_path => { :project => 1 },
# :expires_in => 1.hour
#
# caches_action :feed, :cache_path => proc do |c|
# if c.params[:user_id]
# c.send(:user_list_url,
# c.params[:user_id], c.params[:id])
# caches_action :feed, :cache_path => proc do
# if params[:user_id]
# user_list_url(params[:user_id, params[:id])
# else
# c.send(:list_url, c.params[:id])
# list_url(params[:id])
# end
# end
# end
@@ -80,7 +79,7 @@ module ActionController #:nodoc:
# header the Content-Type of the cached response could be wrong because
# no information about the MIME type is stored in the cache key. So, if
# you first ask for MIME type M in the Accept header, a cache entry is
# created, and then perform a second resquest to the same resource asking
# created, and then perform a second request to the same resource asking
# for a different MIME type, you'd get the content cached for M.
#
# The <tt>:format</tt> parameter is taken into account though. The safest
@@ -160,7 +159,7 @@ module ActionController #:nodoc:
attr_reader :path, :extension
# If +infer_extension+ is true, the cache path extension is looked up from the request's
# path & format. This is desirable when reading and writing the cache, but not when
# path and format. This is desirable when reading and writing the cache, but not when
# expiring the cache - expire_action should expire the same files regardless of the
# request format.
def initialize(controller, options = {}, infer_extension = true)
@@ -176,8 +175,8 @@ module ActionController #:nodoc:
private
def normalize!(path)
path << 'index' if path[-1] == ?/
path << ".#{extension}" if extension and !path.ends_with?(extension)
URI.unescape(path)
path << ".#{extension}" if extension and !path.split('?').first.ends_with?(".#{extension}")
URI.parser.unescape(path)
end
end
end

View File

@@ -1,52 +1,72 @@
module ActionController #:nodoc:
module Caching
# Fragment caching is used for caching various blocks within templates without caching the entire action as a whole. This is useful when
# certain elements of an action change frequently or depend on complicated state while other parts rarely change or can be shared amongst multiple
# parties. The caching is done using the cache helper available in the Action View. A template with caching might look something like:
# Fragment caching is used for caching various blocks within
# views without caching the entire action as a whole. This is
# useful when certain elements of an action change frequently or
# depend on complicated state while other parts rarely change or
# can be shared amongst multiple parties. The caching is done using
# the <tt>cache</tt> helper available in the Action View. A
# template with fragment caching might look like:
#
# <b>Hello <%= @name %></b>
#
# <% cache do %>
# All the topics in the system:
# <%= render :partial => "topic", :collection => Topic.find(:all) %>
# <% end %>
#
# This cache will bind to the name of the action that called it, so if this code was part of the view for the topics/list action, you would
# be able to invalidate it using <tt>expire_fragment(:controller => "topics", :action => "list")</tt>.
# This cache will bind the name of the action that called it, so if
# this code was part of the view for the topics/list action, you
# would be able to invalidate it using:
#
# expire_fragment(:controller => "topics", :action => "list")
#
# This default behavior is of limited use if you need to cache multiple fragments per action or if the action itself is cached using
# <tt>caches_action</tt>, so we also have the option to qualify the name of the cached fragment with something like:
# This default behavior is limited if you need to cache multiple
# fragments per action or if the action itself is cached using
# <tt>caches_action</tt>. To remedy this, there is an option to
# qualify the name of the cached fragment by using the
# <tt>:action_suffix</tt> option:
#
# <% cache(:action => "list", :action_suffix => "all_topics") do %>
#
# That would result in a name such as "/topics/list/all_topics", avoiding conflicts with the action cache and with any fragments that use a
# different suffix. Note that the URL doesn't have to really exist or be callable - the url_for system is just used to generate unique
# cache names that we can refer to when we need to expire the cache.
# That would result in a name such as
# <tt>/topics/list/all_topics</tt>, avoiding conflicts with the
# action cache and with any fragments that use a different suffix.
# Note that the URL doesn't have to really exist or be callable
# - the url_for system is just used to generate unique cache names
# that we can refer to when we need to expire the cache.
#
# The expiration call for this example is:
#
# expire_fragment(:controller => "topics", :action => "list", :action_suffix => "all_topics")
# expire_fragment(:controller => "topics",
# :action => "list",
# :action_suffix => "all_topics")
module Fragments
# Given a key (as described in <tt>expire_fragment</tt>), returns a key suitable for use in reading,
# writing, or expiring a cached fragment. If the key is a hash, the generated key is the return
# value of url_for on that hash (without the protocol). All keys are prefixed with "views/" and uses
# Given a key (as described in <tt>expire_fragment</tt>), returns
# a key suitable for use in reading, writing, or expiring a
# cached fragment. If the key is a hash, the generated key is the
# return value of url_for on that hash (without the protocol).
# All keys are prefixed with <tt>views/</tt> and uses
# ActiveSupport::Cache.expand_cache_key for the expansion.
def fragment_cache_key(key)
ActiveSupport::Cache.expand_cache_key(key.is_a?(Hash) ? url_for(key).split("://").last : key, :views)
end
# Writes <tt>content</tt> to the location signified by <tt>key</tt> (see <tt>expire_fragment</tt> for acceptable formats)
# Writes <tt>content</tt> to the location signified by
# <tt>key</tt> (see <tt>expire_fragment</tt> for acceptable formats).
def write_fragment(key, content, options = nil)
return content unless cache_configured?
key = fragment_cache_key(key)
instrument_fragment_cache :write_fragment, key do
content = content.html_safe.to_str if content.respond_to?(:html_safe)
content = content.to_str
cache_store.write(key, content, options)
end
content
end
# Reads a cached fragment from the location signified by <tt>key</tt> (see <tt>expire_fragment</tt> for acceptable formats)
# Reads a cached fragment from the location signified by <tt>key</tt>
# (see <tt>expire_fragment</tt> for acceptable formats).
def read_fragment(key, options = nil)
return unless cache_configured?
@@ -57,7 +77,8 @@ module ActionController #:nodoc:
end
end
# Check if a cached fragment from the location signified by <tt>key</tt> exists (see <tt>expire_fragment</tt> for acceptable formats)
# Check if a cached fragment from the location signified by
# <tt>key</tt> exists (see <tt>expire_fragment</tt> for acceptable formats)
def fragment_exist?(key, options = nil)
return unless cache_configured?
key = fragment_cache_key(key)
@@ -70,8 +91,9 @@ module ActionController #:nodoc:
# Removes fragments from the cache.
#
# +key+ can take one of three forms:
#
# * String - This would normally take the form of a path, like
# <tt>"pages/45/notes"</tt>.
# <tt>pages/45/notes</tt>.
# * Hash - Treated as an implicit call to +url_for+, like
# <tt>{:controller => "pages", :action => "notes", :id => 45}</tt>
# * Regexp - Will remove any fragment that matches, so

View File

@@ -1,5 +1,4 @@
require 'fileutils'
require 'uri'
require 'active_support/core_ext/class/attribute_accessors'
module ActionController #:nodoc:
@@ -99,7 +98,7 @@ module ActionController #:nodoc:
private
def page_cache_file(path, extension)
name = (path.empty? || path == "/") ? "/index" : URI.unescape(path.chomp('/'))
name = (path.empty? || path == "/") ? "/index" : URI.parser.unescape(path.chomp('/'))
unless (name.split('/').last || name).include? '.'
name << (extension || self.page_cache_extension)
end
@@ -107,7 +106,7 @@ module ActionController #:nodoc:
end
def page_cache_path(path, extension = nil)
page_cache_directory + page_cache_file(path, extension)
page_cache_directory.to_s + page_cache_file(path, extension)
end
def instrument_page_cache(name, path)
@@ -137,7 +136,7 @@ module ActionController #:nodoc:
# If no options are provided, the requested url is used. Example:
# cache_page "I'm the cached content", :controller => "lists", :action => "show"
def cache_page(content = nil, options = nil)
return unless self.class.perform_caching && caching_allowed
return unless self.class.perform_caching && caching_allowed?
path = case options
when Hash
@@ -148,7 +147,6 @@ module ActionController #:nodoc:
request.path
end
if (type = Mime::LOOKUP[self.content_type]) && (type_symbol = type.symbol).present?
extension = ".#{type_symbol}"
end
@@ -156,10 +154,6 @@ module ActionController #:nodoc:
self.class.cache_page(content || response.body, path, extension)
end
private
def caching_allowed
request.get? && response.status.to_i == 200
end
end
end
end

View File

@@ -1,3 +1,3 @@
ActionController::AbstractRequest = ActionController::Request = ActionDispatch::Request
ActionController::AbstractResponse = ActionController::Response = ActionDispatch::Response
ActionController::Routing = ActionDispatch::Routing
ActionController::Routing = ActionDispatch::Routing

View File

@@ -1,143 +0,0 @@
module ActionController
class Base
# Deprecated methods. Wrap them in a module so they can be overwritten by plugins
# (like the verify method.)
module DeprecatedBehavior #:nodoc:
def relative_url_root
ActiveSupport::Deprecation.warn "ActionController::Base.relative_url_root is ineffective. " <<
"Please stop using it.", caller
end
def relative_url_root=(value)
ActiveSupport::Deprecation.warn "ActionController::Base.relative_url_root= is ineffective. " <<
"Please stop using it.", caller
end
def consider_all_requests_local
ActiveSupport::Deprecation.warn "ActionController::Base.consider_all_requests_local is deprecated, " <<
"use Rails.application.config.consider_all_requests_local instead", caller
Rails.application.config.consider_all_requests_local
end
def consider_all_requests_local=(value)
ActiveSupport::Deprecation.warn "ActionController::Base.consider_all_requests_local= is deprecated. " <<
"Please configure it on your application with config.consider_all_requests_local=", caller
Rails.application.config.consider_all_requests_local = value
end
def allow_concurrency
ActiveSupport::Deprecation.warn "ActionController::Base.allow_concurrency is deprecated, " <<
"use Rails.application.config.allow_concurrency instead", caller
Rails.application.config.allow_concurrency
end
def allow_concurrency=(value)
ActiveSupport::Deprecation.warn "ActionController::Base.allow_concurrency= is deprecated. " <<
"Please configure it on your application with config.allow_concurrency=", caller
Rails.application.config.allow_concurrency = value
end
def ip_spoofing_check=(value)
ActiveSupport::Deprecation.warn "ActionController::Base.ip_spoofing_check= is deprecated. " <<
"Please configure it on your application with config.action_dispatch.ip_spoofing_check=", caller
Rails.application.config.action_dispatch.ip_spoofing_check = value
end
def ip_spoofing_check
ActiveSupport::Deprecation.warn "ActionController::Base.ip_spoofing_check is deprecated. " <<
"Configuring ip_spoofing_check on the application configures a middleware.", caller
Rails.application.config.action_dispatch.ip_spoofing_check
end
def cookie_verifier_secret=(value)
ActiveSupport::Deprecation.warn "ActionController::Base.cookie_verifier_secret= is deprecated. " <<
"Please configure it on your application with config.secret_token=", caller
end
def cookie_verifier_secret
ActiveSupport::Deprecation.warn "ActionController::Base.cookie_verifier_secret is deprecated.", caller
end
def trusted_proxies=(value)
ActiveSupport::Deprecation.warn "ActionController::Base.trusted_proxies= is deprecated. " <<
"Please configure it on your application with config.action_dispatch.trusted_proxies=", caller
Rails.application.config.action_dispatch.ip_spoofing_check = value
end
def trusted_proxies
ActiveSupport::Deprecation.warn "ActionController::Base.trusted_proxies is deprecated. " <<
"Configuring trusted_proxies on the application configures a middleware.", caller
Rails.application.config.action_dispatch.ip_spoofing_check = value
end
def session(*args)
ActiveSupport::Deprecation.warn(
"Disabling sessions for a single controller has been deprecated. " +
"Sessions are now lazy loaded. So if you don't access them, " +
"consider them off. You can still modify the session cookie " +
"options with request.session_options.", caller)
end
def session=(value)
ActiveSupport::Deprecation.warn "ActionController::Base.session= is deprecated. " <<
"Please configure it on your application with config.session_store :cookie_store, :key => '....'", caller
if secret = value.delete(:secret)
Rails.application.config.secret_token = secret
end
if value.delete(:disabled)
Rails.application.config.session_store :disabled
else
store = Rails.application.config.session_store
Rails.application.config.session_store store, value
end
end
# Controls the resource action separator
def resource_action_separator
@resource_action_separator ||= "/"
end
def resource_action_separator=(val)
ActiveSupport::Deprecation.warn "ActionController::Base.resource_action_separator is deprecated and only " \
"works with the deprecated router DSL."
@resource_action_separator = val
end
def use_accept_header
ActiveSupport::Deprecation.warn "ActionController::Base.use_accept_header doesn't do anything anymore. " \
"The accept header is always taken into account."
end
def use_accept_header=(val)
use_accept_header
end
# This method has been moved to ActionDispatch::Request.filter_parameters
def filter_parameter_logging(*args, &block)
ActiveSupport::Deprecation.warn("Setting filter_parameter_logging in ActionController is deprecated and has no longer effect, please set 'config.filter_parameters' in config/application.rb instead", caller)
filter = Rails.application.config.filter_parameters
filter.concat(args)
filter << block if block
filter
end
# This was moved to a plugin
def verify(*args)
ActiveSupport::Deprecation.warn "verify was removed from Rails and is now available as a plugin. " \
"Please install it with `rails plugin install git://github.com/sikachu/verification.git`.", caller
end
def exempt_from_layout(*)
ActiveSupport::Deprecation.warn "exempt_from_layout is no longer needed, because layouts in Rails 3 " \
"are restricted to the content-type of the template that was rendered.", caller
end
end
extend DeprecatedBehavior
delegate :consider_all_requests_local, :consider_all_requests_local=,
:allow_concurrency, :allow_concurrency=, :to => :"self.class"
end
end

View File

@@ -1,28 +0,0 @@
module ActionController
class Dispatcher
class << self
def before_dispatch(*args, &block)
ActiveSupport::Deprecation.warn "ActionController::Dispatcher.before_dispatch is deprecated. " <<
"Please use ActionDispatch::Callbacks.before instead.", caller
ActionDispatch::Callbacks.before(*args, &block)
end
def after_dispatch(*args, &block)
ActiveSupport::Deprecation.warn "ActionController::Dispatcher.after_dispatch is deprecated. " <<
"Please use ActionDispatch::Callbacks.after instead.", caller
ActionDispatch::Callbacks.after(*args, &block)
end
def to_prepare(*args, &block)
ActiveSupport::Deprecation.warn "ActionController::Dispatcher.to_prepare is deprecated. " <<
"Please use config.to_prepare instead", caller
ActionDispatch::Callbacks.after(*args, &block)
end
def new
ActiveSupport::Deprecation.warn "ActionController::Dispatcher.new is deprecated, use Rails.application instead."
Rails.application
end
end
end
end

View File

@@ -1,14 +0,0 @@
module ActionController
module UrlWriter
def self.included(klass)
ActiveSupport::Deprecation.warn "include ActionController::UrlWriter is deprecated. Instead, " \
"include Rails.application.routes.url_helpers"
klass.class_eval { include Rails.application.routes.url_helpers }
end
end
class UrlRewriter
def initialize(*)
end
end
end

View File

@@ -7,8 +7,10 @@ module ActionController
def start_processing(event)
payload = event.payload
params = payload[:params].except(*INTERNAL_PARAMS)
format = payload[:format]
format = format.to_s.upcase if format.is_a?(Symbol)
info " Processing by #{payload[:controller]}##{payload[:action]} as #{payload[:formats].first.to_s.upcase}"
info " Processing by #{payload[:controller]}##{payload[:action]} as #{format}"
info " Parameters: #{params.inspect}" unless params.empty?
end
@@ -46,7 +48,7 @@ module ActionController
def #{method}(event)
key_or_path = event.payload[:key] || event.payload[:path]
human_name = #{method.to_s.humanize.inspect}
info("\#{human_name} \#{key_or_path} (%.1fms)" % event.duration)
info("\#{human_name} \#{key_or_path} \#{"(%.1fms)" % event.duration}")
end
METHOD
end

View File

@@ -36,35 +36,88 @@ module ActionController
action = action.to_s
raise "MiddlewareStack#build requires an app" unless app
reverse.inject(app) do |a, middleware|
middlewares.reverse.inject(app) do |a, middleware|
middleware.valid?(action) ?
middleware.build(a) : a
end
end
end
# ActionController::Metal provides a way to get a valid Rack application from a controller.
# <tt>ActionController::Metal</tt> is the simplest possible controller, providing a
# valid Rack interface without the additional niceties provided by
# <tt>ActionController::Base</tt>.
#
# A sample metal controller might look like this:
#
# class HelloController < ActionController::Metal
# def index
# self.response_body = "Hello World!"
# end
# end
#
# And then to route requests to your metal controller, you would add
# something like this to <tt>config/routes.rb</tt>:
#
# match 'hello', :to => HelloController.action(:index)
#
# The +action+ method returns a valid Rack application for the \Rails
# router to dispatch to.
#
# == Rendering Helpers
#
# <tt>ActionController::Metal</tt> by default provides no utilities for rendering
# views, partials, or other responses aside from explicitly calling of
# <tt>response_body=</tt>, <tt>content_type=</tt>, and <tt>status=</tt>. To
# add the render helpers you're used to having in a normal controller, you
# can do the following:
#
# class HelloController < ActionController::Metal
# include ActionController::Rendering
# append_view_path "#{Rails.root}/app/views"
#
# def index
# render "hello/index"
# end
# end
#
# == Redirection Helpers
#
# To add redirection helpers to your metal controller, do the following:
#
# class HelloController < ActionController::Metal
# include ActionController::Redirecting
# include Rails.application.routes.url_helpers
#
# def index
# redirect_to root_url
# end
# end
#
# == Other Helpers
#
# You can refer to the modules included in <tt>ActionController::Base</tt> to see
# other features you can bring into your metal controller.
#
# In AbstractController, dispatching is triggered directly by calling #process on a new controller.
# ActionController::Metal provides an #action method that returns a valid Rack application for a
# given action. Other rack builders, such as Rack::Builder, Rack::URLMap, and the Rails router,
# can dispatch directly to the action returned by FooController.action(:index).
class Metal < AbstractController::Base
abstract!
attr_internal :env
attr_internal_writer :env
def env
@_env ||= {}
end
# Returns the last part of the controller's name, underscored, without the ending
# "Controller". For instance, MyApp::MyPostsController would return "my_posts" for
# controller_name
# <tt>Controller</tt>. For instance, PostsController returns <tt>posts</tt>.
# Namespaces are left out, so Admin::PostsController returns <tt>posts</tt> as well.
#
# ==== Returns
# String
# * <tt>string</tt>
def self.controller_name
@controller_name ||= self.name.demodulize.sub(/Controller$/, '').underscore
end
# Delegates to the class' #controller_name
# Delegates to the class' <tt>controller_name</tt>
def controller_name
self.class.controller_name
end
@@ -78,9 +131,12 @@ module ActionController
attr_internal :headers, :response, :request
delegate :session, :to => "@_request"
def initialize(*)
def initialize
@_headers = {"Content-Type" => "text/html"}
@_status = 200
@_request = nil
@_response = nil
@_routes = nil
super
end
@@ -126,12 +182,11 @@ module ActionController
end
def response_body=(val)
body = val.respond_to?(:each) ? val : [val]
body = val.nil? ? nil : (val.respond_to?(:each) ? val : [val])
super body
end
# :api: private
def dispatch(name, request)
def dispatch(name, request) #:nodoc:
@_request = request
@_env = request.env
@_env['action_controller.instance'] = self
@@ -139,27 +194,30 @@ module ActionController
to_a
end
# :api: private
def to_a
def to_a #:nodoc:
response ? response.to_a : [status, headers, response_body]
end
class_attribute :middleware_stack
self.middleware_stack = ActionController::MiddlewareStack.new
def self.inherited(base)
def self.inherited(base) #nodoc:
base.middleware_stack = self.middleware_stack.dup
super
end
# Adds given middleware class and its args to bottom of middleware_stack
def self.use(*args, &block)
middleware_stack.use(*args, &block)
end
# Alias for middleware_stack
def self.middleware
middleware_stack
end
# Makes the controller a rack endpoint that points to the action in
# the given env's action_dispatch.request.path_parameters key.
def self.call(env)
action(env['action_dispatch.request.path_parameters'][:action]).call(env)
end
@@ -169,10 +227,10 @@ module ActionController
# for the same action.
#
# ==== Parameters
# action<#to_s>:: An action name
# * <tt>action</tt> - An action name
#
# ==== Returns
# Proc:: A rack application
# * <tt>proc</tt> - A rack application
def self.action(name, klass = ActionDispatch::Request)
middleware_stack.build(name.to_s) do |env|
new.dispatch(name, klass.new(env))

View File

@@ -5,9 +5,6 @@ module ActionController
class ::ActionController::ActionControllerError < StandardError #:nodoc:
end
module ClassMethods
end
# Temporary hax
included do
::ActionController::UnknownAction = ::AbstractController::ActionNotFound
@@ -21,13 +18,10 @@ module ActionController
delegate :default_charset=, :to => "ActionDispatch::Response"
end
# TODO: Update protected instance variables list
config_accessor :protected_instance_variables
self.protected_instance_variables = %w(@assigns @performed_redirect @performed_render
@variables_added @request_origin @url
@parent_controller @action_name
@before_filter_chain_aborted @_headers @_params
@_response)
self.protected_instance_variables = %w(
@_status @_headers @_params @_env @_response @_request
@_view_runtime @_stream @_url_options @_action_has_layout
)
def rescue_action(env)
raise env["action_dispatch.rescue.exception"]
@@ -39,12 +33,6 @@ module ActionController
def assign_shortcuts(*) end
def _normalize_options(options)
if options[:action] && options[:action].to_s.include?(?/)
ActiveSupport::Deprecation.warn "Giving a path to render :action is deprecated. " <<
"Please use render :template instead", caller
options[:template] = options.delete(:action)
end
options[:text] = nil if options.delete(:nothing) == true
options[:text] = " " if options.key?(:text) && options[:text].nil?
super
@@ -60,7 +48,7 @@ module ActionController
end
def method_for_action(action_name)
super || (defined?(self.method_missing) && "_handle_method_missing")
super || (respond_to?(:method_missing) && "_handle_method_missing")
end
def performed?

View File

@@ -6,7 +6,7 @@ module ActionController
include Head
# Sets the etag, last_modified, or both on the response and renders a
# "304 Not Modified" response if the request is already fresh.
# <tt>304 Not Modified</tt> response if the request is already fresh.
#
# Parameters:
# * <tt>:etag</tt>
@@ -17,11 +17,11 @@ module ActionController
#
# def show
# @article = Article.find(params[:id])
# fresh_when(:etag => @article, :last_modified => @article.created_at.utc, :public => true)
# fresh_when(:etag => @article, :last_modified => @article.created_at, :public => true)
# end
#
# This will render the show template if the request isn't sending a matching etag or
# If-Modified-Since header and just a "304 Not Modified" response if there's a match.
# If-Modified-Since header and just a <tt>304 Not Modified</tt> response if there's a match.
#
def fresh_when(options)
options.assert_valid_keys(:etag, :last_modified, :public)
@@ -36,7 +36,7 @@ module ActionController
# Sets the etag and/or last_modified on the response and checks it against
# the client request. If the request doesn't match the options provided, the
# request is considered stale and should be generated from scratch. Otherwise,
# it's fresh and we don't need to generate anything and a reply of "304 Not Modified" is sent.
# it's fresh and we don't need to generate anything and a reply of <tt>304 Not Modified</tt> is sent.
#
# Parameters:
# * <tt>:etag</tt>
@@ -48,7 +48,7 @@ module ActionController
# def show
# @article = Article.find(params[:id])
#
# if stale?(:etag => @article, :last_modified => @article.created_at.utc)
# if stale?(:etag => @article, :last_modified => @article.created_at)
# @statistics = @article.really_expensive_call
# respond_to do |format|
# # all the supported formats
@@ -60,13 +60,13 @@ module ActionController
!request.fresh?(response)
end
# Sets a HTTP 1.1 Cache-Control header. Defaults to issuing a "private" instruction, so that
# intermediate caches shouldn't cache the response.
# Sets a HTTP 1.1 Cache-Control header. Defaults to issuing a <tt>private</tt> instruction, so that
# intermediate caches must not cache the response.
#
# Examples:
# expires_in 20.minutes
# expires_in 3.hours, :public => true
# expires in 3.hours, 'max-stale' => 5.hours, :public => true
# expires_in 3.hours, 'max-stale' => 5.hours, :public => true
#
# This method will overwrite an existing Cache-Control header.
# See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html for more possibilities.
@@ -77,7 +77,7 @@ module ActionController
response.cache_control[:extras] = options.map {|k,v| "#{k}=#{v}"}
end
# Sets a HTTP 1.1 Cache-Control header of "no-cache" so no caching should occur by the browser or
# Sets a HTTP 1.1 Cache-Control header of <tt>no-cache</tt> so no caching should occur by the browser or
# intermediate caches (like caching proxy servers).
def expires_now #:doc:
response.cache_control.replace(:no_cache => true)

View File

@@ -0,0 +1,145 @@
require 'active_support/core_ext/file/path'
module ActionController #:nodoc:
# Methods for sending arbitrary data and for streaming files to the browser,
# instead of rendering.
module DataStreaming
extend ActiveSupport::Concern
include ActionController::Rendering
DEFAULT_SEND_FILE_OPTIONS = {
:type => 'application/octet-stream'.freeze,
:disposition => 'attachment'.freeze,
}.freeze
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.
# 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
# page. <tt>send_file(params[:path])</tt> allows a malicious user to
# download any file on your server.
#
# Options:
# * <tt>:filename</tt> - suggests a filename for the browser to use.
# Defaults to <tt>File.basename(path)</tt>.
# * <tt>:type</tt> - specifies an HTTP content type. Defaults to 'application/octet-stream'. You can specify
# either a string or a symbol for a registered type register with <tt>Mime::Type.register</tt>, for example :json
# * <tt>:disposition</tt> - specifies whether the file will be shown inline or downloaded.
# Valid values are 'inline' and 'attachment' (default).
# * <tt>:status</tt> - specifies the status code to send with the response. Defaults to 200.
# * <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).
#
# The default Content-Type and Content-Disposition headers are
# set to download arbitrary binary files in as many browsers as
# possible. IE versions 4, 5, 5.5, and 6 are all known to have
# a variety of quirks (especially when downloading over SSL).
#
# Simple download:
#
# send_file '/path/to.zip'
#
# Show a JPEG in the browser:
#
# send_file '/path/to.jpeg', :type => 'image/jpeg', :disposition => 'inline'
#
# Show a 404 page in the browser:
#
# send_file '/path/to/404.html', :type => 'text/html; charset=utf-8', :status => 404
#
# Read about the other Content-* HTTP headers if you'd like to
# provide the user with more information (such as Content-Description) in
# http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11.
#
# Also be aware that the document may be cached by proxies and browsers.
# The Pragma and Cache-Control headers declare how the file may be cached
# by intermediaries. They default to require clients to validate with
# the server before releasing cached responses. See
# http://www.mnot.net/cache_docs/ for an overview of web caching and
# http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9
# for the Cache-Control header spec.
def send_file(path, options = {}) #:doc:
raise MissingFile, "Cannot read file #{path}" unless File.file?(path) and File.readable?(path)
options[:filename] ||= File.basename(path) unless options[:url_based_filename]
send_file_headers! options
self.status = options[:status] || 200
self.content_type = options[:content_type] if options.key?(:content_type)
self.response_body = File.open(path, "rb")
end
# Sends the given binary data to the browser. This method is similar to
# <tt>render :text => data</tt>, but also allows you to specify whether
# the browser should display the response as a file attachment (i.e. in a
# download dialog) or as inline data. You may also set the content type,
# the apparent file name, and other things.
#
# Options:
# * <tt>:filename</tt> - suggests a filename for the browser to use.
# * <tt>:type</tt> - specifies an HTTP content type. Defaults to 'application/octet-stream'. You can specify
# either a string or a symbol for a registered type register with <tt>Mime::Type.register</tt>, for example :json
# * <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.
#
# Generic data download:
#
# send_data buffer
#
# Download a dynamically-generated tarball:
#
# send_data generate_tgz('dir'), :filename => 'dir.tgz'
#
# Display an image Active Record in the browser:
#
# send_data image.data, :type => image.content_type, :disposition => 'inline'
#
# See +send_file+ for more information on HTTP Content-* headers and caching.
def send_data(data, options = {}) #:doc:
send_file_headers! options.dup
render options.slice(:status, :content_type).merge(:text => data)
end
private
def send_file_headers!(options)
options.update(DEFAULT_SEND_FILE_OPTIONS.merge(options))
[:type, :disposition].each do |arg|
raise ArgumentError, ":#{arg} option required" if options[arg].nil?
end
disposition = options[:disposition]
disposition += %(; filename="#{options[:filename]}") if options[:filename]
content_type = options[:type]
if content_type.is_a?(Symbol)
extension = Mime[content_type]
raise ArgumentError, "Unknown MIME type #{options[:type]}" unless extension
self.content_type = extension
else
self.content_type = content_type
end
headers.merge!(
'Content-Disposition' => disposition,
'Content-Transfer-Encoding' => 'binary'
)
response.sending_file = true
# Fix a problem with IE 6.0 on opening downloaded files:
# If Cache-Control: no-cache is set (which Rails does by default),
# IE removes the file it just downloaded from its cache immediately
# after it displays the "open/save" dialog, which means that if you
# hit "open" the file isn't there anymore when the application that
# is called for handling the download is run, so let's workaround that
response.cache_control[:public] ||= false
end
end
end

View File

@@ -0,0 +1,35 @@
module ActionController
# This module provides a method which will redirects browser to use HTTPS
# protocol. This will ensure that user's sensitive information will be
# transferred safely over the internet. You _should_ always force browser
# to use HTTPS when you're transferring sensitive information such as
# user authentication, account information, or credit card information.
#
# Note that if you really concern about your application safety, you might
# consider using +config.force_ssl+ in your configuration config file instead.
# That will ensure all the data transferred via HTTPS protocol and prevent
# user from getting session hijacked when accessing the site under unsecured
# HTTP protocol.
module ForceSSL
extend ActiveSupport::Concern
include AbstractController::Callbacks
module ClassMethods
# Force the request to this particular controller or specified actions to be
# under HTTPS protocol.
#
# Note that this method will not be effective on development environment.
#
# ==== Options
# * <tt>only</tt> - The callback should be run only for this action
# * <tt>except<tt> - The callback should be run for all actions except this action
def force_ssl(options = {})
before_filter(options) do
if !request.ssl? && !Rails.env.development?
redirect_to :protocol => 'https://', :status => :moved_permanently
end
end
end
end
end
end

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?
@@ -20,7 +22,7 @@ module ActionController
location = options.delete(:location)
options.each do |key, value|
headers[key.to_s.dasherize.split(/-/).map { |v| v.capitalize }.join("-")] = value.to_s
headers[key.to_s.dasherize.split('-').each { |v| v[0] = v[0].chr.upcase }.join('-')] = value.to_s
end
self.status = status

View File

@@ -2,21 +2,21 @@ require 'active_support/core_ext/array/wrap'
require 'active_support/core_ext/class/attribute'
module ActionController
# The Rails framework provides a large number of helpers for working with +assets+, +dates+, +forms+,
# +numbers+ and model objects, to name a few. These helpers are available to all templates
# The \Rails framework provides a large number of helpers for working with assets, dates, forms,
# numbers and model objects, to name a few. These helpers are available to all templates
# by default.
#
# In addition to using the standard template helpers provided in the Rails framework, creating custom helpers to
# In addition to using the standard template helpers provided, creating custom helpers to
# extract complicated logic or reusable functionality is strongly encouraged. By default, the controller will
# include a helper whose name matches that of the controller, e.g., <tt>MyController</tt> will automatically
# include <tt>MyHelper</tt>.
#
# Additional helpers can be specified using the +helper+ class method in <tt>ActionController::Base</tt> or any
# Additional helpers can be specified using the +helper+ class method in ActionController::Base or any
# controller which inherits from it.
#
# ==== Examples
# The +to_s+ method from the Time class can be wrapped in a helper method to display a custom message if
# the Time object is blank:
# The +to_s+ method from the \Time class can be wrapped in a helper method to display a custom message if
# a \Time object is blank:
#
# module FormattedTimeHelper
# def format_time(time, format=:long, blank_message="&nbsp;")
@@ -53,30 +53,20 @@ module ActionController
include AbstractController::Helpers
included do
config_accessor :helpers_path
config_accessor :helpers_path, :include_all_helpers
self.helpers_path ||= []
self.include_all_helpers = true
end
module ClassMethods
def helpers_dir
ActiveSupport::Deprecation.warn "helpers_dir is deprecated, use helpers_path instead", caller
self.helpers_path
end
def helpers_dir=(value)
ActiveSupport::Deprecation.warn "helpers_dir= is deprecated, use helpers_path= instead", caller
self.helpers_path = Array.wrap(value)
end
# Declares helper accessors for controller attributes. For example, the
# following adds new +name+ and <tt>name=</tt> instance methods to a
# controller and makes them available to the view:
# helper_attr :name
# attr_accessor :name
# helper_attr :name
#
# ==== Parameters
# *attrs<Array[String, Symbol]>:: Names of attributes to be converted
# into helpers.
# * <tt>attrs</tt> - Names of attributes to be converted into helpers.
def helper_attr(*attrs)
attrs.flatten.each { |attr| helper_method(attr, "#{attr}=") }
end
@@ -86,32 +76,35 @@ module ActionController
@helper_proxy ||= ActionView::Base.new.extend(_helpers)
end
private
# Overwrite modules_for_helpers to accept :all as argument, which loads
# all helpers in helpers_dir.
#
# ==== Parameters
# args<Array[String, Symbol, Module, all]>:: A list of helpers
#
# ==== Returns
# Array[Module]:: A normalized list of modules for the list of
# helpers provided.
def modules_for_helpers(args)
args += all_application_helpers if args.delete(:all)
super(args)
end
# Overwrite modules_for_helpers to accept :all as argument, which loads
# all helpers in helpers_path.
#
# ==== Parameters
# * <tt>args</tt> - A list of helpers
#
# ==== Returns
# * <tt>array</tt> - A normalized list of modules for the list of helpers provided.
def modules_for_helpers(args)
args += all_application_helpers if args.delete(:all)
super(args)
end
# Extract helper names from files in app/helpers/**/*_helper.rb
def all_application_helpers
helpers = []
Array.wrap(helpers_path).each do |path|
extract = /^#{Regexp.quote(path.to_s)}\/?(.*)_helper.rb$/
helpers += Dir["#{path}/**/*_helper.rb"].map { |file| file.sub(extract, '\1') }
end
helpers.sort!
helpers.uniq!
helpers
def all_helpers_from_path(path)
helpers = []
Array.wrap(path).each do |_path|
extract = /^#{Regexp.quote(_path.to_s)}\/?(.*)_helper.rb$/
helpers += Dir["#{_path}/**/*_helper.rb"].map { |file| file.sub(extract, '\1') }
end
helpers.sort!
helpers.uniq!
helpers
end
private
# Extract helper names from files in <tt>app/helpers/**/*_helper.rb</tt>
def all_application_helpers
all_helpers_from_path(helpers_path)
end
end
end
end

View File

@@ -1,8 +1,7 @@
require 'active_support/core_ext/class/attribute'
module ActionController
# ActionController::HideActions adds the ability to prevent public methods on a controller
# to be called as actions.
# Adds the ability to prevent public methods on a controller to be called as actions.
module HideActions
extend ActiveSupport::Concern
@@ -23,7 +22,7 @@ module ActionController
# Sets all of the actions passed in as hidden actions.
#
# ==== Parameters
# *args<#to_s>:: A list of actions
# * <tt>args</tt> - A list of actions
def hide_action(*args)
self.hidden_actions = hidden_actions.dup.merge(args.map(&:to_s)).freeze
end

View File

@@ -3,14 +3,12 @@ require 'active_support/core_ext/object/blank'
module ActionController
module HttpAuthentication
# Makes it dead easy to do HTTP Basic authentication.
# Makes it dead easy to do HTTP \Basic and \Digest authentication.
#
# Simple Basic example:
# === Simple \Basic example
#
# class PostsController < ApplicationController
# USER_NAME, PASSWORD = "dhh", "secret"
#
# before_filter :authenticate, :except => [ :index ]
# http_basic_authenticate_with :name => "dhh", :password => "secret", :except => :index
#
# def index
# render :text => "Everyone can see me!"
@@ -19,17 +17,11 @@ module ActionController
# def edit
# render :text => "I'm only accessible if you know the password"
# end
# end
#
# private
# def authenticate
# authenticate_or_request_with_http_basic do |user_name, password|
# user_name == USER_NAME && password == PASSWORD
# end
# end
# end
# === Advanced \Basic example
#
#
# Here is a more advanced Basic example where only Atom feeds and the XML API is protected by HTTP authentication,
# Here is a more advanced \Basic example where only Atom feeds and the XML API is protected by HTTP authentication,
# the regular HTML interface is protected by a session approach:
#
# class ApplicationController < ActionController::Base
@@ -69,13 +61,13 @@ module ActionController
# assert_equal 200, status
# end
#
# Simple Digest example:
# === Simple \Digest example
#
# require 'digest/md5'
# class PostsController < ApplicationController
# REALM = "SuperSecret"
# USERS = {"dhh" => "secret", #plain text password
# "dap" => Digest:MD5::hexdigest(["dap",REALM,"secret"].join(":")) #ha1 digest password
# "dap" => Digest::MD5.hexdigest(["dap",REALM,"secret"].join(":")) #ha1 digest password
#
# before_filter :authenticate, :except => [:index]
#
@@ -101,15 +93,30 @@ module ActionController
# or the ha1 digest hash so the framework can appropriately hash to check the user's
# credentials. Returning +nil+ will cause authentication to fail.
#
# On shared hosts, Apache sometimes doesn't pass authentication headers to
# FCGI instances. If your environment matches this description and you cannot
# authenticate, try this rule in your Apache setup:
# Storing the ha1 hash: MD5(username:realm:password), is better than storing a plain password. If
# the password file or database is compromised, the attacker would be able to use the ha1 hash to
# authenticate as the user at this +realm+, but would not have the user's password to try using at
# other sites.
#
# RewriteRule ^(.*)$ dispatch.fcgi [E=X-HTTP_AUTHORIZATION:%{HTTP:Authorization},QSA,L]
# In rare instances, web servers or front proxies strip authorization headers before
# they reach your application. You can debug this situation by logging all environment
# variables, and check for HTTP_AUTHORIZATION, amongst others.
module Basic
extend self
module ControllerMethods
extend ActiveSupport::Concern
module ClassMethods
def http_basic_authenticate_with(options = {})
before_filter(options.except(:name, :password, :realm)) do
authenticate_or_request_with_http_basic(options[:realm] || "Application") do |name, password|
name == options[:name] && password == options[:password]
end
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
@@ -138,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)
@@ -185,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
@@ -209,7 +219,7 @@ module ActionController
def encode_credentials(http_method, credentials, password, password_is_ha1)
credentials[:response] = expected_response(http_method, credentials[:uri], credentials, password, password_is_ha1)
"Digest " + credentials.sort_by {|x| x[0].to_s }.inject([]) {|a, v| a << "#{v[0]}='#{v[1]}'" }.join(', ')
"Digest " + credentials.sort_by {|x| x[0].to_s }.map {|v| "#{v[0]}='#{v[1]}'" }.join(', ')
end
def decode_credentials_header(request)
@@ -373,7 +383,6 @@ module ActionController
#
# RewriteRule ^(.*)$ dispatch.fcgi [E=X-HTTP_AUTHORIZATION:%{HTTP:Authorization},QSA,L]
module Token
extend self
module ControllerMethods
@@ -402,7 +411,7 @@ module ActionController
# Returns nil if no token is found.
def authenticate(controller, &login_procedure)
token, options = token_and_options(controller.request)
if !token.blank?
unless token.blank?
login_procedure.call(token, options)
end
end
@@ -412,20 +421,19 @@ module ActionController
# Authorization: Token token="abc", nonce="def"
# Then the returned token is "abc", and the options is {:nonce => "def"}
#
# request - ActionController::Request instance with the current headers.
# request - ActionDispatch::Request instance with the current headers.
#
# Returns an Array of [String, Hash] if a token is present.
# Returns nil if no token is found.
def token_and_options(request)
if header = request.authorization.to_s[/^Token (.*)/]
values = $1.split(',').
inject({}) do |memo, value|
value.strip! # remove any spaces between commas and values
key, value = value.split(/\=\"?/) # split key=value pairs
value.chomp!('"') # chomp trailing " in value
value.gsub!(/\\\"/, '"') # unescape remaining quotes
memo.update(key => value)
end
values = Hash[$1.split(',').map do |value|
value.strip! # remove any spaces between commas and values
key, value = value.split(/\=\"?/) # split key=value pairs
value.chomp!('"') # chomp trailing " in value
value.gsub!(/\\\"/, '"') # unescape remaining quotes
[key, value]
end]
[values.delete("token"), values.with_indifferent_access]
end
end
@@ -437,9 +445,8 @@ module ActionController
#
# Returns String.
def encode_credentials(token, options = {})
values = ["token=#{token.to_s.inspect}"]
options.each do |key, value|
values << "#{key}=#{value.to_s.inspect}"
values = ["token=#{token.to_s.inspect}"] + options.map do |key, value|
"#{key}=#{value.to_s.inspect}"
end
"Token #{values * ", "}"
end
@@ -455,6 +462,5 @@ module ActionController
controller.__send__ :render, :text => "HTTP Token: Access denied.\n", :status => :unauthorized
end
end
end
end

View File

@@ -1,21 +1,19 @@
module ActionController
module ImplicitRender
def send_action(*)
def send_action(method, *args)
ret = super
default_render unless response_body
ret
end
def default_render
render
def default_render(*args)
render(*args)
end
def method_for_action(action_name)
super || begin
if template_exists?(action_name.to_s, _prefix)
"default_render"
end
super || if template_exists?(action_name.to_s, _prefixes)
"default_render"
end
end
end
end
end

View File

@@ -14,12 +14,12 @@ module ActionController
attr_internal :view_runtime
def process_action(action, *args)
def process_action(*args)
raw_payload = {
:controller => self.class.name,
:action => self.action_name,
:params => request.filtered_parameters,
:formats => request.formats.map(&:to_sym),
:format => request.format.try(:ref),
:method => request.method,
:path => (request.fullpath rescue "unknown")
}
@@ -78,7 +78,7 @@ module ActionController
yield
end
# Everytime after an action is processed, this method is invoked
# Every time after an action is processed, this method is invoked
# with the payload, so you can add more information.
# :api: plugin
def append_info_to_payload(payload) #:nodoc:

View File

@@ -1,10 +1,13 @@
require 'abstract_controller/collector'
require 'active_support/core_ext/class/attribute'
require 'active_support/core_ext/object/inclusion'
module ActionController #:nodoc:
module MimeResponds #:nodoc:
module MimeResponds
extend ActiveSupport::Concern
include ActionController::ImplicitRender
included do
class_attribute :responder, :mimes_for_respond_to
self.responder = ActionController::Responder
@@ -32,10 +35,10 @@ module ActionController #:nodoc:
# and all actions except <tt>:edit</tt> respond to <tt>:xml</tt> and
# <tt>:json</tt>.
#
# respond_to :rjs, :only => :create
# respond_to :json, :only => :create
#
# This specifies that the <tt>:create</tt> action and no other responds
# to <tt>:rjs</tt>.
# to <tt>:json</tt>.
def respond_to(*mimes)
options = mimes.extract_options!
@@ -63,13 +66,13 @@ module ActionController #:nodoc:
# might look something like this:
#
# def index
# @people = Person.find(:all)
# @people = Person.all
# end
#
# Here's the same action, with web-service support baked in:
#
# def index
# @people = Person.find(:all)
# @people = Person.all
#
# respond_to do |format|
# format.html
@@ -105,8 +108,8 @@ module ActionController #:nodoc:
# end
# end
#
# If the client wants HTML, we just redirect them back to the person list. If they want Javascript
# (format.js), then it is an RJS request and we render the RJS template associated with this action.
# If the client wants HTML, we just redirect them back to the person list. If they want JavaScript,
# then it is an Ajax request and we render the JavaScript template associated with this action.
# Lastly, if the client wants XML, we render the created person as XML, but with a twist: we also
# include the person's company in the rendered XML, so you get something like this:
#
@@ -155,7 +158,7 @@ module ActionController #:nodoc:
# Respond to also allows you to specify a common block for different formats by using any:
#
# def index
# @people = Person.find(:all)
# @people = Person.all
#
# respond_to do |format|
# format.html
@@ -178,7 +181,7 @@ module ActionController #:nodoc:
# respond_to :html, :xml, :json
#
# def index
# @people = Person.find(:all)
# @people = Person.all
# respond_with(@person)
# end
# end
@@ -189,7 +192,7 @@ module ActionController #:nodoc:
raise ArgumentError, "respond_to takes either types or a block, never both" if mimes.any? && block_given?
if response = retrieve_response_from_mimes(mimes, &block)
response.call
response.call(nil)
end
end
@@ -208,8 +211,8 @@ module ActionController #:nodoc:
# It also accepts a block to be given. It's used to overwrite a default
# response:
#
# def destroy
# @user = User.find(params[:id])
# def create
# @user = User.new(params[:user])
# flash[:notice] = "User was successfully created." if @user.save
#
# respond_with(@user) do |format|
@@ -222,6 +225,9 @@ module ActionController #:nodoc:
# is quite simple (it just needs to respond to call), you can even give
# a proc to it.
#
# In order to use respond_with, first you need to declare the formats your
# controller responds to in the class level with a call to <tt>respond_to</tt>.
#
def respond_with(*resources, &block)
raise "In order to use respond_with, first you need to declare the formats your " <<
"controller responds to in the class level" if self.class.mimes_for_respond_to.empty?
@@ -245,9 +251,9 @@ module ActionController #:nodoc:
config = self.class.mimes_for_respond_to[mime]
if config[:except]
!config[:except].include?(action)
!action.in?(config[:except])
elsif config[:only]
config[:only].include?(action)
action.in?(config[:only])
else
true
end
@@ -257,10 +263,9 @@ module ActionController #:nodoc:
# Collects mimes and return the response for the negotiated format. Returns
# nil if :not_acceptable was sent to the client.
#
def retrieve_response_from_mimes(mimes=nil, &block)
collector = Collector.new { default_render }
def retrieve_response_from_mimes(mimes=nil, &block) #:nodoc:
mimes ||= collect_mimes_from_class_level
mimes.each { |mime| collector.send(mime) }
collector = Collector.new(mimes) { |options| default_render(options || {}) }
block.call(collector) if block_given?
if format = request.negotiate_mime(collector.order)
@@ -277,8 +282,9 @@ module ActionController #:nodoc:
include AbstractController::Collector
attr_accessor :order
def initialize(&block)
def initialize(mimes, &block)
@order, @responses, @default_response = [], {}, block
mimes.each { |mime| send(mime) }
end
def any(*args, &block)
@@ -291,7 +297,7 @@ module ActionController #:nodoc:
alias :all :any
def custom(mime_type, &block)
mime_type = mime_type.is_a?(Mime::Type) ? mime_type : Mime::Type.lookup(mime_type.to_s)
mime_type = Mime::Type.lookup(mime_type.to_s) unless mime_type.is_a?(Mime::Type)
@order << mime_type
@responses[mime_type] ||= block
end

View File

@@ -0,0 +1,234 @@
require 'active_support/core_ext/class/attribute'
require 'active_support/core_ext/hash/slice'
require 'active_support/core_ext/hash/except'
require 'active_support/core_ext/array/wrap'
require 'active_support/core_ext/module/anonymous'
require 'action_dispatch/http/mime_types'
module ActionController
# Wraps the parameters hash into a nested hash. This will allow clients to submit
# POST requests without having to specify any root elements.
#
# 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
# a non-empty array:
#
# class UsersController < ApplicationController
# wrap_parameters :format => [:json, :xml]
# end
#
# If you enable +ParamsWrapper+ for +:json+ format, instead of having to
# send JSON parameters like this:
#
# {"user": {"name": "Konata"}}
#
# You can send parameters like this:
#
# {"name": "Konata"}
#
# 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:
#
# {"name" => "Konata", "user" => {"name" => "Konata"}}
#
# You can also specify the key in which the parameters should be wrapped to,
# and also the list of attributes it should wrap by using either +:include+ or
# +:exclude+ options like this:
#
# class UsersController < ApplicationController
# wrap_parameters :person, :include => [:username, :password]
# end
#
# If you're going to pass the parameters to an +ActiveModel+ object (such as
# +User.new(params[:user])+), you might consider passing the model class to
# the method instead. The +ParamsWrapper+ will actually try to determine the
# list of attribute names from the model and only wrap those attributes:
#
# class UsersController < ApplicationController
# wrap_parameters Person
# end
#
# You still could pass +:include+ and +:exclude+ to set the list of attributes
# you want to wrap.
#
# By default, if you don't specify the key in which the parameters would be
# wrapped to, +ParamsWrapper+ will actually try to determine if there's
# a model related to it or not. This controller, for example:
#
# class Admin::UsersController < ApplicationController
# end
#
# will try to check if +Admin::User+ or +User+ model exists, and use it to
# 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
EXCLUDE_PARAMETERS = %w(authenticity_token _method utf8)
included do
class_attribute :_wrapper_options
self._wrapper_options = { :format => [] }
end
module ClassMethods
# Sets the name of the wrapper key, or the model which +ParamsWrapper+
# would use to determine the attribute names from.
#
# ==== Examples
# wrap_parameters :format => :xml
# # enables the parameter wrapper for XML format
#
# wrap_parameters :person
# # wraps parameters into +params[:person]+ hash
#
# wrap_parameters Person
# # 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
# # disables parameters wrapping for this controller altogether.
#
# ==== Options
# * <tt>:format</tt> - The list of formats in which the parameters wrapper
# will be enabled.
# * <tt>:include</tt> - The list of attribute names which parameters wrapper
# will wrap into a nested hash.
# * <tt>:exclude</tt> - The list of attribute names which parameters wrapper
# will exclude from a nested hash.
def wrap_parameters(name_or_model_or_options, options = {})
model = nil
case name_or_model_or_options
when Hash
options = name_or_model_or_options
when false
options = options.merge(:format => [])
when Symbol, String
options = options.merge(:name => name_or_model_or_options)
else
model = name_or_model_or_options
end
_set_wrapper_defaults(_wrapper_options.slice(:format).merge(options), model)
end
# Sets the default wrapper key or model which will be used to determine
# wrapper key and attribute names. Will be called automatically when the
# module is inherited.
def inherited(klass)
if klass._wrapper_options[:format].present?
klass._set_wrapper_defaults(klass._wrapper_options.slice(:format))
end
super
end
protected
# Determine the wrapper model from the controller's name. By convention,
# this could be done by trying to find the defined model that has the
# same singularize name as the controller. For example, +UsersController+
# will try to find if the +User+ model exists.
#
# This method also does namespace lookup. Foo::Bar::UsersController will
# try to find Foo::Bar::User, Foo::User and finally User.
def _default_wrap_model #:nodoc:
return nil if self.anonymous?
model_name = self.name.sub(/Controller$/, '').singularize
begin
model_klass = model_name.constantize
rescue NameError, ArgumentError => e
if e.message =~ /is not missing constant|uninitialized constant #{model_name}/
namespaces = model_name.split("::")
namespaces.delete_at(-2)
break if namespaces.last == model_name
model_name = namespaces.join("::")
else
raise
end
end until model_klass
model_klass
end
def _set_wrapper_defaults(options, model=nil)
options = options.dup
unless options[:include] || options[:exclude]
model ||= _default_wrap_model
if model.respond_to?(:attribute_names) && model.attribute_names.present?
options[:include] = model.attribute_names
end
end
unless options[:name] || self.anonymous?
model ||= _default_wrap_model
options[:name] = model ? model.to_s.demodulize.underscore :
controller_name.singularize
end
options[:include] = Array.wrap(options[:include]).collect(&:to_s) if options[:include]
options[:exclude] = Array.wrap(options[:exclude]).collect(&:to_s) if options[:exclude]
options[:format] = Array.wrap(options[:format])
self._wrapper_options = options
end
end
# Performs parameters wrapping upon the request. Will be called automatically
# by the metal call stack.
def process_action(*args)
if _wrapper_enabled?
wrapped_hash = _wrap_parameters request.request_parameters
wrapped_filtered_hash = _wrap_parameters request.filtered_parameters
# This will make the wrapped hash accessible from controller and view
request.parameters.merge! wrapped_hash
request.request_parameters.merge! wrapped_hash
# This will make the wrapped hash displayed in the log file
request.filtered_parameters.merge! wrapped_filtered_hash
end
super
end
private
# Returns the wrapper key which will use to stored wrapped parameters.
def _wrapper_key
_wrapper_options[:name]
end
# Returns the list of enabled formats.
def _wrapper_formats
_wrapper_options[:format]
end
# Returns the list of parameters which will be selected for wrapped.
def _wrap_parameters(parameters)
value = if include_only = _wrapper_options[:include]
parameters.slice(*include_only)
else
exclude = _wrapper_options[:exclude] || []
parameters.except(*(exclude + EXCLUDE_PARAMETERS))
end
{ _wrapper_key => value }
end
# Checks if we should perform parameters wrapping.
def _wrapper_enabled?
ref = request.content_mime_type.try(:ref)
_wrapper_formats.include?(ref) && _wrapper_key && !request.request_parameters[_wrapper_key]
end
end
end

View File

@@ -20,6 +20,7 @@ module ActionController
# * <tt>Record</tt> - The URL will be generated by calling url_for with the +options+, which will reference a named URL for that record.
# * <tt>String</tt> starting with <tt>protocol://</tt> (like <tt>http://</tt>) - Is passed straight through as the target for redirection.
# * <tt>String</tt> not containing a protocol - The current protocol and host is prepended to the string.
# * <tt>Proc</tt> - A block that will be executed in the controller's context. Should return any option accepted by +redirect_to+.
# * <tt>:back</tt> - Back to the page that issued the request. Useful for forms that are triggered from multiple places.
# Short-hand for <tt>redirect_to(request.env["HTTP_REFERER"])</tt>
#
@@ -30,6 +31,7 @@ module ActionController
# redirect_to "/images/screenshot.jpg"
# redirect_to articles_url
# redirect_to :back
# redirect_to proc { edit_post_url(@post) }
#
# The redirection happens as a "302 Moved" header unless otherwise specified.
#
@@ -38,11 +40,12 @@ module ActionController
# redirect_to :action=>'atom', :status => :moved_permanently
# redirect_to post_url(@post), :status => 301
# redirect_to :action=>'atom', :status => 302
#
#
# 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:
@@ -85,6 +88,8 @@ module ActionController
when :back
raise RedirectBackError unless refer = request.headers["Referer"]
refer
when Proc
_compute_redirect_to_location options.call
else
url_for(options)
end.gsub(/[\0\r\n]/, '')

View File

@@ -2,6 +2,7 @@ require 'active_support/core_ext/class/attribute'
require 'active_support/core_ext/object/blank'
module ActionController
# See <tt>Renderers.add</tt>
def self.add_renderer(key, &block)
Renderers.add(key, &block)
end
@@ -15,30 +16,12 @@ module ActionController
end
module ClassMethods
def _write_render_options
renderers = _renderers.map do |name, value|
<<-RUBY_EVAL
if options.key?(:#{name})
_process_options(options)
return _render_option_#{name}(options.delete(:#{name}), options)
end
RUBY_EVAL
end
class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
def _handle_render_options(options)
#{renderers.join}
end
RUBY_EVAL
end
def use_renderers(*args)
new = _renderers.dup
args.each do |key|
new[key] = RENDERERS[key]
end
self._renderers = new.freeze
_write_render_options
end
alias use_renderer use_renderers
end
@@ -47,26 +30,64 @@ module ActionController
_handle_render_options(options) || super
end
def _handle_render_options(options)
_renderers.each do |name, value|
if options.key?(name.to_sym)
_process_options(options)
return send("_render_option_#{name}", options.delete(name.to_sym), options)
end
end
nil
end
# Hash of available renderers, mapping a renderer name to its proc.
# Default keys are :json, :js, :xml.
RENDERERS = {}
# Adds a new renderer to call within controller actions.
# A renderer is invoked by passing its name as an option to
# <tt>AbstractController::Rendering#render</tt>. To create a renderer
# pass it a name and a block. The block takes two arguments, the first
# is the value paired with its key and the second is the remaining
# hash of options passed to +render+.
#
# === Example
# Create a csv renderer:
#
# ActionController::Renderers.add :csv do |obj, options|
# filename = options[:filename] || 'data'
# str = obj.respond_to?(:to_csv) ? obj.to_csv : obj.to_s
# send_data str, :type => Mime::CSV,
# :disposition => "attachment; filename=#{filename}.csv"
# end
#
# Note that we used Mime::CSV for the csv mime type as it comes with Rails.
# For a custom renderer, you'll need to register a mime type with
# <tt>Mime::Type.register</tt>.
#
# To use the csv renderer in a controller action:
#
# def show
# @csvable = Csvable.find(params[:id])
# respond_to do |format|
# format.html
# format.csv { render :csv => @csvable, :filename => @csvable.name }
# }
# end
# To use renderers and their mime types in more concise ways, see
# <tt>ActionController::MimeResponds::ClassMethods.respond_to</tt> and
# <tt>ActionController::MimeResponds#respond_with</tt>
def self.add(key, &block)
define_method("_render_option_#{key}", &block)
RENDERERS[key] = block
All._write_render_options
end
module All
extend ActiveSupport::Concern
include Renderers
INCLUDED = []
included do
self._renderers = RENDERERS
_write_render_options
INCLUDED << self
end
def self._write_render_options
INCLUDED.each(&:_write_render_options)
end
end
@@ -74,24 +95,17 @@ module ActionController
json = json.to_json(options) unless json.kind_of?(String)
json = "#{options[:callback]}(#{json})" unless options[:callback].blank?
self.content_type ||= Mime::JSON
self.response_body = json
json
end
add :js do |js, options|
self.content_type ||= Mime::JS
self.response_body = js.respond_to?(:to_js) ? js.to_js(options) : js
js.respond_to?(:to_js) ? js.to_js(options) : js
end
add :xml do |xml, options|
self.content_type ||= Mime::XML
self.response_body = xml.respond_to?(:to_xml) ? xml.to_xml(options) : xml
end
add :update do |proc, options|
view_context = self.view_context
generator = ActionView::Helpers::PrototypeHelper::JavaScriptGenerator.new(view_context, &proc)
self.content_type = Mime::JS
self.response_body = generator.to_s
xml.respond_to?(:to_xml) ? xml.to_xml(options) : xml
end
end
end

View File

@@ -2,7 +2,6 @@ module ActionController
module Rendering
extend ActiveSupport::Concern
include ActionController::RackDelegation
include AbstractController::Rendering
# Before processing, set the request formats in current controller formats.
@@ -19,38 +18,48 @@ module ActionController
response_body
end
# Overwrite render_to_string because body can now be set to a rack body.
def render_to_string(*)
if self.response_body = super
string = ""
response_body.each { |r| string << r }
string
end
ensure
self.response_body = nil
end
private
# Normalize arguments by catching blocks and setting them on :update.
def _normalize_args(action=nil, options={}, &blk) #:nodoc:
options = super
options[:update] = blk if block_given?
options
# Normalize arguments by catching blocks and setting them on :update.
def _normalize_args(action=nil, options={}, &blk) #:nodoc:
options = super
options[:update] = blk if block_given?
options
end
# Normalize both text and status options.
def _normalize_options(options) #:nodoc:
if options.key?(:text) && options[:text].respond_to?(:to_text)
options[:text] = options[:text].to_text
end
# Normalize both text and status options.
def _normalize_options(options) #:nodoc:
if options.key?(:text) && options[:text].respond_to?(:to_text)
options[:text] = options[:text].to_text
end
if options[:status]
options[:status] = Rack::Utils.status_code(options[:status])
end
super
if options[:status]
options[:status] = Rack::Utils.status_code(options[:status])
end
# Process controller specific options, as status, content-type and location.
def _process_options(options) #:nodoc:
status, content_type, location = options.values_at(:status, :content_type, :location)
super
end
self.status = status if status
self.content_type = content_type if content_type
self.headers["Location"] = url_for(location) if location
# Process controller specific options, as status, content-type and location.
def _process_options(options) #:nodoc:
status, content_type, location = options.values_at(:status, :content_type, :location)
super
end
self.status = status if status
self.content_type = content_type if content_type
self.headers["Location"] = url_for(location) if location
super
end
end
end

View File

@@ -4,45 +4,26 @@ module ActionController #:nodoc:
class InvalidAuthenticityToken < ActionControllerError #:nodoc:
end
# Protecting controller actions from CSRF attacks by ensuring that all forms are coming from the current
# web application, not a forged link from another site, is done by embedding a token based on a random
# string stored in the session (which an attacker wouldn't know) in all forms and Ajax requests generated
# by Rails and then verifying the authenticity of that token in the controller. Only HTML/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 anyway.
# 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 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.
#
# This 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. You can customize the
# error message in production by editing public/422.html. A call to this method in ApplicationController is
# generated by default in post-Rails 2.0 applications.
# CSRF protection is turned on with the <tt>protect_from_forgery</tt> method,
# 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. If you are generating an HTML form
# manually (without the use of Rails' <tt>form_for</tt>, <tt>form_tag</tt> or other helpers), you have to
# include a hidden field named like that and set its value to what is returned by
# <tt>form_authenticity_token</tt>.
#
# Request forgery protection is disabled by default in test environment. If you are upgrading from Rails
# 1.x, add this to config/environments/test.rb:
#
# # Disable request forgery protection in test environment
# config.action_controller.allow_forgery_protection = false
#
# == Learn more about CSRF (Cross-Site Request Forgery) attacks
#
# Here are some resources:
# * http://isc.sans.org/diary.html?storyid=1750
# * http://en.wikipedia.org/wiki/Cross-site_request_forgery
#
# Keep in mind, this is NOT a silver-bullet, plug 'n' play, warm security blanket for your rails application.
# There are a few guidelines you should follow:
#
# * Keep your GET requests safe and idempotent. More reading material:
# * http://www.xml.com/pub/a/2002/04/24/deviant.html
# * http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.1.1
# * Make sure the session cookies that Rails creates are non-persistent. Check in Firefox and look
# for "Expires: at end of session"
# 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
# <tt>csrf_meta_tags</tt> in the html +head+.
#
# Learn more about CSRF attacks and securing your application in the
# {Ruby on Rails Security Guide}[http://guides.rubyonrails.org/security.html].
module RequestForgeryProtection
extend ActiveSupport::Concern
@@ -81,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
@@ -89,16 +70,21 @@ 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
verified_request? || handle_unverified_request
unless verified_request?
logger.debug "WARNING: Can't verify CSRF token authenticity" if logger
handle_unverified_request
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?
@@ -111,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

@@ -1,7 +1,7 @@
require 'active_support/json'
module ActionController #:nodoc:
# Responder is responsible for exposing a resource to different mime requests,
# Responsible for exposing a resource to different mime requests,
# usually depending on the HTTP verb. The responder is triggered when
# <code>respond_with</code> is called. The simplest case to study is a GET request:
#
@@ -24,10 +24,10 @@ module ActionController #:nodoc:
#
# === Builtin HTTP verb semantics
#
# The default Rails responder holds semantics for each HTTP verb. Depending on the
# The default \Rails responder holds semantics for each HTTP verb. Depending on the
# content type, verb and the resource status, it will behave differently.
#
# Using Rails default responder, a POST request for creating an object could
# Using \Rails default responder, a POST request for creating an object could
# be written as:
#
# def create
@@ -68,7 +68,7 @@ module ActionController #:nodoc:
# respond_with(@project, @task)
# end
#
# Giving an array of resources, you ensure that the responder will redirect to
# Giving several resources ensures that the responder will redirect to
# <code>project_task_url</code> instead of <code>task_url</code>.
#
# Namespaced and singleton resources require a symbol to be given, as in
@@ -77,8 +77,42 @@ module ActionController #:nodoc:
#
# respond_with(@project, :manager, @task)
#
# Check <code>polymorphic_url</code> documentation for more examples.
# Note that if you give an array, it will be treated as a collection,
# so the following is not equivalent:
#
# respond_with [@project, :manager, @task]
#
# === Custom options
#
# <code>respond_with</code> also allow you to pass options that are forwarded
# to the underlying render call. Those options are only applied success
# scenarios. For instance, you can do the following in the create method above:
#
# def create
# @project = Project.find(params[:project_id])
# @task = @project.comments.build(params[:task])
# flash[:notice] = 'Task was successfully created.' if @task.save
# respond_with(@project, @task, :status => 201)
# end
#
# This will return status 201 if the task was saved with success. If not,
# it will simply ignore the given options and return status 422 and the
# resource errors. To customize the failure scenario, you can pass a
# a block to <code>respond_with</code>:
#
# def create
# @project = Project.find(params[:project_id])
# @task = @project.comments.build(params[:task])
# respond_with(@project, @task, :status => 201) do |format|
# if @task.save
# flash[:notice] = 'Task was successfully created.'
# else
# format.html { render "some_special_template" }
# end
# end
# end
#
# Using <code>respond_with</code> with a block follows the same syntax as <code>respond_to</code>.
class Responder
attr_reader :controller, :request, :format, :resource, :resources, :options
@@ -115,7 +149,7 @@ module ActionController #:nodoc:
# Main entry point for responder responsible to dispatch to the proper format.
#
def respond
method = :"to_#{format}"
method = "to_#{format}"
respond_to?(method) ? send(method) : to_format
end
@@ -128,19 +162,28 @@ 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.
#
def to_format
default_render
if get? || !has_errors?
default_render
else
display_errors
end
rescue ActionView::MissingTemplate => e
api_behavior(e)
end
protected
# This is the common behavior for "navigation" requests, like :html, :iphone and so forth.
# This is the common behavior for formats associated with browsing, like :html, :iphone and so forth.
def navigation_behavior(error)
if get?
raise error
@@ -151,14 +194,12 @@ module ActionController #:nodoc:
end
end
# This is the common behavior for "API" requests, like :xml and :json.
# This is the common behavior for formats associated with APIs, such as :xml and :json.
def api_behavior(error)
raise error unless resourceful?
if get?
display resource
elsif has_errors?
display resource.errors, :status => :unprocessable_entity
elsif post?
display resource, :status => :created, :location => api_location
elsif has_empty_resource_definition?
@@ -171,7 +212,7 @@ module ActionController #:nodoc:
# Checks whether the resource responds to the current format or not.
#
def resourceful?
resource.respond_to?(:"to_#{format}")
resource.respond_to?("to_#{format}")
end
# Returns the resource location by retrieving it from the options or
@@ -187,7 +228,7 @@ module ActionController #:nodoc:
# controller.
#
def default_render
@default_response.call
@default_response.call(options)
end
# Display is just a shortcut to render a resource with the current format.
@@ -211,6 +252,10 @@ module ActionController #:nodoc:
controller.render given_options.merge!(options).merge!(format => resource)
end
def display_errors
controller.render format => resource.errors, :status => :unprocessable_entity
end
# Check whether the resource has errors.
#
def has_errors?

View File

@@ -1,157 +1,254 @@
require 'active_support/core_ext/file/path'
require 'rack/chunked'
module ActionController #:nodoc:
# Methods for sending arbitrary data and for streaming files to the browser,
# instead of rendering.
# Allows views to be streamed back to the client as they are rendered.
#
# The default way Rails renders views is by first rendering the template
# and then the layout. The response is sent to the client after the whole
# template is rendered, all queries are made, and the layout is processed.
#
# Streaming inverts the rendering flow by rendering the layout first and
# streaming each part of the layout as they are processed. This allows the
# header of the HTML (which is usually in the layout) to be streamed back
# to client very quickly, allowing JavaScripts and stylesheets to be loaded
# earlier than usual.
#
# This approach was introduced in Rails 3.1 and is still improving. Several
# Rack middlewares may not work and you need to be careful when streaming.
# Those points are going to be addressed soon.
#
# In order to use streaming, you will need to use a Ruby version that
# supports fibers (fibers are supported since version 1.9.2 of the main
# Ruby implementation).
#
# == Examples
#
# Streaming can be added to a given template easily, all you need to do is
# to pass the :stream option.
#
# class PostsController
# def index
# @posts = Post.scoped
# render :stream => true
# end
# end
#
# == When to use streaming
#
# Streaming may be considered to be overkill for lightweight actions like
# +new+ or +edit+. The real benefit of streaming is on expensive actions
# that, for example, do a lot of queries on the database.
#
# In such actions, you want to delay queries execution as much as you can.
# For example, imagine the following +dashboard+ action:
#
# def dashboard
# @posts = Post.all
# @pages = Page.all
# @articles = Article.all
# end
#
# Most of the queries here are happening in the controller. In order to benefit
# from streaming you would want to rewrite it as:
#
# def dashboard
# # Allow lazy execution of the queries
# @posts = Post.scoped
# @pages = Page.scoped
# @articles = Article.scoped
# 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.
# Rails starts with the layout, and the template is rendered later,
# when its +yield+ is reached.
#
# This means that, if your application currently relies on instance
# variables set in the template to be used in the layout, they won't
# work once you move to streaming. The proper way to communicate
# between layout and template, regardless of whether you use streaming
# or not, is by using +content_for+, +provide+ and +yield+.
#
# Take a simple example where the layout expects the template to tell
# which title to use:
#
# <html>
# <head><title><%= yield :title %></title></head>
# <body><%= yield %></body>
# </html>
#
# You would use +content_for+ in your template to specify the title:
#
# <%= content_for :title, "Main" %>
# Hello
#
# And the final result would be:
#
# <html>
# <head><title>Main</title></head>
# <body>Hello</body>
# </html>
#
# However, if +content_for+ is called several times, the final result
# would have all calls concatenated. For instance, if we have the following
# template:
#
# <%= content_for :title, "Main" %>
# Hello
# <%= content_for :title, " page" %>
#
# The final result would be:
#
# <html>
# <head><title>Main page</title></head>
# <body>Hello</body>
# </html>
#
# This means that, if you have <code>yield :title</code> in your layout
# and you want to use streaming, you would have to render the whole template
# (and eventually trigger all queries) before streaming the title and all
# assets, which kills the purpose of streaming. For this reason Rails 3.1
# introduces a new helper called +provide+ that does the same as +content_for+
# but tells the layout to stop searching for other entries and continue rendering.
#
# For instance, the template above using +provide+ would be:
#
# <%= provide :title, "Main" %>
# Hello
# <%= content_for :title, " page" %>
#
# Giving:
#
# <html>
# <head><title>Main</title></head>
# <body>Hello</body>
# </html>
#
# That said, when streaming, you need to properly check your templates
# and choose when to use +provide+ and +content_for+.
#
# == Headers, cookies, session and flash
#
# When streaming, the HTTP headers are sent to the client right before
# it renders the first line. This means that, modifying headers, cookies,
# session or flash after the template starts rendering will not propagate
# to the client.
#
# If you try to modify cookies, session or flash, an +ActionDispatch::ClosedError+
# will be raised, showing those objects are closed for modification.
#
# == Middlewares
#
# Middlewares that need to manipulate the body won't work with streaming.
# You should disable those middlewares whenever streaming in development
# or production. For instance, +Rack::Bug+ won't work when streaming as it
# needs to inject contents in the HTML body.
#
# Also +Rack::Cache+ won't work with streaming as it does not support
# streaming bodies yet. Whenever streaming Cache-Control is automatically
# set to "no-cache".
#
# == Errors
#
# When it comes to streaming, exceptions get a bit more complicated. This
# happens because part of the template was already rendered and streamed to
# the client, making it impossible to render a whole exception page.
#
# Currently, when an exception happens in development or production, Rails
# will automatically stream to the client:
#
# "><script type="text/javascript">window.location = "/500.html"</script></html>
#
# The first two characters (">) are required in case the exception happens
# while rendering attributes for a given tag. You can check the real cause
# for the exception in your logger.
#
# == Web server support
#
# Not all web servers support streaming out-of-the-box. You need to check
# the instructions for each of them.
#
# ==== Unicorn
#
# Unicorn supports streaming but it needs to be configured. For this, you
# need to create a config file as follow:
#
# # unicorn.config.rb
# listen 3000, :tcp_nopush => false
#
# And use it on initialization:
#
# unicorn_rails --config-file unicorn.config.rb
#
# You may also want to configure other parameters like <tt>:tcp_nodelay</tt>.
# Please check its documentation for more information: http://unicorn.bogomips.org/Unicorn/Configurator.html#method-i-listen
#
# If you are using Unicorn with Nginx, you may need to tweak Nginx.
# Streaming should work out of the box on Rainbows.
#
# ==== Passenger
#
# To be described.
#
module Streaming
extend ActiveSupport::Concern
include ActionController::Rendering
include AbstractController::Rendering
attr_internal :stream
DEFAULT_SEND_FILE_OPTIONS = {
:type => 'application/octet-stream'.freeze,
:disposition => 'attachment'.freeze,
}.freeze
module ClassMethods
# Render streaming templates. It accepts :only, :except, :if and :unless as options
# to specify when to stream, as in ActionController filters.
def stream(options={})
ActiveSupport::Deprecation.warn "stream class method is deprecated. Please give the :stream option to render instead"
if defined?(Fiber)
before_filter :_stream_filter, options
else
raise "You cannot use streaming if Fiber is not available."
end
end
end
protected
# 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".
# 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
# page. <tt>send_file(params[:path])</tt> allows a malicious user to
# download any file on your server.
#
# Options:
# * <tt>:filename</tt> - suggests a filename for the browser to use.
# Defaults to <tt>File.basename(path)</tt>.
# * <tt>:type</tt> - specifies an HTTP content type. Defaults to 'application/octet-stream'. You can specify
# either a string or a symbol for a registered type register with <tt>Mime::Type.register</tt>, for example :json
# * <tt>:disposition</tt> - specifies whether the file will be shown inline or downloaded.
# Valid values are 'inline' and 'attachment' (default).
# * <tt>:status</tt> - specifies the status code to send with the response. Defaults to '200 OK'.
# * <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).
#
# The default Content-Type and Content-Disposition headers are
# set to download arbitrary binary files in as many browsers as
# possible. IE versions 4, 5, 5.5, and 6 are all known to have
# a variety of quirks (especially when downloading over SSL).
#
# Simple download:
#
# send_file '/path/to.zip'
#
# Show a JPEG in the browser:
#
# send_file '/path/to.jpeg', :type => 'image/jpeg', :disposition => 'inline'
#
# Show a 404 page in the browser:
#
# send_file '/path/to/404.html', :type => 'text/html; charset=utf-8', :status => 404
#
# Read about the other Content-* HTTP headers if you'd like to
# provide the user with more information (such as Content-Description) in
# http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11.
#
# Also be aware that the document may be cached by proxies and browsers.
# The Pragma and Cache-Control headers declare how the file may be cached
# by intermediaries. They default to require clients to validate with
# the server before releasing cached responses. See
# http://www.mnot.net/cache_docs/ for an overview of web caching and
# http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9
# for the Cache-Control header spec.
def send_file(path, options = {}) #:doc:
raise MissingFile, "Cannot read file #{path}" unless File.file?(path) and File.readable?(path)
options[:filename] ||= File.basename(path) unless options[:url_based_filename]
send_file_headers! options
# Mark following render calls as streaming.
def _stream_filter #:nodoc:
self.stream = true
end
if options[:x_sendfile]
ActiveSupport::Deprecation.warn(":x_sendfile is no longer needed in send_file", caller)
end
# Consider the stream option when normalazing options.
def _normalize_options(options) #:nodoc:
super
options[:stream] = self.stream unless options.key?(:stream)
end
self.status = options[:status] || 200
self.content_type = options[:content_type] if options.key?(:content_type)
self.response_body = File.open(path, "rb")
end
# Sends the given binary data to the browser. This method is similar to
# <tt>render :text => data</tt>, but also allows you to specify whether
# the browser should display the response as a file attachment (i.e. in a
# download dialog) or as inline data. You may also set the content type,
# the apparent file name, and other things.
#
# Options:
# * <tt>:filename</tt> - suggests a filename for the browser to use.
# * <tt>:type</tt> - specifies an HTTP content type. Defaults to 'application/octet-stream'. You can specify
# either a string or a symbol for a registered type register with <tt>Mime::Type.register</tt>, for example :json
# * <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'.
#
# Generic data download:
#
# send_data buffer
#
# Download a dynamically-generated tarball:
#
# send_data generate_tgz('dir'), :filename => 'dir.tgz'
#
# Display an image Active Record in the browser:
#
# send_data image.data, :type => image.content_type, :disposition => 'inline'
#
# See +send_file+ for more information on HTTP Content-* headers and caching.
#
# <b>Tip:</b> if you want to stream large amounts of on-the-fly generated
# data to the browser, then use <tt>render :text => proc { ... }</tt>
# instead. See ActionController::Base#render for more information.
def send_data(data, options = {}) #:doc:
send_file_headers! options.dup
render options.slice(:status, :content_type).merge(:text => data)
end
private
def send_file_headers!(options)
options.update(DEFAULT_SEND_FILE_OPTIONS.merge(options))
[:type, :disposition].each do |arg|
raise ArgumentError, ":#{arg} option required" if options[arg].nil?
end
if options.key?(:length)
ActiveSupport::Deprecation.warn("You do not need to provide the file's length", caller)
end
disposition = options[:disposition]
disposition += %(; filename="#{options[:filename]}") if options[:filename]
content_type = options[:type]
if content_type.is_a?(Symbol)
extension = Mime[content_type]
raise ArgumentError, "Unknown MIME type #{options[:type]}" unless extension
self.content_type = extension
# Set proper cache control and transfer encoding when streaming
def _process_options(options) #:nodoc:
super
if options[:stream]
if env["HTTP_VERSION"] == "HTTP/1.0"
options.delete(:stream)
else
self.content_type = content_type
headers["Cache-Control"] ||= "no-cache"
headers["Transfer-Encoding"] = "chunked"
headers.delete("Content-Length")
end
headers.merge!(
'Content-Disposition' => disposition,
'Content-Transfer-Encoding' => 'binary'
)
response.sending_file = true
# Fix a problem with IE 6.0 on opening downloaded files:
# If Cache-Control: no-cache is set (which Rails does by default),
# IE removes the file it just downloaded from its cache immediately
# after it displays the "open/save" dialog, which means that if you
# hit "open" the file isn't there anymore when the application that
# is called for handling the download is run, so let's workaround that
response.cache_control[:public] ||= false
end
end
# Call render_to_body if we are streaming instead of usual +render+.
def _render_template(options) #:nodoc:
if options.delete(:stream)
Rack::Chunked::Body.new view_renderer.render_body(view_context, options)
else
super
end
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
@@ -14,18 +19,9 @@ module ActionController
cookies.write(@_response)
end
@_response.prepare!
set_test_assigns
ret
end
def set_test_assigns
@assigns = {}
(instance_variable_names - self.class.protected_instance_variables).each do |var|
name, value = var[1..-1], instance_variable_get(var)
@assigns[name] = value
end
end
# TODO : Rewrite tests using controller.headers= to use Rack env
def headers=(new_headers)
@_response ||= ActionDispatch::Response.new

View File

@@ -1,28 +1,47 @@
# Includes +url_for+ into the host class. The class has to provide a +RouteSet+ by implementing
# the <tt>_routes</tt> method. Otherwise, an exception will be raised.
#
# In addition to <tt>AbstractController::UrlFor</tt>, this module accesses the HTTP layer to define
# url options like the +host+. In order to do so, this module requires the host class
# to implement +env+ and +request+, which need to be a Rack-compatible.
#
# Example:
#
# class RootUrl
# include ActionController::UrlFor
# include Rails.application.routes.url_helpers
#
# delegate :env, :request, :to => :controller
#
# def initialize(controller)
# @controller = controller
# @url = root_path # named route from the application.
# end
# end
#
module ActionController
module UrlFor
extend ActiveSupport::Concern
include ActionDispatch::Routing::UrlFor
include AbstractController::UrlFor
def url_options
super.reverse_merge(
:host => request.host_with_port,
@_url_options ||= super.reverse_merge(
:host => request.host,
:port => request.optional_port,
:protocol => request.protocol,
:_path_segments => request.symbolized_path_parameters
).merge(:script_name => request.script_name)
end
).freeze
def _routes
raise "In order to use #url_for, you must include routing helpers explicitly. " \
"For instance, `include Rails.application.routes.url_helpers"
end
module ClassMethods
def action_methods
@action_methods ||= begin
super - _routes.named_routes.helper_names
if _routes.equal?(env["action_dispatch.routes"])
@_url_options.dup.tap do |options|
options[:script_name] = request.script_name.dup
options.freeze
end
else
@_url_options
end
end
end
end

View File

@@ -2,35 +2,13 @@ require "rails"
require "action_controller"
require "action_dispatch/railtie"
require "action_view/railtie"
require "active_support/deprecation/proxy_wrappers"
require "active_support/deprecation"
require "abstract_controller/railties/routes_helpers"
require "action_controller/railties/paths"
module ActionController
class Railtie < Rails::Railtie
config.action_controller = ActiveSupport::OrderedOptions.new
config.action_controller.singleton_class.tap do |d|
d.send(:define_method, :session) do
ActiveSupport::Deprecation.warn "config.action_controller.session has been deprecated. " <<
"Please use Rails.application.config.session_store instead.", caller
end
d.send(:define_method, :session=) do |val|
ActiveSupport::Deprecation.warn "config.action_controller.session= has been deprecated. " <<
"Please use config.session_store(name, options) instead.", caller
end
d.send(:define_method, :session_store) do
ActiveSupport::Deprecation.warn "config.action_controller.session_store has been deprecated. " <<
"Please use Rails.application.config.session_store instead.", caller
end
d.send(:define_method, :session_store=) do |val|
ActiveSupport::Deprecation.warn "config.action_controller.session_store= has been deprecated. " <<
"Please use config.session_store(name, options) instead.", caller
end
end
initializer "action_controller.logger" do
ActiveSupport.on_load(:action_controller) { self.logger ||= Rails.logger }
end
@@ -43,24 +21,27 @@ module ActionController
paths = app.config.paths
options = app.config.action_controller
options.assets_dir ||= paths.public.to_a.first
options.javascripts_dir ||= paths.public.javascripts.to_a.first
options.stylesheets_dir ||= paths.public.stylesheets.to_a.first
options.page_cache_directory ||= paths.public.to_a.first
options.helpers_path ||= paths.app.helpers.to_a
options.assets_dir ||= paths["public"].first
options.javascripts_dir ||= paths["public/javascripts"].first
options.stylesheets_dir ||= paths["public/stylesheets"].first
options.page_cache_directory ||= paths["public"].first
# make sure readers methods get compiled
options.asset_path ||= app.config.asset_path
options.asset_host ||= app.config.asset_host
ActiveSupport.on_load(:action_controller) do
include app.routes.url_helpers
include app.routes.mounted_helpers
extend ::AbstractController::Railties::RoutesHelpers.with(app.routes)
extend ::ActionController::Railties::Paths.with(app)
options.each { |k,v| send("#{k}=", v) }
end
end
initializer "action_controller.deprecated_routes" do |app|
message = "ActionController::Routing::Routes is deprecated. " \
"Instead, use Rails.application.routes"
proxy = ActiveSupport::Deprecation::DeprecatedObjectProxy.new(app.routes, message)
ActionController::Routing::Routes = proxy
initializer "action_controller.compile_config_methods" do
ActiveSupport.on_load(:action_controller) do
config.compile_methods! if config.respond_to?(:compile_methods!)
end
end
end
end
end

View File

@@ -0,0 +1,24 @@
module ActionController
module Railties
module Paths
def self.with(app)
Module.new do
define_method(:inherited) do |klass|
super(klass)
if namespace = klass.parents.detect {|m| m.respond_to?(:_railtie) }
paths = namespace._railtie.paths["app/helpers"].existent
else
paths = app.config.helpers_paths
end
klass.helpers_path = paths
if klass.superclass == ActionController::Base && ActionController::Base.include_all_helpers
klass.helper :all
end
end
end
end
end
end
end

View File

@@ -18,18 +18,12 @@ module ActionController
# post = Post.find(params[:id])
# post.destroy
#
# respond_to do |format|
# format.html { redirect_to(post) } # Calls polymorphic_url(post) which in turn calls post_url(post)
# format.js do
# # Calls: new Effect.fade('post_45');
# render(:update) { |page| page[post].visual_effect(:fade) }
# end
# end
# redirect_to(post) # Calls polymorphic_url(post) which in turn calls post_url(post)
# end
#
# As the example above shows, you can stop caring to a large extent what the actual id of the post is. You just know
# that one is being assigned and that the subsequent calls in redirect_to and the RJS expect that same naming
# convention and allows you to write less code if you follow it.
# As the example above shows, you can stop caring to a large extent what the actual id of the post is.
# You just know that one is being assigned and that the subsequent calls in redirect_to expect that
# same naming convention and allows you to write less code if you follow it.
module RecordIdentifier
extend self

View File

@@ -1,6 +1,8 @@
require 'rack/session/abstract/id'
require 'active_support/core_ext/object/blank'
require 'active_support/core_ext/object/to_query'
require 'active_support/core_ext/class/attribute'
require 'active_support/core_ext/module/anonymous'
module ActionController
module TemplateAssertions
@@ -99,11 +101,11 @@ module ActionController
elsif options.key?(:layout)
msg = build_message(message,
"expecting layout <?> but action rendered <?>",
options[:layout], @layouts.keys)
expected_layout, @layouts.keys)
case layout = options[:layout]
when String
assert(@layouts.include?(layout), msg)
assert(@layouts.include?(expected_layout), msg)
when Regexp
assert(@layouts.any? {|l| l =~ layout }, msg)
when nil
@@ -128,13 +130,13 @@ 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:
def to_s() join '/' end
def self.new_escaped(strings)
new strings.collect {|str| URI.unescape str}
new strings.collect {|str| uri_parser.unescape str}
end
end
@@ -143,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
@@ -173,12 +181,16 @@ module ActionController
end
def recycle!
write_cookies!
@env.delete('HTTP_COOKIE') if @cookies.blank?
@env.delete('action_dispatch.cookies')
@cookies = nil
@formats = nil
@env.delete_if { |k, v| k =~ /^(action_dispatch|rack)\.request/ }
@env.delete_if { |k, v| k =~ /^action_dispatch\.rescue/ }
@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
@@ -196,20 +208,23 @@ module ActionController
end
end
class TestSession < ActionDispatch::Session::AbstractStore::SessionHash #:nodoc:
DEFAULT_OPTIONS = ActionDispatch::Session::AbstractStore::DEFAULT_OPTIONS
class TestSession < Rack::Session::Abstract::SessionHash #:nodoc:
DEFAULT_OPTIONS = Rack::Session::Abstract::ID::DEFAULT_OPTIONS
def initialize(session = {})
@env, @by = nil, nil
replace(session.stringify_keys)
@loaded = true
end
def exists?; true; end
def exists?
true
end
end
# Superclass for ActionController functional tests. Functional tests allow you to
# test a single controller action per test method. This should not be confused with
# integration tests (see ActionController::IntegrationTest), which are more like
# integration tests (see ActionDispatch::IntegrationTest), which are more like
# "stories" that can involve multiple controllers and multiple actions (i.e. multiple
# different HTTP requests).
#
@@ -254,7 +269,7 @@ module ActionController
# after calling +post+. If the various assert methods are not sufficient, then you
# may use this object to inspect the HTTP response in detail.
#
# (Earlier versions of Rails required each functional test to subclass
# (Earlier versions of \Rails required each functional test to subclass
# Test::Unit::TestCase and define @controller, @request, @response in +setup+.)
#
# == Controller is automatically inferred
@@ -267,7 +282,7 @@ module ActionController
# tests WidgetController
# end
#
# == Testing controller internals
# == \Testing controller internals
#
# In addition to these specific assertions, you also have easy access to various collections that the regular test/unit assertions
# can be used against. These collections are:
@@ -275,7 +290,7 @@ module ActionController
# * assigns: Instance variables assigned in the action that are available for the view.
# * session: Objects being saved in the session.
# * flash: The flash objects currently in the session.
# * cookies: Cookies being sent to the user on this request.
# * cookies: \Cookies being sent to the user on this request.
#
# These collections can be used just like any other hash:
#
@@ -299,9 +314,13 @@ module ActionController
# and cookies, though. For sessions, you just do:
#
# @request.session[:key] = "value"
# @request.cookies["key"] = "value"
# @request.cookies[:key] = "value"
#
# == Testing named routes
# To clear the cookies for a test just clear the request's cookies hash:
#
# @request.cookies.clear
#
# == \Testing named routes
#
# If you're using named routes, they can be easily tested using the original named routes' methods straight in the test case.
# Example:
@@ -324,11 +343,11 @@ module ActionController
def controller_class=(new_class)
prepare_controller_class(new_class) if new_class
write_inheritable_attribute(:controller_class, new_class)
self._controller_class = new_class
end
def controller_class
if current_controller_class = read_inheritable_attribute(:controller_class)
if current_controller_class = self._controller_class
current_controller_class
else
self.controller_class = determine_default_controller_class(name)
@@ -382,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|
@@ -401,18 +437,23 @@ module ActionController
@request.env['REQUEST_METHOD'] = http_method
parameters ||= {}
@request.assign_parameters(@routes, @controller.class.name.underscore.sub(/_controller$/, ''), action.to_s, parameters)
controller_class_name = @controller.class.anonymous? ?
"anonymous_controller" :
@controller.class.name.underscore.sub(/_controller$/, '')
@request.session = ActionController::TestSession.new(session) unless session.nil?
@request.assign_parameters(@routes, controller_class_name, action.to_s, parameters)
@request.session = ActionController::TestSession.new(session) if session
@request.session["flash"] = @request.flash.update(flash || {})
@request.session["flash"].sweep
@controller.request = @request
@controller.params.merge!(parameters)
build_request_uri(action, parameters)
Base.class_eval { include Testing }
@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?
@request.cookies.merge!(@response.cookies)
@response
end
@@ -426,7 +467,7 @@ module ActionController
@request.env.delete('PATH_INFO')
if @controller
if defined?(@controller) && @controller
@controller.request = @request
@controller.params = {}
end
@@ -440,6 +481,7 @@ module ActionController
included do
include ActionController::TemplateAssertions
include ActionDispatch::Assertions
class_attribute :_controller_class
setup :setup_controller_request_and_response
end
@@ -447,7 +489,7 @@ module ActionController
def build_request_uri(action, parameters)
unless @request.env["PATH_INFO"]
options = @controller.__send__(:url_options).merge(parameters)
options = @controller.respond_to?(:url_options) ? @controller.__send__(:url_options).merge(parameters) : parameters
options.update(
:only_path => true,
:action => action,
@@ -461,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
@@ -471,9 +519,11 @@ module ActionController
# The exception is stored in the exception accessor for further inspection.
module RaiseActionExceptions
def self.included(base)
base.class_eval do
attr_accessor :exception
protected :exception, :exception=
unless base.method_defined?(:exception) && base.method_defined?(:exception=)
base.class_eval do
attr_accessor :exception
protected :exception, :exception=
end
end
end

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

@@ -18,14 +18,14 @@ module HTML #:nodoc:
hash[k] = Conditions.new(v)
when :children
hash[k] = v = keys_to_symbols(v)
v.each do |k,v2|
case k
v.each do |key,value|
case key
when :count, :greater_than, :less_than
# keys are valid, and require no further processing
when :only
v[k] = Conditions.new(v2)
v[key] = Conditions.new(value)
else
raise "illegal key #{k.inspect} => #{v2.inspect}"
raise "illegal key #{key.inspect} => #{value.inspect}"
end
end
else

View File

@@ -1,5 +1,6 @@
require 'set'
require 'active_support/core_ext/class/inheritable_attributes'
require 'cgi'
require 'active_support/core_ext/class/attribute'
module HTML
class Sanitizer
@@ -33,7 +34,7 @@ module HTML
result = super
# strip any comments, and if they have a newline at the end (ie. line with
# only a comment) strip that too
result.gsub!(/<!--(.*?)-->[\n]?/m, "") if result
result = result.gsub(/<!--(.*?)-->[\n]?/m, "") if (result && result =~ /<!--(.*?)-->[\n]?/m)
# Recurse - handle all dirty nested tags
result == text ? result : sanitize(result, options)
end
@@ -60,7 +61,7 @@ module HTML
class WhiteListSanitizer < Sanitizer
[:protocol_separator, :uri_attributes, :allowed_attributes, :allowed_tags, :allowed_protocols, :bad_tags,
:allowed_css_properties, :allowed_css_keywords, :shorthand_css_properties].each do |attr|
class_inheritable_accessor attr, :instance_writer => false
class_attribute attr, :instance_writer => false
end
# A regular expression of the valid characters used to separate protocols like
@@ -170,7 +171,7 @@ module HTML
def contains_bad_protocols?(attr_name, value)
uri_attributes.include?(attr_name) &&
(value =~ /(^[^\/:]*):|(&#0*58)|(&#x70)|(%|&#37;)3A/ && !allowed_protocols.include?(value.split(protocol_separator).first))
(value =~ /(^[^\/:]*):|(&#0*58)|(&#x70)|(%|&#37;)3A/ && !allowed_protocols.include?(value.split(protocol_separator).first.downcase))
end
end
end

View File

@@ -128,6 +128,8 @@ module HTML
# (no parent element).
# * <tt>:empty</tt> -- Match the element only if it has no child elements,
# and no text content.
# * <tt>:content(string)</tt> -- Match the element only if it has <tt>string</tt>
# as its text content (ignoring leading and trailing whitespace).
# * <tt>:only-child</tt> -- Match the element if it is the only child (element)
# of its parent element.
# * <tt>:only-of-type</tt> -- Match the element if it is the only child (element)

View File

@@ -1,5 +1,5 @@
#--
# Copyright (c) 2004-2010 David Heinemeier Hansson
# Copyright (c) 2004-2011 David Heinemeier Hansson
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -53,12 +53,14 @@ module ActionDispatch
autoload :Flash
autoload :Head
autoload :ParamsParser
autoload :Reloader
autoload :RemoteIp
autoload :Rescue
autoload :ShowExceptions
autoload :Static
end
autoload :ClosedError, 'action_dispatch/middleware/closed_error'
autoload :MiddlewareStack, 'action_dispatch/middleware/stack'
autoload :Routing
@@ -85,6 +87,7 @@ module ActionDispatch
autoload_under 'testing' do
autoload :Assertions
autoload :Integration
autoload :IntegrationTest, 'action_dispatch/testing/integration'
autoload :PerformanceTest
autoload :TestProcess
autoload :TestRequest

View File

@@ -39,22 +39,8 @@ module ActionDispatch
end
module Response
attr_reader :cache_control
def initialize(*)
status, header, body = super
@cache_control = {}
@etag = self["ETag"]
if cache_control = self["Cache-Control"]
cache_control.split(/,\s*/).each do |segment|
first, last = segment.split("=")
last ||= true
@cache_control[first.to_sym] = last
end
end
end
attr_reader :cache_control, :etag
alias :etag? :etag
def last_modified
if last = headers['Last-Modified']
@@ -70,14 +56,6 @@ module ActionDispatch
headers['Last-Modified'] = utc_time.httpdate
end
def etag
@etag
end
def etag?
@etag
end
def etag=(etag)
key = ActiveSupport::Cache.expand_cache_key(etag)
@etag = self["ETag"] = %("#{Digest::MD5.hexdigest(key)}")
@@ -85,29 +63,22 @@ module ActionDispatch
private
def handle_conditional_get!
if etag? || last_modified? || !@cache_control.empty?
set_conditional_cache_control!
elsif nonempty_ok_response?
self.etag = body
def prepare_cache_control!
@cache_control = {}
@etag = self["ETag"]
if request && request.etag_matches?(etag)
self.status = 304
self.body = []
if cache_control = self["Cache-Control"]
cache_control.split(/,\s*/).each do |segment|
first, last = segment.split("=")
@cache_control[first.to_sym] = last || true
end
set_conditional_cache_control!
else
headers["Cache-Control"] = "no-cache"
end
end
def nonempty_ok_response?
@status == 200 && string_body?
end
def string_body?
!@blank && @body.respond_to?(:all?) && @body.all? { |part| part.is_a?(String) }
def handle_conditional_get!
if etag? || last_modified? || !@cache_control.empty?
set_conditional_cache_control!
end
end
DEFAULT_CACHE_CONTROL = "max-age=0, private, must-revalidate"
@@ -119,7 +90,7 @@ module ActionDispatch
if control.empty?
headers["Cache-Control"] = DEFAULT_CACHE_CONTROL
elsif @cache_control[:no_cache]
elsif control[:no_cache]
headers["Cache-Control"] = "no-cache"
else
extras = control[:extras]

View File

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

View File

@@ -1,6 +1,13 @@
module ActionDispatch
module Http
module MimeNegotiation
extend ActiveSupport::Concern
included do
mattr_accessor :ignore_accept_header
self.ignore_accept_header = false
end
# The MIME type of the HTTP request, such as Mime::XML.
#
# For backward compatibility, the post \format is extracted from the
@@ -43,13 +50,13 @@ module ActionDispatch
end
def formats
accept = @env['HTTP_ACCEPT']
@env["action_dispatch.request.formats"] ||=
if parameters[:format]
Array(Mime[parameters[:format]])
elsif xhr? || (accept && accept !~ /,\s*\*\/\*/)
elsif use_accept_header && valid_accept_header
accepts
elsif xhr?
[Mime::JS]
else
[Mime::HTML]
end
@@ -85,6 +92,18 @@ module ActionDispatch
order.include?(Mime::ALL) ? formats.first : nil
end
protected
BROWSER_LIKE_ACCEPTS = /,\s*\*\/\*|\*\/\*\s*,/
def valid_accept_header
xhr? || (accept && accept !~ BROWSER_LIKE_ACCEPTS)
end
def use_accept_header
!self.class.ignore_accept_header
end
end
end
end

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