Compare commits

..

896 Commits

Author SHA1 Message Date
Aman Gupta
daecedf14d drop tmail 2013-02-28 05:15:08 -08:00
Aman Gupta
76d83c0d5c use OutputBuffer#safe_append= for <%== to avoid extra string allocations 2013-02-26 01:07:29 -08:00
Aman Gupta
7335865bd9 avoid method call 2013-02-26 01:06:36 -08:00
Aman Gupta
e43316238d flush whitespace before statements to preserve line numbers 2013-02-25 22:13:11 -08:00
Aman Gupta
c3c6f25ec7 Merge pull request #3 from github/no-escape_once
XSS escaping
2013-02-24 21:47:24 -08:00
Aman Gupta
331461a65e optimize generated erb to reduce method calls
before:

        ');@output_buffer.append= ( content_icon row[:content] );@output_buffer.safe_concat('
');@output_buffer.safe_concat('        ');@output_buffer.append= ( spinner_img );@output_buffer.safe_concat('
');@output_buffer.safe_concat('      </td>
      <td class="content">
        ');@output_buffer.append= ( content_link row[:content] );@output_buffer.safe_concat('
');@output_buffer.safe_concat('      </td>
      <td class="message">
');

after:

        ';@output_buffer.append=( content_icon row[:content] );@output_buffer.safe_append='
        ';@output_buffer.append=( spinner_img );@output_buffer.safe_append='
      </td>
      <td class="content">
        ';@output_buffer.append=( content_link row[:content] );@output_buffer.safe_append='
      </td>
      <td class="message">
';
2013-02-22 02:56:17 -08:00
Aman Gupta
fd05501b4d ActionView::OutputBuffer and Erubis handler from rails 3.2 2013-02-21 06:03:01 -08:00
Aman Gupta
0fa76e01de ActiveSupport::SafeBuffer from upstream rails 3.2 2013-02-21 04:54:58 -08:00
Aman Gupta
1c215bab58 integrate monkey-patches from rails_xss/action_view 2013-02-21 03:20:01 -08:00
Aman Gupta
c7238a0746 faster html escaping code from rails master 2013-02-21 02:44:37 -08:00
Aman Gupta
71123b2913 fix boot on 1.9.3-p385
rails-2.3.14.github14/lib/initializer.rb:906:in `replace': can't modify frozen String (RuntimeError)
  from gems/rails-2.3.14.github14/lib/initializer.rb:906:in `set_root_path!'
  from gems/rails-2.3.14.github14/lib/initializer.rb:860:in `initialize'
  from gems/rails-2.3.14.github14/lib/initializer.rb:110:in `new'
  from gems/rails-2.3.14.github14/lib/initializer.rb:110:in `run'
  from github/config/environment.rb:22:in `<top (required)>'
2013-02-20 02:45:37 -08:00
Xavier Noria
2eede7e5ac s/escape_once/html_escape/, since html safety is the contract that now says whether something has to be escaped
Conflicts:
	actionpack/CHANGELOG
	actionpack/lib/action_view/helpers/form_tag_helper.rb
	actionpack/lib/action_view/helpers/url_helper.rb
	actionpack/test/template/url_helper_test.rb
2013-02-16 20:44:20 -08:00
Xavier Noria
507b8182cf url_for no longer escapes HTML, the :escape option is also gone
Rationale: url_for is just a path/URL generator, it is the responsability of the caller to escape conveniently HTML needs it, JavaScript needs different escaping, a text mail needs no escaping at all, etc.

Backported to 2.3. Conflicts:
	actionpack/CHANGELOG
	actionpack/lib/action_view/helpers/url_helper.rb
	actionpack/test/template/url_helper_test.rb
2013-02-16 20:32:13 -08:00
rizwanreza
3df96518be Allow content_tag options to take an array [#1741 state:resolved] [rizwanreza, Nick Quaranto]
Example:
  content_tag('p', "limelight", :class => ["song", "play"])
  # => <p class="song play">limelight</p>

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2013-02-16 20:22:41 -08:00
Aman Gupta
84420c7f12 short-circuit String#blank? when string is empty 2013-02-16 17:06:30 -08:00
Aman Gupta
c57e85fd13 Revert "ignore "invalid byte sequence in UTF-8" from String#=~"
This reverts commit 18e9b2ffc9.
2013-02-16 17:05:59 -08:00
Corey Donohoe
2eca011798 Merge pull request #2 from github/cve-2013-0277
apply patch for cve-2013-0277
2013-02-11 10:51:52 -08:00
Corey Donohoe
f6cf01337f apply patch for cve-2013-0277 2013-02-11 10:47:45 -08:00
Corey Donohoe
0ad86343c6 Merge pull request #1 from github/cve-2013-0333
Backport Patches for CVE-2013-0333
2013-01-28 16:33:32 -08:00
Corey Donohoe
42524c2bf1 backport patches for CVE-2013-0333
https://groups.google.com/forum/?fromgroups=#!topic/rubyonrails-security/1h2DR63ViGo
2013-01-28 13:23:53 -08:00
rick
46f1ddbff9 backport dynamic finder fix (CVE-2012-5664) 2013-01-02 15:02:25 -07:00
Aman Gupta
b18f5c9af1 bump mocha dependency 2012-12-08 20:35:13 -08:00
Aman Gupta
18e9b2ffc9 ignore "invalid byte sequence in UTF-8" from String#=~ 2012-11-15 04:33:45 -08:00
Aman Gupta
9ec3637bc5 backport String#encoding_aware? and String#blank? encoding fixes from rails3 2012-11-13 20:50:29 -08:00
Aman Gupta
ba9248e6e3 Remove call to Kernel#gem 2012-11-09 14:47:38 -08:00
Joshua Peek
a27559cddf Skip primary key check for HABTM inserts 2012-09-05 21:43:48 -05:00
Aman Gupta
e786726603 fix encoding errors inside ActiveSupport::BufferedLogger
http://developer.uservoice.com/blog/2012/03/04/how-to-upgrade-a-rails-2-3-app-to-ruby-1-9-3/
2012-08-17 18:14:52 -07:00
Aman Gupta
a1d2a22047 fix TZInfo on ruby 1.9
http://developer.uservoice.com/blog/2012/03/04/how-to-upgrade-a-rails-2-3-app-to-ruby-1-9-3/
2012-08-16 11:52:43 -07:00
Aman Gupta
d43ecd5b32 fix multiple queries when chaining named scopes
https://rails.lighthouseapp.com/projects/8994/tickets/5410-multiple-database-queries-when-chaining-named-scopes-with-rails-238-and-ruby-192
2012-08-15 17:35:23 -07:00
Aman Gupta
61359bf6ad Use String#encode to do transliteration on ruby 1.9 2012-08-15 11:30:20 -07:00
Aman Gupta
a2beda1177 force binary strings when logging sql statements 2012-08-14 12:52:51 -07:00
Aman Gupta
52c895d565 handle load errors on 1.9
https://github.com/rails/rails/pull/3745
http://groups.google.com/group/rubyonrails-core/browse_thread/thread/81be70a119260e59?pli=1
2012-08-14 12:52:31 -07:00
Aman Gupta
74f90612ec avoid iconv require warning on 1.9 2012-08-14 12:52:01 -07:00
Justin Collins
a6eb61b7e4 Fix SQL injection via nested hashes in conditions 2012-06-12 23:14:10 -07:00
Ryan Tomayko
fe11782158 Merge remote-tracking branch 'github/rack-1.x' into 2-3-github 2011-11-17 12:57:09 -08:00
Ryan Tomayko
899e99a025 pin to rack ~> 1.1 instead of ~> 1.1.0
Some pretty gnarly bugs and security issues are present in the
latest rack 1.1.x release. There are 1.2.x and 1.3.x releases that
correct these.

This changes the gem dependencies to allow for rack versions > 1.1.
At GitHub we're on 1.2.4 (latest 1.2.x release at present) and
should have some results from real world testing soon.
2011-11-17 12:51:32 -08:00
Aaron Patterson
e0774e4730 fixing utf8 escape vulerability 2011-08-16 14:58:39 -07:00
Aaron Patterson
60f783d9ce fixing strip tags vulnerability 2011-08-16 14:58:13 -07:00
Aaron Patterson
6b46d65597 fixing sql injection problem 2011-08-16 14:57:48 -07:00
Aaron Patterson
fb1588c5ff 2.3.14. yay. :'( 2011-08-16 14:57:05 -07:00
Aaron Patterson
dea5a10f71 bumping to 2.3.13 2011-08-16 14:34:14 -07:00
Aaron Patterson
11dafeaa75 fixing response splitting problem 2011-08-16 14:25:45 -07:00
Aaron Patterson
bb99aa1149 adding notification for rdoc 2011-08-16 14:24:44 -07:00
Aaron Patterson
b132992978 we should not ignore all gems in here 2011-08-04 16:34:20 -07:00
Xavier Noria
78a1fda7c8 contrib app minor tweak 2011-07-27 13:23:42 -07:00
José Valim
8d02083f23 Merge pull request #1740 from Antiarchitect/2-3-stable
Fix OrderedHash merging with block given.
2011-06-17 06:25:39 -07:00
Andrey Voronkov
b1c36b7088 Added tests for OrderedHash merging with block. 2011-06-16 23:56:39 -07:00
Andrey Voronkov
b2d4142fb7 Fix OrderedHash merging with block given. 2011-06-16 16:47:29 -07:00
Brian Cardarella
1aae5e70ef Remove deprecation warning for ActiveRecord::Errors#generate_message. This is the same API that ActiveModel ended up using and that won't be changing. 2011-06-09 14:59:33 -07:00
Aaron Patterson
a2a34133d8 find the spec from the source index, then activate it 2011-06-06 20:22:47 -07:00
Ryan Davis
79aa54d0c7 + Switched to newer rdoc and gem package tasks (and their requires).
+ Fixed deprecated usage in gemspecs.

Bumped the version to 2.3.12 so I could test locally with actual
installs. If this is bad form for this project, please beat me up and
I'll split them out.
2011-05-25 01:49:15 -07:00
Ryan Davis
3ad5fd1879 Removed the bulk of the deprecations by simply not calling refresh.
This may cause problems. I dunno.
The real solution is to get rid of all of this mess and use gem paths properly.
2011-05-12 16:02:41 -07:00
Ryan Davis
4c3725723f Fixed buggy gem activation. Don't pass a dependency to gem, pass the
name and requirement. Better, just activate the spec for the
dependency (1.8 only)
2011-05-12 16:01:56 -07:00
Ryan Davis
c20a4d18e3 Removed buggy GemDependency#requirement override. Overrides should NEVER change the semantics of the parent (returning nil if default). 2011-05-12 16:01:10 -07:00
Ryan Davis
01a9fbbcca Fix broken GemDependency#==. You should ALWAYS check the class! 2011-05-12 16:00:28 -07:00
Ryan Davis
8d4ca9edc6 Fix stupid emacsisms. Just makes things more readable. 2011-05-12 16:00:03 -07:00
José Valim
d793a56121 Merged pull request #198 from robdimarco/2-3-stable.
Patch for issue 6440 - Session Reset undefined method `destroy' for {}:Hash
2011-04-28 00:37:53 -07:00
José Valim
f424efe97f Merged pull request #331 from daphonz/2-3-stable.
Dynamic find_or_create_by_x_and_y always creates new records in Rails 2.3.11
2011-04-28 00:20:15 -07:00
Casey Dreier
9f7ff621bd Fixing dynamic finders on associations to properly send arguments to the find_by_* method. Closes issue #330.
Commit fdfc8e3b9 introduced a bugfix to prevent additional values passed
to a dynamic find_or_create_by_x methods from confusing the finder.
This patch also broke the essential behavior of this method on an
association by incorrectly sending arguments to the find_by_x methods.
The finder method would always see its inputs as a single array of
values instead of individual arguments, almost guaranteeing that the
finder call would be incorrect, and that we'd always create a new
record instead.

This patch adds a splat operator to the parameter array we send along to
the dynamic finder so that it receives its inputs correctly, and
includes an additional test to ensure that repeated calls to
find_or_create_by_x only creates one new record.
2011-04-27 21:57:24 -04:00
gmarik
b0be721dd9 respect :expire_after option
- it was broken after
[commit](e0eb8e9c65)
- there's also
[issue](https://rails.lighthouseapp.com/projects/8994/tickets/6634-railsrack-inconsistency-about-expires_afterexpires-cookie-option)

- also: maybe it worth making Rack understand :expire_after as we
duplicate same logic in [cookie_store](https://github.com/gmarik/rails/blob/v2.3.11/actionpack/lib/action_controller/session/cookie_store.rb#L114)

Signed-off-by: José Valim <jose.valim@gmail.com>
2011-04-14 13:48:35 +02:00
Rob Di Marco
8ca8ac379d Fixed bug 6440 by checking that destroy exists on the session 2011-02-28 22:54:03 -05:00
Rob Di Marco
589ce09564 Unit test that shows calling reset session twice results in an exception 2011-02-28 22:53:36 -05:00
Vijay Dev
6c42c142e2 fix incorrect version in deprecation message
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-20 13:32:18 -02:00
Aaron Patterson
abc06a2f76 rubygems 1.5.0 compatibility. Thanks Tim Serong 2011-02-09 15:24:14 -08:00
Michael Koziarski
b0c3d451a2 Prepare for the 2.3.11 release 2011-02-09 09:30:53 +13:00
Michael Koziarski
7e86f9b4d2 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-09 09:20:17 +13:00
Michael Koziarski
abe97736b8 Be sure to javascript_escape the email address to prevent apostrophes inadvertently causing javascript errors.
This fixes CVE-2011-0446
2011-02-09 09:20:16 +13:00
Aaron Patterson
7e0f60d2ed fixing invalid yaml [#4418 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2011-02-01 13:30:58 -08:00
Jamis Buck
3afa5385c9 Revert "make TestCaseTest work for pre-1.9 rubies, too"
This reverts commit 8378a44ff9.
2011-01-19 15:57:16 -07:00
Jamis Buck
c545331f9e Revert "scrub instance variables from test cases on teardown"
This reverts commit b5cf2b4b82.
2011-01-19 15:57:16 -07:00
Jamis Buck
cd0ecff00b Revert "rein in GC during tests by making them run (at most) once per second"
This reverts commit a0c761dc6b.
2011-01-19 15:57:14 -07:00
Jamis Buck
a0c761dc6b 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:27:53 -07:00
Jamis Buck
b5cf2b4b82 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:12:18 -07:00
Jamis Buck
8378a44ff9 make TestCaseTest work for pre-1.9 rubies, too 2011-01-19 10:08:02 -07:00
Johnathan Ritzi
4f0c8ef9f1 Fix doc for #check_box [#6311 state:resolved]
Signed-off-by: Xavier Noria <fxn@hashref.com>
2011-01-19 08:47:19 +01:00
Jeremy Kemper
bc302f2aec Revert "use Object#class instead of Object#type"
This reverts commit 08d94d3f7e.
2011-01-10 14:14:25 -08:00
Tomasz Pajor
08d94d3f7e use Object#class instead of Object#type 2011-01-09 15:12:25 -08:00
Mikel Lindsaar
10ec012f58 Updating documentation on ActionMailer base to show a multipart email with attachments 2011-01-02 11:13:44 +11:00
Mikel Lindsaar
92fd824480 Correcting actionmailer guide for Rails 2.3 2011-01-02 11:08:44 +11:00
Michael Koziarski
6d916329b8 Require thread explicitly rather than relying on rubygems to do it. 2010-12-20 11:16:55 +13:00
Michael Koziarski
84465a2cc1 Revert "In nested_attributes when association is not loaded and association record is saved then in memory record attributes should be saved"
This reverts commit 12bbc34aca.

It caused errors when combined with attr_accessible, piggy back attributes fetched by :select, etc.  Leaving it in 3.0, but removing from 2.3
2010-12-08 09:48:54 +13:00
Will Bryant
0fee359278 Don't add non-new records back to the target array after loading targets on associations, as that makes destroy_all destroy any created records that don't match the scope destroy_all is called on
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2010-12-08 09:48:16 +13:00
Pascal Friederich
e0eb8e9c65 Let Rack::Utils.set_cookie_header! create the Set-Cookie header instead of manually fiddling with the response headers [#4941 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-12-01 11:58:45 +01:00
José Valim
2826324e56 Revert "Fix AbstractStore so that it preserves Set-Cookie header as an array, rather than as newline separated strings"
This reverts commit 36b91e34f4.

Conflicts:

	actionpack/test/activerecord/active_record_store_test.rb
2010-12-01 11:48:31 +01:00
Alexandru Catighera
1681ede605 Fix ActiveRecord calculations when grouped by multiple fields 2010-11-16 11:06:49 -08:00
Tom Stuart
44db47c63e Backport BlankSlate removal from ActiveSupport::BasicObject [#5911 state:resolved]
This is a backport of dd15a3fee0.

Signed-off-by: Andrew White <andyw@pixeltrix.co.uk>
2010-11-03 11:03:38 +00:00
Andrew White
25139ac92c Don't write out secure cookies unless the request is secure 2010-10-27 15:04:29 +01:00
Andrew White
0e52a609fd Don't create a deprecation proxy object if the variable was passed in local_assigns [#1671 state:resolved] 2010-10-26 12:57:21 +01:00
Aaron Patterson
df78de2bc8 removing space errors 2010-10-21 10:30:18 -07:00
Omar Qureshi
36b91e34f4 Fix AbstractStore so that it preserves Set-Cookie header as an array, rather than as newline separated strings 2010-10-21 10:28:54 -07:00
toby cabot
bdfddb09d7 bug 1108: yield to block provided to find_or_create_by_x
Starting in 2.3.8 we stopped yielding to blocks passed in to
find_or_create_by_x methods.  This patch restores that behavior and
adds a case to test it.
2010-10-20 17:23:54 -07:00
toby cabot
fdfc8e3b9c bug 1108: fix a bug with find_or_create_by and additional values
There was a bug with find_or_create_by_x introduced in 2.3.9 - if you
included extra parameters for the create() then those parameters would
confuse the find() so you'd never get to the create().  This patch
filters the parameters so we only pass to find() the subset that it's
interested in.  The code for the filtering was modelled on the code in
base.rb's method_missing().
2010-10-20 17:23:54 -07:00
Michael Koziarski
f5ed5c317e Prepare for the 2.3.10 release 2010-10-15 08:41:59 +13:00
Michael Koziarski
96183e0f28 Revert 7d2173ec5c which introduced a security vulnerability.
This addresses  CVE-2010-3933
2010-10-15 08:30:34 +13:00
Geoff Buesing
f2e32e4fd7 require 'uri' in action_controller/url_rewriter [#5555 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-10-12 00:58:29 +02:00
Aaron Patterson
8beb84fa33 calling correct method on minitest for test name when teardown callback fails 2010-10-04 09:29:37 -07:00
Aaron Patterson
a448e74661 [#5406 state:resolved] calling the correct method on minitest to obtain the test name 2010-10-04 09:28:21 -07:00
Aaron Patterson
fb526a0470 fixing space errors 2010-09-30 10:29:46 -07:00
Marcelo Giorgi
96c19ff7cc AssociationCollection#include? working properly for objects added with build method [#3472 state:resolved] 2010-09-30 10:28:25 -07:00
Marcelo Giorgi
9b78af95be Remove duplication of conditions generated for associations when used in conjunction with named_scopes [#4634 state: resolved] 2010-09-30 09:04:04 -07:00
Emilio Tagua
5a63df211d Add examples to performance script that were included in version 3. 2010-09-30 09:54:01 -03:00
Emilio Tagua
1851596db5 Use detect instead select to avoid sh [..] command not found. 2010-09-30 09:52:47 -03:00
Marcelo Giorgi
0665182950 Preserving :include options for hmt association with an order but without conditions [#5262 state:resolved] 2010-09-28 09:56:10 -07:00
Ryan Wallace
515917f5d8 Add test to demonstrate failure with eager loading hmt where the association has an order. 2010-09-28 09:54:32 -07:00
Étienne Barrié
bc52d81306 Fix add_index with a symbol #4891 2010-09-27 10:26:01 -07:00
Michael Koziarski
dbbf2fd19c Revert "Makes form_helper use overriden model accessors backport"
This change introduced breakages and test failures.

This reverts commit 8141f0894e.
2010-09-27 12:20:54 +13:00
Andrew Kaspick
9476d628a3 memoized protected methods should remain protected
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2010-09-27 11:50:54 +13:00
Colin Casey
7240e8af6a Fix for imposed version number as last part of gem directory name for frozen gems
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-24 13:16:51 +02:00
Colin Casey
f2990620d7 Test for imposed version number as last part of gem directory name for frozen gems
[#4295 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-24 13:16:50 +02:00
W. Andrew Loe III
17f2fb44c0 Only send secure cookies over SSL. 2010-09-14 11:52:40 -07:00
Emilio Tagua
8c049c6b20 Add more examples in performance script.
[#5610 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-09-10 13:15:46 -07:00
Jeremy Kemper
761c9cd5db Ruby 1.9 compat: convert Pathname to string 2010-09-10 12:23:41 -07:00
Andrew Kaspick
a159fd0b8c Fix fixtures in integration test sessions
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2010-09-10 10:45:23 +12:00
Erik Michaels-Ober
e8b84ab1b4 Add support for mysql2 adapter 2010-09-10 02:13:56 +08:00
Erik Michaels-Ober
383ea02e38 Fix typo in deprecation warning
Object#returning should be Kernel#returning
2010-09-10 02:13:56 +08:00
Mikel Lindsaar
597fb1da94 Adding documentation to redirect_to and status code option references 2010-09-09 14:00:09 +10:00
Mislav Marohnić
c6e33d30c1 fix setting session cookie with activerecord and memcache store
Commit f8f3653 broke setting the session ID cookie for requests without 'HTTP_COOKIE' header
when using activerecord or memcache store. Integration tests didn't catch this because they
always set the HTTP_COOKIE header for mock requests, so now this is changed to only set the
header if there are cookies.

[#5581 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-08 12:59:48 -03:00
Jeremy Kemper
a61a39ecd4 Rails 2.3.9 2010-09-04 14:36:40 -07:00
Ken Collins
b64d1fe637 Conversion of a two dimensional array that is ruby 1.8.6 safe. Fix paren warnings too.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2010-09-03 14:38:28 +12:00
Jeremy Kemper
6f17422ca7 require 'thread' for Mutex dependency 2010-08-31 16:38:52 -07:00
Mikel Lindsaar
bac12fa5fc Adding option to ActiveResource to allow you to not reset the previously stored requests and responses by passing false to respond_to
Backport of commit 2a1b23f851ea3d4634fc68b74fe6b1afed23d3ef on rails/master
2010-08-29 22:55:02 -07:00
Mikel Lindsaar
56fdfeb265 Back porting HttpMock test from Rails 3 master 2010-08-29 22:55:02 -07:00
Mikel Lindsaar
881712cf50 Updating documentation on ActiveResource HTTP Mock and also adding test coverage 2010-08-29 22:55:02 -07:00
Jeremy Kemper
b2c91983dc Prepare for Rails 2.3.9. Release 2.3.9.pre gems. 2010-08-29 20:19:05 -07:00
Jeremy Kemper
bdace5d6aa Exclude guides from gem to keep file size small 2010-08-29 17:54:13 -07:00
Mikel Lindsaar
0fcb4302e1 Make ActiveResource::InvalidRequestError more user friendly
Signed-off-by: Xavier Noria <fxn@hashref.com>
2010-08-25 10:11:06 +02:00
Xavier Noria
11361a9e79 restores railties/README as home page of the API 2010-08-20 04:19:34 +02:00
Xavier Noria
add3ccbca6 revises guides generation 2010-08-20 04:13:15 +02:00
Jeff Lawson
d35a67bba3 Bug Fix -- clean up connection after stored procedure [#3151 state:resolved] for 2-3-stable 2010-08-18 08:33:47 -07:00
Jeff Lawson
7e79889d1c Bug Fix -- clean up connection after stored procedure [#3151 state:resolved] for 2-3-stable 2010-08-18 08:33:47 -07:00
Santiago Pastorino
43e2bbe28e Making time_zone_options_for_select return a html_safe string master backport 2010-08-15 10:07:38 -03:00
Michael Koziarski
b154b97ea4 Revert "Ruby 1.9.2: explicitly raise NoMethodError for attempts at explicit coercion"
This reverts commit 64082b350c.

This change broke compatibility with 1.8.6 and was only needed for older 1.9.2 versions

Conflicts:

	activerecord/lib/active_record/attribute_methods.rb
2010-08-11 10:53:06 +12:00
Xavier Noria
15cafbe267 it is no longer true that load_paths are going to be removed in final 2010-08-05 00:04:43 +02:00
Subba Rao Pasupuleti
12bbc34aca In nested_attributes when association is not loaded and association record is saved then in memory record attributes should be saved
[#5053 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-03 10:56:51 +02:00
Santiago Pastorino
8141f0894e Makes form_helper use overriden model accessors backport
[#3374]
2010-08-01 19:49:45 -03:00
Leigh Caplan
27651c1fad Test to ensure that falsy objects aren't wrapped by deprecation proxies 2010-07-26 09:54:26 -07:00
Leigh Caplan
a9ef2fd56c Override new on proxy objects so that they never wrap nil or false. 2010-07-26 09:54:26 -07:00
Santiago Pastorino
ae63d5c90d Changes Object#returning with Object#tap on guides 2010-07-25 17:10:37 -07:00
Santiago Pastorino
6f3896751a Changelog update for Object#responding deprecation
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-25 23:08:50 +02:00
Santiago Pastorino
5b0f839054 Deprecates Object#returning in favor of Object#tap
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-25 22:49:10 +02:00
Santiago Pastorino
a5d8c95a7c Changes the usage of Object#returning with Object#tap
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-25 22:49:06 +02:00
Subba Rao Pasupuleti
dec2c4f4e3 renaming test name to fix accidently override [#5076 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-18 11:20:25 +02:00
Neeraj Singh
99cdea7cbe update_attribute and updated_attributes! are now wrapped in a transaction
[#922 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-18 11:20:25 +02:00
Aaron Patterson
c2d13a9a53 changing fixtures back to superclass_delegating_accessor until we can convert them to class_attributes 2010-07-17 18:57:24 -07:00
Jon Yurek
fb615cd7fd Fix for integration tests not serializing arrays in multipart forms correctly.
Signed-off-by: wycats <wycats@gmail.com>
2010-07-17 13:01:50 -05:00
Aaron Patterson
4ae4828953 backporting a couple missing files. sorry folks! 2010-07-16 08:41:53 -07:00
Michael Koziarski
f57ca87729 Only skip eager loading the code if dependency_loading is still enabled.
Otherwise rake tasks which depend on environment will get errors about missing constants.
2010-07-16 17:06:32 +12:00
Aaron Patterson
7b6383f263 fixing performance regression from 2.3.5 -> 2.3.8 2010-07-15 15:59:19 -07:00
Michael Lovitt
257a29d3cc Sessions should not be created until written to and session data should be destroyed on reset. [#4938 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-14 08:04:37 +02:00
Jacob Lewallen
8298bef72e Set destroyed=true in opt locking's destroy [#5058 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-14 08:03:02 +02:00
Mike Breen
046c900df2 A generated plugin's test are not run by 'rake test'
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-08 23:08:22 +02:00
Ken Collins
504f7cfbb3 Fix the #using_limitable_reflections? helper to work correctly by not examining the length of an array which contains false/true, hence always passing.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-08 23:08:11 +02:00
Grant Ammons
0963774c0a fixes #2362, eager loading :through associations will join the :source model if there are :conditions
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-08 23:08:05 +02:00
Mislav Marohnić
2d3bc99b0d test that ActiveRecord destroy and destroy_all return destroyed records
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-07-08 11:35:56 -07:00
Mislav Marohnić
ba9c469113 add missing require to ActiveRecord "base_test.rb"
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-07-08 11:35:46 -07:00
José Valim
bfbdeeae30 Use bind instead of instance_exec cause it may be causing memory leaks. Also, provide a simpler and sane implementation for scoped. [#5044 state:resolved] 2010-07-04 16:19:40 +02:00
Aaron Patterson
67e18c523c fisting Session::AbstractStore#clear to actually clear the session. [#5030 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-07-01 14:47:28 -07:00
James Le Cuirot
526f1e5f15 Don't remove scheduled destroys when loading an association.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-01 01:07:24 +02:00
Jan Berkel
f8f4872fcc Backported patch from [#4762]
URL fragments should not have safe characters escaped. Ref: Appendix A,
  http://tools.ietf.org/rfc/rfc3986.txt

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-30 13:27:28 +02:00
Aaron Patterson
fad166c152 AssociationCollection#create_by_*, find_or_create_by_* work properly now. [#1108 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-06-29 16:33:12 -07:00
Leigh Caplan
78e4d88c70 Rewrite the clause to pluck the existing value from zones_map before performing a lookup. [#4942 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-29 17:54:18 +02:00
David Trasbo
ac42e6951f Deprecate ActiveRecord::Base#class_name [#379 state:committed]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-29 17:54:05 +02:00
David Trasbo
d0d10f51d7 Only tell users that the Rails gem is missing if it's actually the case [#2901 state:committed]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-29 17:53:57 +02:00
Prem Sichanugrist
69c4e4ce65 Fix [54a5088cd5] where the i18n gem was wrongly updated to 0.4.1.
I've tested and confirm that `2-3-stable` will use the vendored `i18n` gem if there's no `i18n` gem with version >= 0.4.1 installed

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-29 17:53:48 +02:00
Leigh Caplan
80473e035a test that unknown zones don't store mapping keys
[#4942]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-28 22:20:34 +02:00
Santiago Pastorino
70af7efa16 Don't store incorrect values in zones_map backport
[#4942 state:committed]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-28 22:20:34 +02:00
Evgeniy Dolzhenko
56b35afbdd Add module_eval missing file_name and line_number args
[#4712 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-27 08:49:54 +02:00
José Valim
0e9190c902 Tidy up tests in previous commit since they did not assure an OrderedHash is returned (the test would pass for an array and would pass by chance for hashes).
[#4875 state:resolved]
2010-06-26 18:16:09 +02:00
chaitanyav
449cf50d85 Add OrderedHash#invert to preserve order in ruby 1.8
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-26 18:13:45 +02:00
Paul Mucur
05defcd63a Alias ActiveSupport::OrderedHash#update to ActiveSupport::OrderedHash.merge!
This ensures that an OrderedHash's keys are set up appropriately when using update.

[#4973 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-06-25 15:18:39 -07:00
Prem Sichanugrist
f8f365346e Make sure that Rails doesn't resent session_id cookie over and over again if it's already there [#2485 state:resolved]
This apply to only Active Record store and Memcached store, as they both store only the session_id, which will be unchanged, in the cookie.

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-25 09:47:56 +02:00
Xavier Noria
4a745ca670 deprecates load_(once_)paths in dependencies and app config in favor of autolaod_(once_)paths 2010-06-24 00:00:45 +02:00
José Valim
68bfd8a392 Use size for Ruby 1.8.6 compatibility. 2010-06-23 17:53:02 +02:00
Neeraj Singh
549b2ad77c fixes to the tests for patch #4909
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-23 17:34:45 +02:00
kane
09a23d2290 quote scoped columns in validates_uniqueness_of [#4909 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-23 17:34:40 +02:00
George Montana Harkin
7d2173ec5c Fixes #2415 by creating a new instance of the Model when saving attributes to that model and the associated attributes already exist. Tests included. [#2415 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-23 17:31:22 +02:00
Neeraj Singh
cc53229378 Fragment cache not generating the proper cache key in log
[#4827 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-23 09:11:48 +02:00
Maxim Chernyak
844da12ba6 Fix eager loading of polymorphic has_one associations nested-included under polymorphic belongs_to associations. [#3233 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-23 09:09:46 +02:00
Neeraj Singh
a9c69f3bb0 test for #1570
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-23 09:08:55 +02:00
Paweł Kondzior
687d7f52c4 STI should identify itself inside named_scope
[#1570 state:resovled]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-23 09:07:46 +02:00
Michael Koziarski
cbf36cf57c Revert "make text_field and hidden_field omit the value attribute if the developer explicitly passes in :value => nil [#4839 state:reopened]"
This reverts commit 52c922fad1
2010-06-23 16:54:05 +12:00
Michael Koziarski
52c922fad1 make text_field and hidden_field omit the value attribute if the developer explicitly passes in :value => nil [#4839 state:resolved]
Signed-off-by: Michael Koziarski <michael@koziarski.com>

Conflicts:

	actionpack/lib/action_view/helpers/form_helper.rb
2010-06-23 16:25:19 +12:00
Jeff Dean
da93d69bcb remove_column should raise an ArgumentError when no columns are passed [#4803 state:resolved]
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2010-06-23 16:23:03 +12:00
Jeremy Kemper
e703fc101b CI: add i18n gem 2010-06-22 14:11:14 -07:00
Jesse Storimer
85b6d79d8a CookieStore should preserve the Set-Cookie header Array [#4743 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-06-22 11:25:32 -07:00
Prem Sichanugrist
5ed6a8447b Change all i18n interpolations from {{...}} to %{...}
This will silent all warning if there's a i18n version 0.4.x gem install on user's machine.

[#4913 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-21 01:14:36 +02:00
Prem Sichanugrist
54a5088cd5 Update bundled i18n gem to 0.4.1 to make sure every project will be warn about using deprecated %{..} interpolation.
This will also make sure that by changing {{..}} into %{..} won't break any Rails 2.3.x application, since it would load the vendored version if it's not satisfy the version requirement.

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-21 01:13:37 +02:00
James Le Cuirot
08302d2feb When not overwriting unsaved updates in nested attributes, allow already-saved records to be refreshed.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-20 00:33:39 +02:00
Maxime RETY
c7e875abdb Fix Yajl backend discovery in ActiveSupport::JSON
[#4897]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-06-18 20:12:16 -07:00
Master Lambaster
1ac00a6844 Fix test which prevents connection reset on failing and remove hardcoded connection
[#4689 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-06-18 15:28:56 -07:00
Pratik Naik
e4accdec0c Fix AR perf script 2010-06-10 00:00:17 +05:30
James Le Cuirot
b41c3ba154 Don't overwrite unsaved updates when loading an association but preserve the order of the loaded records. [#4642 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2010-06-09 18:20:15 +05:30
Prem Sichanugrist
0f44d37d04 Make sure that rails recognized the full notation of IPv6 loopback address, and recognize 127.0.0.0/8 in IPv4
[#3257 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-08 19:47:18 +02:00
Xavier Noria
ed8cabcec2 deprecates Array#random_element in favor of Array#sample, backported from Ruby 1.9, thanks to Marc-Andre Lafortune 2010-06-05 02:11:33 +02:00
Andrew
3d6ed50187 Don't rewrap system level exceptions with StatementInvalid
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#896 state:committed]
2010-05-29 16:00:54 +12:00
Michael Koziarski
b760d699a8 Merge commit 'mislav/counter_cache_2-3-stable' into 2-3-stable 2010-05-29 14:05:31 +12:00
Michael Koziarski
5796a92433 Merge commit 'mislav/auto_link_2-3-stable' into 2-3-stable 2010-05-29 14:05:21 +12:00
Santiago Pastorino
b1a97a4998 removes an unneeded alias
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-26 16:10:31 +02:00
Jeremy Kemper
a815f0c5a3 Shift SafeBuffer#concat responsibility over to rails_xss 2010-05-25 14:27:40 -07:00
Jeremy Kemper
9da7ff8842 Bump 2-3-stable to 2.3.9 2010-05-25 09:50:34 -07:00
Xavier Noria
2ed893bdce get railties/README back to the home page of the API 2010-05-25 17:18:50 +02:00
Santiago Pastorino
240f4e944c SQLite: forward compatibility with future driver releases
[#4633]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-24 20:53:26 -07:00
Jeremy Kemper
f7e27bd078 i18n: t() handles single keys returning an Array, also 2010-05-24 20:41:28 -07:00
Jeremy Kemper
6a9e188c0c HTML safety: fix textarea with nil content 2010-05-24 20:13:07 -07:00
Jeremy Kemper
aa449141b4 Work around strange Ruby 1.9 autoload issue by using absolute load paths for tests (for Active Model too) 2010-05-24 16:18:29 -07:00
Santiago Pastorino
a9032c885f Error messages for asserts
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-24 16:05:39 -07:00
Jeremy Kemper
e8ba5265e0 Work around strange Ruby 1.9 autoload issue by using absolute load paths for tests (ditto for other components' tests) 2010-05-24 16:05:34 -07:00
José Valim
50f3754525 Ensure translations work with symbols. 2010-05-24 23:38:49 +02:00
Santiago Pastorino
4986d5ed04 translate helper method using an array is deprecated
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-24 23:38:48 +02:00
Jeremy Kemper
4fef5af9c3 2.3.7.pre1: fixes HTML escaping when *not* using rails_xss 2010-05-24 14:02:38 -07:00
Jeremy Kemper
e5af56abfe Add global gem task 2010-05-24 13:48:13 -07:00
Jeremy Kemper
9d3bd87045 Work around strange Ruby 1.9 autoload issue by using absolute load paths for tests 2010-05-24 12:16:33 -07:00
Santiago Pastorino
6b0616d1b8 translation method of TranslationHelper module returns a SafeBuffer Array backport
[#4675 state:committed]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-24 20:56:44 +02:00
Santiago Pastorino
d3da1a2c66 Revert "translation method of TranslationHelper module returns always SafeBuffer [#4194 status:resolved]"
This reverts commit 2310aef29b.

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-24 20:56:44 +02:00
wycats
8e6a044b2b Needs to work on 1.8 too 2010-05-24 11:29:12 -07:00
wycats
50b7c0c104 Give the ERB String the encoding of the original template 2010-05-24 11:18:20 -07:00
Jeremy Kemper
c66013e2c5 Fix that captured content (e.g. with form_for or div_for) would be HTML-escaped even without the rails_xss plugin installed. Rails 2.3.7, we barely knew ya... 2010-05-24 09:12:00 -07:00
Lance Ivy
9e08e196fa Ensure auto_link does not ignore multiple trailing punctuations
[#2504 state:resolved]
2010-05-24 11:47:36 +02:00
Mislav Marohnić
17b4fd25e4 avoid auto_linking already linked emails; more robust detection of linked URLs
References #1523  [#1862 state:resolved]  [#3591 state:resolved]

Add test that shows how link text can contain HTML if needed:
the trick is using block form in combination with `raw`.
Let link text be automatically HTML-escaped

[#2017 state:resolved]
2010-05-24 11:18:20 +02:00
Mislav Marohnić
bd9ca9aed0 auto_link: support arbitrary URI schemes like "ftp:" and "file:"
recognizes all URI scheme allowed characters, such as colon and period.

[#3494 state:resolved]
2010-05-24 11:18:20 +02:00
Jeremy Kemper
f97da34b4f Bump 2-3-stable to 2.3.8 2010-05-24 01:39:19 -07:00
Jeremy Kemper
326188c25e 2.3.7 release: fix rails_xss compatibility 2010-05-24 00:04:41 -07:00
Jeremy Kemper
60e82a3ca2 Move tests for deprecated String#html_safe! to plugin 2010-05-23 22:07:47 -07:00
Jeremy Kemper
3ff921a65a rails_xss handles deprecated String html safety, when installed 2010-05-23 21:30:43 -07:00
Santiago Pastorino
b10bf834b7 Make use of safe_concat on TextHelper concat
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-23 16:51:52 -07:00
Jeremy Kemper
86f0287993 Revert "Don't always mark the argument to #concat as HTML-safe."
This reverts commit e53791f8c0.
2010-05-23 16:51:47 -07:00
Jeremy Kemper
ab2d7c8b5d Use a non-XSS-protected output buffer for view tests 2010-05-23 16:21:44 -07:00
Jeremy Kemper
ca5f5d97b9 Fix test rendering unmarked but safe HTML 2010-05-23 15:28:40 -07:00
Nathan Weizenbaum
e3f14d12cd Don't incompatibly monkeypatch ERB.
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-23 15:02:24 -07:00
Nathan Weizenbaum
e53791f8c0 Don't always mark the argument to #concat as HTML-safe.
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-23 15:00:14 -07:00
Nathan Weizenbaum
48fbe7b0d8 Mark all raw HTML being concatted as HTML-safe.
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-23 14:57:45 -07:00
Jeremy Kemper
55e88eeee4 Bump 2-3-stable to 2.3.7 2010-05-23 01:39:45 -07:00
Jeremy Kemper
56bb5504dd 2.3.6 release 2010-05-22 23:53:40 -07:00
Jeremy Kemper
d8f0a58dcb Remove miscommit from 57337cd 2010-05-22 23:46:03 -07:00
Aaron Patterson
a637b5f447 backporting beda2d43 for newer sqlite-ruby bindings
Signed-off-by: Xavier Noria <fxn@hashref.com>
2010-05-22 20:52:15 +02:00
Xavier Noria
25ec61330b 1.9 compat: deprecated last_(month|year) in favor of prev_(month|year) 2010-05-19 00:59:02 +02:00
Jeremy Kemper
9d99e610be Revert "Don't carry default value when changing column for a binary type on MySQL"
Broke mysql tests.

This reverts commit ddadcc7cf8.

Conflicts:

	activerecord/test/cases/migration_test.rb

[#3234 state:open]
2010-05-18 11:03:59 -07:00
Étienne Barrié
99bcce7ec1 make add_index and remove_index more resilient; new rename_index method; track database limits
[#3452 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-18 10:51:36 -07:00
Ian White
a5696e36c6 Nested records (re: autosave) are now updated even when the intermediate parent record is unchanged [#4242]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-18 16:10:44 +02:00
José Valim
94878c61a3 Deprecate legacy CGI options in SessionStores. 2010-05-18 03:25:57 +02:00
Xavier Noria
bb2327d9ab method rename to fix a broken test 2010-05-18 00:31:41 +02:00
Rizwan Reza
32b0b5f7b2 Deprecate Array#rand in favor of Array#random_element [#4555 stated:committed]
Signed-off-by: Xavier Noria <fxn@hashref.com>
2010-05-17 23:56:44 +02:00
José Valim
76608b13d2 superclass_delegating_accessor does not accept options. 2010-05-17 12:37:42 +02:00
Jeremy Kemper
cd3d30d569 CI: bump rack to 1.1 2010-05-16 13:35:42 -07:00
Rizwan Reza
74206aeff2 Rack dependency bumped to 1.1.0, tests passing. [#3558 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-16 22:19:25 +02:00
Wijnand Wiersma
5b1f4c51ce Postgresql doesn't allow to change a string type column to a binary type. Skip this test for postgresql for now.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-16 15:15:16 +02:00
Jeff Kreeftmeijer
ec017e158a Added assert_attribute_type to clean up GeneratedAttributeTest [#2377 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-16 12:08:55 +02:00
Matthew Rudy Jacobs
5d979de1a9 when we run rake rails:freeze:edge update the value of the "REVISION" file rather than creating a new file "REVISION_ce706..." each time [#1694 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-16 10:42:48 +02:00
Nobuhiro IMAI
e535b45c86 make fixture accessors private
prevent to be run fixture accessor (e.g. test_foos for TestFoo model) as a test case

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-16 10:35:23 +02:00
Neeraj Singh
3570f3e7f6 Fix broken integration test in 2.x [#4565 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-16 10:32:53 +02:00
Jeff Kreeftmeijer
3568c5cee0 using :time_select when the attribute type is :time in the scaffold generator. [#2377 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-16 10:32:15 +02:00
Elomar França
ddadcc7cf8 Don't carry default value when changing column for a binary type on MySQL [#3234 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-16 10:30:47 +02:00
Lawrence Pit
0706bdce60 docs + test for each_error
[#3185 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-15 11:49:04 -07:00
Jeff Kreeftmeijer
5d7ad7ba41 make sure as is set before trying to build an #{as}_counter. [#2804 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-15 11:18:31 -07:00
Neeraj Singh
22b020db3e db:drop:all throws error when database does not exist [#2997 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-15 10:33:52 -07:00
Jeff Kreeftmeijer
2de364636c partial counters with :as [#2804 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-15 10:32:45 -07:00
Josh Kalderimis
8e7a64d090 backported AR correction to find_each and find_in_batches to raise when the user uses select but does not specify the primary key
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-15 09:51:58 +02:00
José Valim
6949d6f54f Remove deprecated tests according to 8e679f1 2010-05-14 23:43:21 +02:00
Santiago Pastorino
c4ef7bb2a0 to_json and to_xml tests added to ActiveResource
[#4529 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-12 13:40:09 -07:00
Pratik Naik
7cbc546d39 Use superclass_delegating_accessor for connection handlers 2010-05-12 17:43:02 +01:00
Jeremy Kemper
9ab1154523 Drop require removed by 8e679f1 2010-05-11 22:39:53 -07:00
Santiago Pastorino
ad73a3aec4 type_cast_calculated_value refactor: value is never a Fixnum here. Fix test since SQLite returns Float.
[#4514 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-11 22:28:36 -07:00
José Valim
8e679f1854 Remove i18n interpolation deprecation. It has been around since 2.2. 2010-05-11 22:13:03 +02:00
Pratik Naik
3c1bb40b6b Make sure schema dumper doesnt throw up when there are no index lengths 2010-05-09 12:42:15 +01:00
Pratik Naik
77adb4bc20 Revert "Revert "Add index length support for MySQL [#1852 state:resolved]" (breaks the build)"
This reverts commit eababa35cf.
2010-05-09 12:34:07 +01:00
Carl Lerche
eababa35cf Revert "Add index length support for MySQL [#1852 state:resolved]" (breaks the build)
This reverts commit 3616141fa2.
2010-05-08 23:56:06 +03:00
Santiago Pastorino
555801c908 The intention here was to assign to different objects ht: Radar 2010-05-08 23:34:07 +03:00
Emili Parreno
3616141fa2 Add index length support for MySQL [#1852 state:resolved]
Example:

  add_index(:accounts, :name, :name => 'by_name', :length => 10)
  => CREATE INDEX by_name ON accounts(name(10))

  add_index(:accounts, [:name, :surname], :name => 'by_name_surname', :length => {:name => 10, :surname => 15})
  => CREATE INDEX by_name_surname ON accounts(name(10), surname(15))

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2010-05-08 12:43:34 +01:00
Santiago Pastorino
f967b352d2 Make find_or_create and find_or_initialize work mixing explicit parameters and a hash. ht: Marc-André Lafortune
[#4457 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-07 13:29:51 -07:00
Santiago Pastorino
adcfb4e8bd simple_format should return html_safe but not escape text, that's for rails_xss plugin [#3767 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-07 11:56:53 -07:00
Brian Lopez
6d1344de5e add support for mysql2 adapter to dbconsole
[#4532 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-04 15:47:12 -07:00
Pratik Naik
f194d65f36 Use primary key in conditions, not 'id' [#4395 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>

Conflicts:

	activerecord/test/cases/nested_attributes_test.rb
2010-05-04 22:45:16 +01:00
Jatinder Singh
aeff1719ab AR JSON Serializer now supports custom root option.
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-04 13:18:27 -07:00
Brian Lopez
6dbc75fd76 Allow pre-casted values (other than nil) to pass through from calculations un-touched
[#4514 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-04 12:27:24 -07:00
Pratik Naik
04fa5af6a6 Use class_inheritable_accessor for connection_handler 2010-05-04 17:52:53 +01:00
Marius Nuennerich
0d767fd24f repair the activesupport message encryptor tests for me, do so in the same way as jeremy did with message verifier
[#4517 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-01 10:08:05 -07:00
Neeraj Singh
dcf0f97514 making rake:migrate VERSION=0 a noop called in succession. [#2137 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-04-29 13:32:12 +02:00
Curtis Hawthorne
ce5af2fefe Destroy respects optimistic locking.
Now works with :dependent => :destroy and includes unit tests for that
case.  Also includes better error messages when updating/deleting stale
objects.

[#1966 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-27 21:52:22 -07:00
Joe Martinez
aa401bd75a Add ActiveResource::Base.include_root_in_json, like Active Record, to serialize instances as hash of model name -> attributes hash rather than the bare attributes hash. [#2584 state:committed]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-26 15:19:03 -07:00
Jeremy Kemper
9e262de3d8 Fix backport error: wrong exception name 2010-04-24 19:38:10 -07:00
Jeremy Kemper
8716ee44e5 Fix unstated AS::Multibyte dependency 2010-04-24 17:52:12 -07:00
Cezary Baginski
ec7716abcd actionpack: added missing encoding comments [#4466 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-24 17:30:59 -07:00
Jeremy Kemper
f6e71c674c Expect an incompatible encoding exception when a template with a magic comment renders a partial without one and its source encoding doesn't match the default external encoding 2010-04-24 17:12:05 -07:00
Jeremy Kemper
fb545f4c60 Expect an incompatible encoding exception when a template doesn't have a magic comment and its source encoding doesn't match the default external encoding 2010-04-24 17:12:00 -07:00
Akira Matsuda
4082001331 Fix pattern to match various magic comment formats 2010-04-24 17:05:38 -07:00
Jeremy Kemper
70034d820f Ensure ERB source begins with the encoding comment 2010-04-24 17:04:50 -07:00
Jeremy Kemper
81e06075b7 Ruby 1.9: ERB template encoding using a magic comment at the top of the file 2010-04-24 17:01:52 -07:00
Jeremy Kemper
457a54653d Remove quoted_string_prefix entirely since PostgreSQL was the only database adapter relying on it. 2010-04-24 16:27:34 -07:00
Jeremy Kemper
5c0ad82236 PostgreSQL: remove the unnecessary heuristic checking whether the value is escaped 2010-04-24 15:52:51 -07:00
Jeremy Kemper
c9e15709ae PostgreSQL: use standard-conforming strings if possible 2010-04-24 15:36:31 -07:00
Eugene Pimenov
cec44f5838 PostgreSQL adapter: escape_bytea, quote_string and unescape_bytea aren't thread-safe in Ruby 1.8 [#3237 state:resolved]
Signed-off-by: wycats <wycats@gmail.com>
2010-04-24 13:12:14 -07:00
Sam Elliott and Santiago Pastorino
c401102a27 Is not nessesary to have @_rails_html_safe instance var when the string is unsafe, also it breaks to_yaml [#3535 state:committed] 2010-04-23 09:35:18 +12:00
Santiago Pastorino
d891754535 load tzinfo on initialize only
Signed-off-by: Xavier Noria <fxn@hashref.com>
2010-04-21 09:24:46 -07:00
Santiago Pastorino
49943a7120 TimeZones lazy load
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-20 21:40:49 -07:00
Jeremy Kemper
2401af4d6f MemoryStore#read_multi(*keys) for dev-mode compatibility with memcache store 2010-04-19 00:18:20 -07:00
Jeremy Kemper
fd5c6e2c97 Upgrade bundled i18n from 1.3.3 to 1.3.7 2010-04-17 12:38:16 -07:00
Jeremy Kemper
8b79c7c202 Fix 1.9-specific syntax error in test 2010-04-17 12:37:56 -07:00
Mislav Marohnić
4b36dafb35 String#starts/ends_with? should return false for non-string argument, not raise error
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-17 00:07:26 -07:00
Mislav Marohnić
8be3e09fcf fix reset_counters to work even with complex class names
e.g. it guesses that a belongs_to association to Namespace::MyModel is
named "my_model", unlike before where it would look up an association
named "namespace::mymodel" and fail.
2010-04-17 03:13:13 +02:00
Mislav Marohnić
ef0591efc2 cleanup update/reset_counters; refactor tests 2010-04-17 03:13:00 +02:00
Jeremy Kemper
c55cdd816c Distinguish test for 1.8.6 compat 2010-04-16 11:35:33 -07:00
Mislav Marohnić
c519215aa8 ruby 1.8.7 compat: starts/ends_with? doesn't cast to string
`starts/ends_with?` methods shouldn't cast argument to string because
ruby 1.8.7 doesn't seem to do that. for example:

    "foobar".ends_with?(:bar)
    # => true in ActiveSupport implementation, false in ruby 1.8.7

[#3199 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-16 11:22:50 -07:00
Eugene Pimenov
18ba648e0d Implement find_in_batches without with_scope [#2227 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2010-04-15 01:13:16 +01:00
Xavier Noria
b8b568e53b fix dash -> edit in an example, and a few touches now that we are here 2010-04-14 11:57:36 -07:00
Pratik Naik
5efb1503dd Ensure not to load the entire association when bulk updating existing records using nested attributes 2010-04-14 01:51:43 +01:00
Anil Wadghule
c69dc1afaa Fix for plugin not getting installed on Windows environment [#4320 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-04-12 11:12:42 +02:00
Yaroslav Markin
a84e9b4f31 Fix Array#to_xml to produce valid markup when working with namespaced classes [#3624 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-04-10 18:16:46 +02:00
Vicki Ball
dae247316d made error_message_on work by passing in the object name if there is no object [#3246 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-04-10 14:02:34 +02:00
Jeremy Kemper
2cd29f4297 Only set response etag if body is not blank 2010-04-09 20:19:03 -07:00
Jeremy Kemper
d91d6fe15f CI: show all headers for diagnosis 2010-04-09 20:06:35 -07:00
Jeremy Kemper
efec9b24db Refactor for readability 2010-04-09 19:33:42 -07:00
Jeremy Kemper
56c5290fce CI: message for some outstanding failures 2010-04-09 19:32:47 -07:00
José Valim
4a02437a8d Fix a failure added on 958b0e977a 2010-04-09 22:19:49 +02:00
Santiago Pastorino
958b0e977a fix stack trace lines on class_eval
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-04-09 22:06:51 +02:00
José Valim
f87a518f81 Fix tests broken in 0653a6d30e 2010-04-09 09:23:09 +02:00
Rolf Bjaanes
fcec7402eb Changed the way inflections for uncountables work for 'funky jeans'
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-04-09 09:04:33 +02:00
David Heinemeier Hansson
0653a6d30e Fixed that default locale templates should be used if the current locale template is missing [DHH] 2010-04-08 17:15:11 -07:00
Santiago Pastorino
cfb31edb54 Generate routes for nested resources with nil object raise RoutingError [#4262 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-06 21:28:51 -07:00
Simon Effenberg
1d7368200f remove_index now uses quote_table_name() [#4300 state:resolved]
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2010-04-06 14:16:40 +12:00
Kristopher Murata
642d5d297e Parameterize should accept malformed utf8 characters [#4323 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-04 11:57:31 -07:00
Andrew White
e617af13a2 Backport of lazy evaluation of has_many ..., :dependent => :___
[#2627 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-04 07:01:38 -07:00
Jeremy Kemper
a72bcdb8ae Check more carefully for vendored tzinfo 2010-04-02 14:39:03 -07:00
Jeremy Kemper
19161e08b3 Adjust test in case tzinfo is not available 2010-04-02 14:05:15 -07:00
Jeremy Kemper
e2ec41a9a6 CI: add tzinfo 2010-04-02 14:01:26 -07:00
Santiago Pastorino
2c148cd96a delegate unknown timezones to TZInfo 2010-04-02 17:45:45 -03:00
Santiago Pastorino
de7925de8a utc_offset is no longer required on TimeZone and if it's not supplied we delegate to TZInfo 2010-04-02 16:53:45 -03:00
Jeremy Kemper
aa48c79ae4 HTML safety: give a deprecation warning if an array of option tags is passed to select tag. Be sure to join the tag yourself and mark them .html_safe 2010-03-31 19:49:29 -07:00
David Heinemeier Hansson
1668ad3baf Added Object#presence that returns the object if it's #present? otherwise returns nil [DHH/Colin Kelley] 2010-03-31 18:27:08 -07:00
Pratik Naik
1f44fc90c6 Dont use Rails 3 finder syntax in Rails 2.3.x test [#4303 state:resolved] 2010-03-31 14:14:56 +01:00
Pratik Naik
0e57c70baf Dont try to load the record from the db if preloading didn't find anything 2010-03-31 12:57:06 +01:00
Xavier Noria
a0454dcd1a avoid method redefined; discarding old empty? warning [Santiago Pastorino] 2010-03-30 17:23:44 -07:00
Santiago Pastorino
e329eab0c9 Don't cache the utc_offset we are already caching the timezone [#4301]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-03-30 16:36:28 -07:00
Juanjo Bazan
4b08679ba9 New assertion: assert_present
Signed-off-by: Xavier Noria <fxn@hashref.com>
2010-03-30 16:02:40 -07:00
Juanjo Bazan
ccb1beeb5b new assertion: assert_blank
Signed-off-by: Xavier Noria <fxn@hashref.com>
2010-03-30 15:59:09 -07:00
Joseph Wilk
ea6ef768a7 Fixed a bug where create_table could not be called without a block [#2221 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2010-03-30 15:00:44 +13:00
Dudley Flanders
bf563bd904 Trivial doc update on nested attributes delete renaming
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-03-30 01:40:51 +02:00
Joey Aghion
715b34fdff use supplied primary key when eager-loading belongs_to associations rather than default primary key
[#765]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-03-29 15:33:45 -07:00
Ernie Miller
00b95eb265 belongs_to associations now honor :primary_key option for joins
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-03-29 15:33:37 -07:00
Andrew White
03d5d0b5f5 Add the ability to specify table_name_prefix on individual modules
[#4032 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-03-29 08:55:21 -07:00
Santiago Pastorino
bc2af911f9 backport of inconsistency with cattr_reader and matter_reader with some tweaks
Signed-off-by: wycats <wycats@gmail.com>
2010-03-28 14:03:27 -07:00
Santiago Pastorino
0f18904e2b flatten not needed here
Signed-off-by: wycats <wycats@gmail.com>
2010-03-28 14:03:27 -07:00
Santiago Pastorino
cf7ed7cf2d Time marshalling backported [#4286 state:committed]
Signed-off-by: wycats <wycats@gmail.com>
2010-03-28 14:03:07 -07:00
Joe Rafaniello
c1b2200085 Marshaling a time object added an instance variable to the object which affected the quoting of serialized attributes because the to_yaml of the original object did not match the to_yaml of the marshaled one. Also, Marshal.dump was modifying the source object which the client may not be aware of.
Signed-off-by: wycats <wycats@gmail.com>
2010-03-27 04:33:19 -07:00
José Valim
157c1808b9 Added compatibility to Ruby 1.9.2. 2010-03-26 20:21:07 +01:00
Emilio Tagua
ac7b5a23ba Allow deprecation messages with or without a final period.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-03-25 15:44:16 +01:00
Rodrigo Kochenburger
0022fa309b Set mailer template_root as absolute path [#2263 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-03-25 15:36:12 +01:00
Tom Lea
97e07a88fe Fix incorrect relative paths being used when looking up templates.
The bug will manifest itself by failing to locate templates when running tests,
or when running as a daemon (from /).

It relates the the different behavior of ActionView::Template::Path#to_s and
ActionView::Template::Path#to_str when a RAILS_ROOT is defined. #to_s reports
a path relative to the root, and #to_str reports an absolute path.

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-03-25 15:33:05 +01:00
Santiago Pastorino
629afe9f19 ActionView::SafeBuffer should be there for backwards compatibility [#4241 state:committed]
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2010-03-22 14:07:53 +13:00
Bruno Michel
26f2cce232 button_to should generate an html_safe string
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2010-03-22 14:07:42 +13:00
Jeremy Kemper
c0137f62d4 Don't rely on Active Support being loaded here 2010-03-16 19:45:00 -07:00
Jeremy Kemper
f175d19e2a Bundler returns a Pathname from #loaded_from; work around it 2010-03-16 17:55:25 -07:00
Santiago Pastorino
9cfa87519d scope_key_by_partial fix for Ruby 1.9 when there's virtual_path
[#4202 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-03-16 16:05:24 -07:00
Santiago Pastorino
2310aef29b translation method of TranslationHelper module returns always SafeBuffer [#4194 status:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-03-16 13:49:59 -07:00
James Golick
27aa22826c Improve performance of multibyte utils.
Switch from using String#match to using String#=~. There's no need to
generate a MatchData for each iteration since we're not using it.

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-03-16 10:04:33 -07:00
Manfred Stienstra
2d3c58068c Improve performance of Multibyte::Utils.
Replace explicit for-loops by faster enumeration methods.

[#3158]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-03-16 10:04:33 -07:00
Santiago Pastorino
374e49b467 Change array entries to safe doesn't worth then the array is joined as a string losing the safe property of his entries
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-03-16 13:14:58 +01:00
Santiago Pastorino
ebf300f41b object_and_class_ext_test warnings removed
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-03-15 19:07:31 -07:00
Jeremy Kemper
b3d32a5b28 to_str works here 2010-03-15 11:19:46 -07:00
Bas Van Klinkenberg
b99914cc3e Fixed a bug in JSON decoding with Yaml backend, where a combination of dates, escaped or unicode encoded data and arrays would make the parser fail with a ParseError exception.
[#2831]

Signed-off-by: Yehuda Katz <wycats@gmail.com>
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-03-14 21:50:22 -07:00
Jeremy Kemper
9b209e8cb8 read_ and write_fragment cache preserve html safety yet cache strings only 2010-03-14 18:55:13 -07:00
Santiago Pastorino
056f957b22 There's a Ruby issue with File.basename different versions returns different things, so we shouldn't test that
[#4174]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-03-14 13:37:30 -07:00
Jeremy Kemper
40c393cb84 Be sure to pass through args to to_yaml 2010-03-11 18:37:36 -08:00
Jeremy Kemper
eed8a8863d Write strings to fragment cache, not outputbuffers 2010-03-11 17:32:26 -08:00
Jeremy Kemper
ec760a57d1 OutputBuffer#to_yaml should return string yaml, not some custom class dump 2010-03-11 17:08:33 -08:00
Sam Ruby
cbc0201a3e Add deprecation warning for overwrite_params and remove rdoc
[#4073 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-03-10 16:26:04 -08:00
Jeremy Kemper
abb8fbde73 Disprefer JSONGem decoder since it only decodes JSON objects 2010-03-09 11:06:31 -08:00
Aaron Patterson
5a806f6759 converting inject to each and map
[#4119 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-03-06 20:32:19 -08:00
Stijn Mathysen
f6f75e84c5 Removed the + sign as an accepted character from the parameterize method, as a + sign is interpreted by the browser as a space, possibly resulting in a "ArgumentError: illegal character in key"
[#4080 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-03-05 14:10:37 -08:00
Santiago Pastorino
d3a8152203 Adds disable option to date_helpers generated hidden fields when html_options specifies it. ht by Marc Schütz
[#3807 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-03-05 13:49:23 -08:00
Jeremy Kemper
3969148a13 Deprecate omitting the leading slash on a path arg to assert_redirected_to 2010-03-02 14:14:37 -08:00
Bryan Helmkamp
1e64cdf8c9 Bump version constants to 2.3.6 to more easily support generating prerelease gems 2010-03-01 18:24:55 -08:00
Jeremy Kemper
f56a1631be Typo: _tasks -> _paths 2010-02-26 08:54:42 -08:00
Jeremy Kemper
f4ce042795 Add *.gem, pkg, and .bundle to .gitignore. Remove globs that should be in user's global ignores. 2010-02-26 08:10:33 -08:00
Jeremy Kemper
ed7322f336 Deprecate toplevel plugins tasks in favor of lib/tasks for Rails 3 forward compat 2010-02-26 08:09:41 -08:00
Tobias Bielohlawek
b06e5dce97 fixed a 'RecordNotFound' bug when calling 'reload' on a object which doesn't met the default_scope conditions, added test [#3166 status:resolved]
The reload method didn't made use of 'with_exclusive_scope' when reloading the object. This lead to a RecordNotFound exception, in case the object doesn't met the default_scope condition (anymore) - which is obviously a bug. This quick fix makes use of with_exclusive_scope in the reload method as well. See test for full example.

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-02-26 11:39:15 +01:00
Jeremy Kemper
5695b1bdd9 Fill in for I18n.normalize_translation_keys removed from 0.3.4 2010-02-25 15:16:49 -08:00
Christoph Schiessl
268c9040d5 remove rubygems (version >= 1.3.6) deprecation message by replacing Gem::Dependency#version_requirements with Gem::Dependency#requirement
[#4026 state:committed]

Signed-off-by: Prem Sichanugrist <s@sikachu.com>
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-02-25 12:53:14 -08:00
Jeremy Kemper
63a7ef0d74 Use Object#singleton_class instead of #metaclass. Prefer Ruby's choice. 2010-02-25 11:11:09 -08:00
Jeremy Kemper
3a3fa7f817 Missed singleton_class 2010-02-25 10:54:36 -08:00
Jeremy Kemper
5b4e7c3fa0 Missing fileutils require 2010-02-24 18:54:49 -08:00
Santiago Pastorino
0307dbaba9 add time_separator for minutes only if minutes aren't hidden
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-02-24 18:41:29 -08:00
Santiago Pastorino
39bcf14b34 missing html_safe added and tests 2010-02-19 15:34:18 -08:00
Santiago Pastorino
24911757de missings html_safe added 2010-02-19 14:36:49 -08:00
Santiago Pastorino
64d28f61ad ruby 1.9 array.to_s returns a string representing an escaped array 2010-02-19 14:04:03 -08:00
Santiago Pastorino
397262a4ee i18n translate with arrays issue solved 2010-02-19 14:03:50 -08:00
Santiago Pastorino and José Ignacio Costa
62c802c622 html_escape mail_to when encode javascript and not hex 2010-02-19 13:40:05 -08:00
Santiago Pastorino and José Ignacio Costa
d7ee4bbcfa Making SafeBuffer << an alias for concat method 2010-02-19 13:37:19 -08:00
Jeremy Kemper
3926107aff Use FileUtils.mv instead of rename to copy in case of cross-device links 2010-02-18 10:48:56 -08:00
Martin Andert
6227ec11f0 Fix error_messages_for i18n issue if object_name has underscores [#3629 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-02-17 21:07:05 +01:00
Santiago Pastorino and José Ignacio Costa
4158282e32 simple_format returns a safe buffer escaping unsafe input [Santiago Pastorino] (Closes #3767)
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
2010-02-12 17:25:11 -08:00
Gabriel Mansour
6451e864b9 Fix pluralization for numbers formatted like '1.00'
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-02-07 12:15:10 -08:00
Jeremy Kemper
84541c4997 Update CHANGELOG 2010-02-06 20:24:24 -08:00
Jeremy Kemper
6f9f1d3aef Merge remote branch 'mikel/2-3-stable' into 2-3-stable 2010-02-06 20:19:21 -08:00
Mikel Lindsaar
1bf79f19a0 Reindended and handled old ruby syntax 2010-02-07 15:17:03 +11:00
Mikel Lindsaar
16b6d4216f Fixed test to check using 8Bit and verified, removed stray require 2010-02-07 15:16:50 +11:00
Jeremy Kemper
f85ab90e4f Ruby 1.9: cookie header parser works with either newline-delimited strings or arrays 2010-02-06 19:57:06 -08:00
Mikel Lindsaar
4645cd1499 Updating to TMail 1.2.7 2010-02-07 12:26:58 +11:00
Mikel Lindsaar
d53a590594 Fixing TMail encoding problem, porting to ActionMailer 2010-02-07 12:26:03 +11:00
Mikel Lindsaar
9a042baefb Changing test, TMail now encodes this correctly 2010-02-07 12:25:30 +11:00
Mikel Lindsaar
696ec1f979 Changed version of TMail to 1.2.6 2010-02-06 15:00:43 +11:00
Santiago Pastorino and José Ignacio Costa
564ace6a01 Fixed html_safe test cases which weren't testing correctly backport from 3.0
[#3869 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-02-05 13:51:21 -08:00
Santiago Pastorino and José Ignacio Costa
8a0e8f0669 Tests for html_safe! backwards compatibility are restored 2010-02-05 19:06:23 -02:00
Jeremy Kemper
d5b4f4debf Automatically prefer Yajl or JSON backend over Yaml, if available 2010-02-05 12:31:18 -08:00
Brian Lopez
83b4c161fc Add yajl-ruby as a JSON parsing backend
[#2666 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-02-05 12:31:12 -08:00
Santiago Pastorino and José Ignacio Costa
55c1a86ea4 Added backwards compatibility for html_safe! 2010-02-05 18:19:42 -02:00
Santiago Pastorino and José Ignacio Costa
9ca6df83f6 Backport html_safe. Use latest rails_xss plugin for forward-compatibility with Rails 3. 2010-02-05 11:07:56 -08:00
Joshua Peek
0c0da1a6e0 Fix empty Set-Cookie headers [#3811 state:resolved] 2010-02-02 08:53:16 -06:00
Matt Duncan
b362b394f6 Bump year in MIT licenses
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2010-02-02 08:47:10 -06:00
Jeremy Kemper
02e51500d5 Cherry-pick bd74060 from i18n master to fix broken string interpolation 2010-01-28 16:24:58 -08:00
Jatinder Singh
158e7b63ab Use format of ARes rather than content-type of remote errors to load errors.
[#1956 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-01-27 18:27:55 -08:00
Geoff Buesing
3f7729a66e Time#- with a DateTime argument behaves the same as with a Time argument, i.e. returns the difference between self and arg as a Float [#3476 status:resolved] 2010-01-27 20:24:53 -06:00
snusnu
ce50c960c1 active_support/ordered_hash now requires yaml 2010-01-27 18:14:06 -08:00
Gregor Schmidt
57337cd74d Adding custom yaml (de-)serialization for OrderedHash
[#3608 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-01-27 15:30:25 -08:00
Prem Sichanugrist
652bdeb3c3 Update vendored i18n gem to 0.3.3 [#3492 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-01-21 09:45:43 +01:00
Prem Sichanugrist
ef10988fdd Fix bug that causes to_utf_offset_s to returns wrong offset when hour < 0 and not in hundreds [#3741 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-01-19 20:35:09 +01:00
Prem Sichanugrist
6012e575bb Make local_request? to returns true when facing ::1 IPv6 address [#3257 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-01-18 08:29:53 +01:00
José Valim
c50609c9f0 Merge remote branch 'eloy/2-3-stable' into 2-3-stable 2010-01-09 00:25:14 +01:00
David Heinemeier Hansson
94de32b6eb Merge branch '2-3-stable' of github.com:rails/rails into 2-3-stable 2010-01-08 13:46:02 -08:00
David Heinemeier Hansson
4682035381 Fixed that PrototypeHelper#update_page should return html_safe [DHH] 2010-01-08 13:45:51 -08:00
Jeffrey Hardy
6e9b01fddb Allow AR::Schema's migrations_path to be overwritten by subclasses. Defaults to 'db/migrate'
[#3671 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-01-08 13:09:50 -08:00
Eloy Duran
51e6124e6a Renamed AssociationReflection #collection_association? to #collection?. 2010-01-08 21:44:06 +01:00
Eloy Duran
c9a3929a75 Rollback the transaction when one of the autosave associations fails to save. [#3391 state:resolved] 2010-01-08 21:36:27 +01:00
Lawrence Pit
eb22c248de Exclude unchanged records from the collection being considered for autosave. [#2578 state:resolved]
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2010-01-08 21:36:27 +01:00
Bryan Stearns
2aef092625 Add failing test that triggers the stack overflow for #2578.
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2010-01-08 21:36:26 +01:00
David Heinemeier Hansson
d5ba7c3ea4 Fixed that much of DateHelper wouldn't return html_safe? strings [DHH] 2010-01-08 11:48:38 -08:00
David Heinemeier Hansson
45e192d05c Fixed that fragment caching should return a cache hit as html_safe (or it would all just get escaped) [DHH] 2010-01-07 17:39:32 -08:00
Eloy Duran
0dbe0f670e Raise a RecordNotFound if an ID in nested attributes is given but doesn't return a record. [#2415 state:resolved] 2010-01-07 13:20:43 +01:00
Eloy Duran
6d056c7175 Moved the validation logic to the association reflection and refactored autosave_association.rb a bit. 2010-01-07 13:20:43 +01:00
Eloy Duran
b3bd101796 Remove deprecated '_delete' option from NestedAttributes. 2010-01-07 13:20:42 +01:00
Eloy Duran
3d17d79bbf Removed unnecessary call to #try and cleaned up a bit more. 2010-01-07 13:20:42 +01:00
Eloy Duran
4b7a439bd1 Don't use strings for callbacks, as these will be evaled. Rather use symbols, which uses a direct method dispatch.
Patch by Comron Sattari. [#3429 state:resolved]
2010-01-07 13:20:42 +01:00
Eloy Duran
c48a71c7e4 Cleanup some code in nested_attributes.rb, autosave_association.rb, and associations.rb with AssociationReflection#collection_association?
Also cache the result value.
2010-01-07 13:20:42 +01:00
Eloy Duran
f12dd62d47 Add AssociationReflection#collection_association? which returns true if it's for a has_many or has_and_belongs_to_many association. 2010-01-07 13:20:42 +01:00
Eloy Duran
e20ac99026 Refactored nested attributes a bit after last commit. 2010-01-07 13:20:42 +01:00
Mike Breen
69db137f89 Allows you to pass :all_blank to :reject_if option to automatically create a Proc that will reject any record with blank attributes.
[#2501 state:resolved]

Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2010-01-07 13:20:41 +01:00
José Valim
b7fd42626a Use helpers.label instead of views.labels. 2010-01-07 02:28:10 +01:00
José Valim
319e4aa263 Make ActionPack specs work when I18n 0.3.3 is installed as gem. 2010-01-05 00:27:50 +01:00
Hongli Lai (Phusion)
1012dec88f The failsafe middleware should flush the logger upon logging the error, otherwise nothing will be written to the log file.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2010-01-05 10:39:42 +13:00
Zach Brock
f32c96eb76 fixing autolinking other protocols
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#3494 state:committed]
2010-01-05 10:39:12 +13:00
Stefan Penner
c362a76d00 Fixed multiparameter attribute assignment bug RE: Ticket 3131
http://rails.lighthouseapp.com/projects/8994/tickets/3131-multiparamter_attribute-assignment-fails-when-used-via-assoication
2010-01-02 23:48:09 -08:00
Stefan Penner
b3dd14adbe Failing test case RE: Ticket 3131
http://rails.lighthouseapp.com/projects/8994/tickets/3131-multiparamter_attribute-assignment-fails-when-used-via-assoication
2010-01-02 23:48:08 -08:00
Carsten Gehling
f5714abc3d I18n label helper [#745 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-01-02 23:38:01 +01:00
Willem van Bergen
37c51594b9 Added two SAX-based backends for XmlMini, using both LibXML and Nokogiri.
[#3636]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-01-01 13:18:43 -08:00
Willem van Bergen
12f6fd0f26 Bugfixes, speed improvements and code cleanup for Nokogiri's and LibXML's XmlMini backend
[#3641]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-01-01 13:17:02 -08:00
Jeremy Kemper
54bc4852ea Fix pg test 2009-12-28 13:05:44 -08:00
Eloy Duran
90f001ba39 Refactored previous changes to nested attributes. 2009-12-28 21:08:20 +01:00
Michael Siebert
7074c5a629 Add an :update_only option to accepts_nested_attributes_for for to-one associations. [#2563 state:resolved]
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-12-28 19:02:01 +01:00
Eloy Duran
146a750568 Make sure to not add autosave callbacks multiple times. [#3575 state:resolved]
This makes sure that, in a HABTM association, only one join record is craeted.
2009-12-28 16:46:48 +01:00
Murray Steele
3470b306bb Make polymorphic_inverse_of in Reflection throw an InverseOfAssociationNotFoundError if the supplied class doesn't have the appropriate association. [#3520 state:resolved]
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-12-28 14:21:42 +01:00
Murray Steele
603b28c84c Provide a slightly more robust we_can_set_the_inverse_on_this? method for polymorphic belongs_to associations. [#3520 state:resolved]
Also add a new test for polymorphic belongs_to that test direct accessor assignment, not just .replace assignment.

Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-12-28 14:21:18 +01:00
George Ogata
cca75ca23f Add inverse polymorphic association support. [#3520 state:resolved]
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-12-28 14:20:58 +01:00
Murray Steele
592085be83 Add more tests for the various ways we can assign objects to associations. [#3513 state:resolved]
Get rid of a duplicate set_inverse_instance call if you use new_record(true) (e.g. you want to replace the existing instance).

Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-12-28 14:20:33 +01:00
George Ogata
ed5b89483a Set inverse for #replace on a has_one association. [#3513 state:resolved]
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-12-28 14:18:46 +01:00
Frederick Cheung
ab09ffd41e honour :inverse_of for joins based include
Signed-off-by: Michael Koziarski <michael@koziarski.com>
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-12-28 13:32:04 +01:00
Frederick Cheung
894c9b112c honour inverse_of when preloading associations
Signed-off-by: Michael Koziarski <michael@koziarski.com>
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-12-28 13:31:29 +01:00
David Heinemeier Hansson
1684aa113e Fix tests 2009-12-27 15:23:51 -08:00
David Heinemeier Hansson
2675e4ef83 Translated strings in the view are assumed html_safe (Closes #3401) 2009-12-24 20:33:25 -08:00
Dwayne Litzenberger
a900205676 Fix ActiveSupport::JSON encoding of control characters [\x00-\x1f]
According to RFC 4627, only the following Unicode code points are
allowed unescaped in JSON:

  unescaped = %x20-21 / %x23-5B / %x5D-10FFFF

However, ActiveSupport::JSON did not escape the range %x00-1f.  This caused
parse errors when trying to decode the resulting output.

[#3345 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-12-23 11:46:25 -08:00
Murray Steele
5374fb3cad Providing support for :inverse_of as an option to associations.
You can now add an :inverse_of option to has_one, has_many and belongs_to associations.  This is best described with an example:

class Man < ActiveRecord::Base
  has_one :face, :inverse_of => :man
end

class Face < ActiveRecord::Base
  belongs_to :man, :inverse_of => :face
end

m = Man.first
f = m.face

Without :inverse_of m and f.man would be different instances of the same object (f.man being pulled from the database again).  With these new :inverse_of options m and f.man are the same in memory instance.

Currently :inverse_of supports has_one and has_many (but not the :through variants) associations.  It also supplies inverse support for belongs_to associations where the inverse is a has_one and it's not a polymorphic.

Signed-off-by: Murray Steele <muz@h-lame.com>
Signed-off-by: Michael Koziarski <michael@koziarski.com>
Signed-off-by: José Valim <jose.valim@gmail.com>
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>

Conflicts:

	activerecord/lib/active_record/associations/belongs_to_association.rb
	activerecord/lib/active_record/associations/has_one_association.rb
2009-12-21 13:13:32 -08:00
David Heinemeier Hansson
8bb3b9bcff Models with no attributes should just have empty hash fixtures [Sam] (Closes #3563) 2009-12-17 17:53:33 -08:00
David Heinemeier Hansson
e6cadd422b Added :alert, :notice, and :flash as options to ActionController::Base#redirect_to that'll automatically set the proper flash before the redirection [DHH] Added ActionController::Base#notice/= and ActionController::Base#alert/= as a convenience accessors in both the controller and the view for flash[:notice]/= and flash[:alert]/= [DHH] 2009-12-17 11:34:47 -08:00
David Heinemeier Hansson
48cd7dfcf8 Fix the app generator of cookie_verification_secret.rb 2009-12-16 14:06:20 -08:00
José Valim
1c3711b21b Fix another regression due to the inclusion of ActiveRecord::Error.
If a string is supplied to :default, it should not be used a
translation key (we already have :message for that).
[#3564 status:resolved]

Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-12-16 14:18:46 -06:00
Will
b1bbf90dff When passing force_reload = true to an association, don't use the query cache [#1827 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-12-16 10:49:40 -06:00
David Heinemeier Hansson
1229ef7bf3 Accessing nonexistant cookies through the signed jar should not raise an exception 2009-12-15 21:27:38 -08:00
David Heinemeier Hansson
6d1494cec6 Its cookie_verifier_secret 2009-12-15 21:03:57 -08:00
David Heinemeier Hansson
0200e20f14 Added cookies.permanent, cookies.signed, and cookies.permanent.signed accessor for common cookie actions [DHH] 2009-12-15 20:01:48 -08:00
Geoff Buesing
e4ebaab1cb Add test for TimeWithZone#to_i with wrapped DateTime 2009-12-15 08:41:57 -06:00
Serguei Filimonov
754bbaaf37 Added #to_i to DateTime in ActiveSupport so #to_yaml works correctly on ActiveRecord models with DateTime attributes. 2009-12-15 08:34:02 -06:00
David Heinemeier Hansson
f039bbb13e Dont be an ass and leave merge shit in stable, please 2009-12-14 18:07:37 -08:00
David Heinemeier Hansson
fda3ac6e68 Add Enumerable#exclude? to bring parity to Enumerable#include? and avoid if !x.include?/else calls [DHH] 2009-12-14 18:01:47 -08:00
John Pignata
1d9468b44e Fix postgresql AR test failure
Due to the ordering of the returning result set, the test fails under the postgresql adapter. Order results by id prior to checking the first item

[#3542 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-12-11 15:15:37 -06:00
Jeremy Kemper
b9f352316e Ruby 1.9.2: exclude to_str from explicit coercion check too 2009-12-06 16:54:53 -08:00
Jeremy Kemper
64082b350c Ruby 1.9.2: explicitly raise NoMethodError for attempts at explicit coercion 2009-12-06 16:46:01 -08:00
Jeremy Kemper
b92ff78df6 Ruby 1.9: don't rely on . in load path 2009-12-06 15:34:13 -08:00
Gabe da Silveira
43d2cb8e93 Replace reset_counter_cache with reset_counters that has API inline with existing update_counters method
[#1211 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-12-03 23:25:41 -08:00
Ben Marini
ccb197b2e6 Add support for Mysql column positioning via #add_column and #change_column
add_column and change_column in the Mysql adapter now accept some
additional options:
:first => true        # Put the column in front of all the columns
:after => column_name # Put the colmn after 'column_name'

add_column :new_col, :string, :first => true
add_column :another_col, :integer, :default => 0, :after => :new_col

[#3286 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-12-03 23:10:35 -08:00
Michael Koziarski
c253d7b2db 1.9 Fix for exception views. 2009-12-03 10:27:11 +13:00
Mat Brown
2f1ded3067 Fix instance_eval calls to association proxies
In the current stable, ActiveRecord::Associations::AssociationProxy#method_missing calls yield() if a block is given, causing the block to always be evaluated in its calling context. However, in the case of instance_eval, correct behavior requires that the block be passed directly to the @target, rather than being evaluated inside a different block. Incidentally, this also simplifies the code slightly.

[#3412 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-12-02 12:46:36 -08:00
Mike Breen
1db3a27961 Implement ActiveRecord#reset_counter_cache
[#1211 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-12-02 12:08:57 -08:00
Joey A
da61a6c967 avoid generating invalid SMTP commands in ruby pre 1.9
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-11-28 13:26:29 +13:00
Gabe da Silveira
bfe0328580 Make sure strip_tags removes tags which start with a non-printable character
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-11-27 10:04:22 +13:00
Eric Chapweske
3719bd3e95 Decode http_authentication creditentials without generating abitrary symbols. 2009-11-27 09:57:10 +13:00
Michael Koziarski
c7057a213d Remove strange .diff file 2009-11-25 18:56:30 +13:00
Michael Koziarski
ec542caf58 Prepare for the 2.3.5 release 2009-11-25 18:56:12 +13:00
David Heinemeier Hansson
27b935dec6 Merge branch '2-3-stable' of github.com:rails/rails into 2-3-stable 2009-11-23 15:35:42 -06:00
David Heinemeier Hansson
d796fc638f Fixed that the debugger wouldn't go into IRB mode because of left-over ARGVs [DHH] 2009-11-23 15:35:25 -06:00
Joshua Peek
0f0f977625 Revert "Prefix Internet Explorer's accepted mime types with sensible defaults."
IE XHR requests are misinterpreted as HTML instead of JS.

This reverts commit c680f2372e.
2009-11-23 11:19:39 -06:00
Jeremy Kemper
0bc150c884 Rails 3: move core_ext/blank to core_ext/object/blank for forward compatibility 2009-11-22 14:50:12 -08:00
Michael Koziarski
93085a7d6c Handle a nil logger when generating Deprecation warnings 2009-11-19 14:22:36 +13:00
Jeremy Kemper
a942d66597 Extract form_authenticity_param instance method so it's overridable in subclasses 2009-11-17 23:36:48 -08:00
Gabe da Silveira
df0720b8b7 Insert generated association members in the same order they are specified when assigning to a has_many :through using the generated *_ids method
[#3491 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-11-17 22:24:53 -08:00
Jeremy Kemper
ed320cd896 Revert "Ensure Model#destroy respects optimistic locking"
Unresolved issues with :dependent => :destroy and counter caching.

[#1966 state:open]

This reverts commit 0d922885fb.
2009-11-17 15:31:02 -08:00
Will Read
88d2e4ca6f Allow explicit placement of hidden id element for nested models.
[#3259 state:resolved]

Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-11-15 21:50:35 +01:00
Jeremy Kemper
6da0365383 Loosen i18n gem deps from ~> to >= 2009-11-14 03:33:12 -08:00
Jeremy Kemper
78f5ecf02f CI: test AR + sqlite 2 on 1.8 only 2009-11-13 23:32:32 -08:00
Jeremy Kemper
6950f0cef2 Typo 2009-11-13 19:40:59 -08:00
Jeremy Kemper
4c3477ce77 Ruby 1.9: skip fcgi handler tests 2009-11-13 19:27:01 -08:00
Jeremy Kemper
4ffe2e171a CI: upgrade mysql, mocha, sqlite3-ruby 2009-11-13 18:44:07 -08:00
Jeremy Kemper
90f3272f1d Remove weird zombie test 2009-11-13 18:16:11 -08:00
Jeremy Kemper
c27cb5e1d4 Ruby 1.9: remove dep on T::U::AssertionFailedError 2009-11-13 18:05:14 -08:00
Jeremy Kemper
9abab5ba02 Test railties earlier rather than having to wait through AR 2009-11-13 13:15:03 -08:00
Jeremy Kemper
61bb491cbe Ruby 1.9.2: use super rather than raise our own NoMethodError to work around to_ary issues 2009-11-13 13:03:10 -08:00
Jeremy Kemper
3fa8ca5845 Ruby 1.9.2: StringIO no longer has #path 2009-11-13 13:02:29 -08:00
Jeremy Kemper
2d67ef9416 Ruby 1.9.2: prefer Array.wrap to [foo].flatten 2009-11-13 12:59:16 -08:00
Jeremy Kemper
f62a8831fe test-unit 2: filter_backtrace is private 2009-11-13 12:47:07 -08:00
Jeremy Kemper
3a3dfe4996 Ruby 1.9.2: fix broken to_ary expectation 2009-11-13 12:42:40 -08:00
Jeremy Kemper
de0384008c Ruby 1.9.2: disallow explicit coercion via method_missing. Only give friendly nil errors for Array and Active Record methods. 2009-11-13 12:28:37 -08:00
David Vrensk
4bc58a215f Rdoc for changes introduced in 6339e5d36, 542d6a0abd.
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-11-12 11:20:34 -08:00
José Valim
a4540128a4 [PATCH] Optimize Error I18n to avoid unecessary lookups and just retrieve values when needed [#3477 status:resolved].
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-11-10 12:26:33 -06:00
Matt Jones
6c0028d5cc delete correct records for a has_many with :primary_key and :dependent => :delete_all
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-11-10 18:07:04 +13:00
Bryan Helmkamp
22e1f4b307 Silence warning: instance variable @selected not initialized 2009-11-09 17:24:18 -05:00
Bryan Helmkamp
b45d44cff0 Silence warning: ambiguous first argument; put parentheses or even spaces 2009-11-09 17:24:13 -05:00
Bryan Helmkamp
40f0ef7a37 Silence warning: instance variable @segment not initialized 2009-11-09 17:24:09 -05:00
Bryan Helmkamp
ea345a540f Silence warning: instance variable @integration_session not initialized 2009-11-09 17:24:03 -05:00
Bryan Helmkamp
ae5e2f5919 Silence warning: instance variable @auto_index not initialized 2009-11-09 17:23:59 -05:00
Bryan Helmkamp
8073e47262 Silence warning: instance variable @explicit_view_paths not initialized 2009-11-09 17:23:55 -05:00
Bryan Helmkamp
a0d28dcfd4 Silence warning: instance variable @real_format not initialized 2009-11-09 17:23:50 -05:00
Bryan Helmkamp
17fda24523 Silence warning: instance variable @controller not initialized 2009-11-09 17:23:37 -05:00
Bryan Helmkamp
a3ab2b0ee1 Silence warning: instance variable @session not initialized 2009-11-09 17:23:30 -05:00
Jeremy Kemper
bfb931b865 Bump CI rack to 1.0.1 2009-11-09 12:43:10 -08:00
Jeremy Kemper
97a7cdca17 Merge commit 'brynary/2-3-stable' into 2-3-stable 2009-11-09 12:26:21 -08:00
Bryan Helmkamp
b68861a00f Silence warning: method redefined; discarding old template 2009-11-09 15:15:09 -05:00
Bryan Helmkamp
2ccd4e790e Silence warning: method redefined; discarding old filename 2009-11-09 15:14:18 -05:00
Bryan Helmkamp
8820bb7eff Silence warning: discarding old h 2009-11-09 15:12:33 -05:00
Jeremy Kemper
fd0289f3dd Bump Rack to 1.0.1. Ensure integration test input is ASCII. 2009-11-09 11:21:12 -08:00
Jeremy Kemper
a3e129f79b Shush 2009-11-09 10:36:31 -08:00
Jeremy Kemper
d81c606fba Work around Float faux precision 2009-11-09 10:34:16 -08:00
Jeremy Kemper
9ea850027c Ruby 1.9 doesn't recognize EM SPACE as whitespace, breaking String#strip 2009-11-09 10:26:28 -08:00
Bryan Helmkamp
d988507dca Fix Ruby warning: method redefined; discarding old breakpoint 2009-11-09 12:57:04 -05:00
Bryan Helmkamp
6fdd60e65c Fix Ruby warning: instance variable @loaded not initialized 2009-11-09 12:57:04 -05:00
Bryan Helmkamp
1a93e93d1b Fix some Ruby warnings: `*' interpreted as argument prefix 2009-11-09 12:57:04 -05:00
Chris Hapgood
d36f8a2bf2 Share ActionView::TestCase's output_buffer with view for concat support.
[#3467 state:resolved]

Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-11-07 00:15:11 +01:00
Chris Hapgood
df9a47e4b8 Make some assertions in the ActionView::TestCase tests actually do something.
[#3468 state:resolved]

Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-11-06 23:59:45 +01:00
Eloy Duran
6b2291f330 Define autosave association callbacks when using accepts_nested_attributes_for.
This way we don't define all the validation methods for all associations by
default, but only when needed.

[#3355 state:resolved]
2009-11-06 23:53:33 +01:00
Chris Hapgood
c3ef028b81 Fix OrderedHash#replace
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-11-05 21:16:06 +13:00
Matias Flores
4ae03b2d5a Fix chars.reverse for multibyte decomposed strings
[#597 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-11-02 17:59:40 -08:00
José Valim
7ba80252a5 Make polymorphic_url work with symbols again and refactor it [#1384 status:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-10-28 14:15:16 -05:00
José Valim
f5f7c40f3a Fix nested attributes error messages which is broken in 2.3.4. It still copies the message from child to parent, but does the lookup in the child, not in the parent, avoiding error messages duplication (as happened in 2.3.3). [#3147 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-10-28 13:44:24 -05:00
Yehuda Katz
fdf356d74b Fixed HTTP digest to properly return 401 when the Authorization header has no nonce specified, or the Authorization header specifies Basic auth [#2968 state:resolved] 2009-10-21 12:04:59 -07:00
Mike Gunderloy
9edfdef2a7 Fix bad assumption in BacktraceCleaner test [#3249 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-10-18 17:23:28 -02:00
Travis Briggs
eb30c69544 Ensure number_to_human_size does not strip zeros from the end [#1763 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-10-17 13:37:46 +13:00
Michael Koziarski
459749c30c Backport the xss_safe? method for plugin authors targetting 2.3 and master 2009-10-15 17:19:24 +13:00
George Ogata
e10b0ddc7b Make IntegrationTest::Runner propagate method_missing to ancestors.
Fixes RSpec integration example groups, which mixes its Matchers
module into ActiveSupport::TestCase.

Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-10-15 11:02:02 +13:00
Jeffrey Hardy
bbaf3a04f5 CookieJar#delete should return the key's value, consistent with a Hash
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-10-14 11:51:11 -07:00
Jeremy Kemper
7454d1874c Mark html safety 2009-10-09 18:37:38 -07:00
Pratik Naik
c23706b787 Add a :limit option to specify the maximum number of records that can be processed by accepts_nested_attributes_for
Conflicts:

	activerecord/lib/active_record/nested_attributes.rb
2009-10-09 16:11:22 +01:00
Pratik Naik
4010b49de8 Store entire options hash in the class var rather than just the reject_if proc for the nested attributes
Conflicts:

	activerecord/lib/active_record/nested_attributes.rb
	activerecord/test/cases/nested_attributes_test.rb
2009-10-09 15:47:31 +01:00
Pratik Naik
c47c5af1c8 Mute log info coming from the local_cache strategy 2009-10-09 15:12:01 +01:00
Pratik Naik
48b30608a4 Ensure MessageVerifier raises appropriate exception on tampered data 2009-10-09 02:26:37 +01:00
Michael Koziarski
95b7e4f7d7 field_error_proc needs to return a safe string 2009-10-08 14:02:12 +13:00
Michael Koziarski
80da8eb43d Merge the prerequisites for on-by-default XSS escaping into rails.
This consists of:

* String#html_safe! a method to mark a string as 'safe'
* ActionView::SafeBuffer a string subclass which escapes anything unsafe which is concatenated to it
* Calls to String#html_safe! throughout the rails helpers
* a 'raw' helper which lets you concatenate trusted HTML from non-safety-aware sources (e.g. presantized strings in the DB)

Note, this does *not* give you on-by-default XSS escaping in 2.3 applications.  To get that you'll need to install a plugin:

http://github.com/nzkoz/rails_xss
2009-10-08 13:59:21 +13:00
Pratik Naik
a69316b293 Use indifferent access attributes instead of stringifying them 2009-10-08 00:14:52 +01:00
Pratik Naik
e2127991a1 Allow accepts_nested_attributes_for :reject_if option accept symbols for using a method 2009-10-07 23:45:40 +01:00
pivotal
6f2c4991ef Explicitly require ActionController's CGI extensions so they're properly loaded before the first request.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-10-08 09:56:23 +13:00
Bryan Helmkamp
0f14d7b6d3 Only load rake tasks from tasks/**/*.rake and lib/tasks/**/*.rake in plugins
Previously, it was **/tasks/**/*.rake, and that loaded some paths that shouldn't be like:

  * vendor/plugins/admin_assistant/test_rails_app/lib/tasks/rspec.rake
  * vendor/plugins/will_paginate/test/tasks.rake

Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-10-08 09:53:33 +13:00
Jesse Proudman
58f14438a9 Running rake dev leaves ERB in environment.rb. The existing Rake task was just copying the file across. This patch modifies the Rake task to use the same ERB processing string used on database.yml, which cleans up the environment.rb file.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-10-07 08:44:59 +13:00
Pratik Naik
91b61a8d16 Monkey patch Rack::Lint to allow string subclass body 2009-10-06 15:55:56 +01:00
Jeffrey Hardy
f98302e46b MessageVerifier#verify raises InvalidSignature if the signature is blank
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-10-05 13:39:10 -07:00
Joshua Peek
11cce5bde9 Coerce all out going body parts to Strings 2009-10-05 14:21:57 -05:00
Bryan Helmkamp
1d7412b135 Reduce specificity of logging test to avoid dependency on the system clock
Signed-off-by: Yehuda Katz <wycats@gmail.com>
2009-09-29 17:10:01 -07:00
Chad Woolley
1901747001 reduce max size of fixture IDs to fix sqlite2 tests, because sqlite2 was getting negative and changing values for ID field. See http://www.sqlite.org/datatypes.html
Signed-off-by: Yehuda Katz <wycats@gmail.com>
2009-09-29 02:53:45 -07:00
Chad Woolley
f95a7f896e make mysql and postgresql rebuild databases on every CI build, to prevent breakages such as collation and character set changing
Signed-off-by: Yehuda Katz <wycats@gmail.com>
2009-09-27 21:57:41 -07:00
Yehuda Katz
26f22a28e9 Merge branch '2-3-stable' of git@github.com:rails/rails into 2-3-stable 2009-09-27 21:57:30 -07:00
John Trupiano
f489b3341c Introduce :almost keyword for distance_of_time_in_words. Make 1.75 days - 2 days return '2 days'.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#3266 state:committed]
2009-09-28 14:56:19 +13:00
Jay Pignata
b372b4c875 Enhancing distance_of_time_in_words to prefix year output with over and about depending upon how many months have elapsed
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#3106 state:committed]
2009-09-28 14:56:14 +13:00
Luciano G Panaro
14a6794a8e Make has_one with :conditions hash scope build or creation of the associated object with those conditions
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#3088 state:committed]
2009-09-28 14:51:14 +13:00
Gaspard Bucher
8371d6f0c1 Fixes a bug where layouts provided with an absolute path would not be found because they were prefixed by 'layouts'. This bug only appears if the path does not contain the word 'layouts'.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#3207 state:committed]
2009-09-28 14:40:21 +13:00
Chad Woolley
4a11ca1c7e include nokogiri gem, so activesupport nokogiri tests run
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-09-26 12:23:18 -05:00
Eloy Duran
b18248ff05 The DomAssertions now also strip surrounding whitespace inside tags. 2009-09-25 17:46:21 +02:00
Eloy Duran
deac481eb7 Made assert_dom_equal and assert_dom_not_equal ignore meaningless whitespace.
Also changed message of assert_dom_equal to be like assert_equal.
2009-09-25 17:05:30 +02:00
Eloy Duran
cddd4746f9 Rewrote ActionView::TestCase.
The test case now mimicks the template environment more closely, so it's
possible to use render, load helper dependencies.

This also fixes assert_select, and similar assertions. Because view tests
and helpers generally don't render full templates assert_select looks
first in rendered and then in output_buffer to find the rendered output.
2009-09-25 15:51:27 +02:00
Manfred Stienstra
c680f2372e Prefix Internet Explorer's accepted mime types with sensible defaults. 2009-09-25 15:47:33 +02:00
Michael Gunderloy
6222ac1a91 Fix variable error in Nokogiri XmlMini code [#3242 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-09-22 00:23:59 +01:00
Aaron Patterson
e18752868a making nokogiri to hash less clever, more fast O_o
[#2243 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-09-17 11:53:09 -07:00
Jeremy Kemper
1488c6cc9e Fix brittle content-type check. [#1956 state:committed] 2009-09-17 11:39:59 -07:00
Justin Bailey
4f5cac53b7 Enable use of MySQL stored procedures by default.
[#3204 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-09-17 10:59:41 -07:00
Developer
179b4512d1 Allow Nokogiri XmlMini backend to process cdata elements
[#3219 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-09-17 10:30:08 -07:00
Jeremy Kemper
ff0377dea5 Fix failing dependencies test relying on . being in LOAD_PATH 2009-09-13 05:44:16 -07:00
Jeremy Kemper
f503a483d4 Extract repetitive method 2009-09-13 05:44:09 -07:00
Jeremy Kemper
abd7bd311a Clean up spurious JSON decoding test failure 2009-09-13 05:43:10 -07:00
Jeremy Kemper
09b197f957 Ruby 1.9 compat: fix regexp slice test 2009-09-13 05:30:59 -07:00
Jeremy Kemper
c6fe042b29 Ruby 1.9: fix Time#beginning_of_day inaccuracy due to subtracting a Float 2009-09-13 05:07:21 -07:00
Jeremy Kemper
8dca666ba1 Silence warning for Encoding.default_external= 2009-09-13 04:49:08 -07:00
Jeremy Kemper
477dfa4c79 Use Encoding.default_external, not _internal 2009-09-13 04:49:02 -07:00
sdsykes
8afeec20e0 Ruby 1.9 compat: corrected instance_methods check
[#3156 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-09-13 02:58:36 -07:00
Michael Koziarski
6ddb7de407 Dup the arguments to string compare so we can use force_encoding.
Conflicts:

	activesupport/lib/active_support/message_verifier.rb
2009-09-13 10:37:41 +12:00
Eloy Duran
2524ac84e6 Removed some superfluous conditionals from the autosave association validation methods.
Which are unneeded now that we only define them when needed.
2009-09-12 15:03:05 +02:00
Alexey Kovyrin
c0245493cb Define autosave association validation methods only when needed. [#3161 state:resolved]
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-09-12 14:55:34 +02:00
Eloy Duran
9290051b85 Added some documentation about setting :autosave => false on an association. 2009-09-12 13:43:17 +02:00
Eloy Duran
c665faac09 During autosave, ignore records that already have been destroyed. [#2537 state:resolved] 2009-09-12 13:43:17 +02:00
Graeme Porteous
a070873771 Fix has_one with foreign_key and primary_key association bug which caused the associated object being lost when saving the owner. [#1756 state:resolved]
Mixed in a bit from patch by ransom-briggs. [#2813 state:resolved]

Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-09-12 13:43:16 +02:00
José Valim
11c338735c Rename nested attributes _delete to _destroy to reflect its actual behavior and DSL (:allow_destroy). Deprecation warning added. [#2889 state:resolved]
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-09-12 13:36:42 +02:00
Dmitry Polushkin
c52a50ec51 Fix autosave association to skip validation if it is marked for destruction. [#2064 state:resolved]
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-09-12 13:36:42 +02:00
Eloy Duran
2420d6272c Explicitely setting `autosave => false' should override new_record autosaving. [#2214 state:resolved]
Original author is Jacob.
2009-09-12 13:23:05 +02:00
Andrew France
55bc0c76f8 Allow fields_for on a nested_attributes association to accept an explicit collection to be used. [#2648 state:resolved]
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-09-12 13:16:30 +02:00
Lance Ivy
7c1e4ef64b Don't cascade autosave validation to destroyed children. [#2761 state:resolved]
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-09-12 13:16:30 +02:00
Mike Breen
52a50db6c0 Raise an exception with friendlier error message when attempting to build a polymorphic belongs_to with accepts_nested_attributes_for. [#2318 state:resolved]
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-09-12 13:16:30 +02:00
sdsykes
d48d3d0f41 Fix habtm associations when using multiple databases
[#3128]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-09-12 02:55:33 -07:00
Jeremy Kemper
3f59a73cb6 activesupport -> active_support 2009-09-12 02:47:25 -07:00
Jeremy Kemper
08d15f86c4 Deprecate "Allow frameworks to be required by their gem name"
This has just been confusing. Better to educate than band-aid.

This deprecates commit 18a24274ec.
Originally from http://dev.rubyonrails.org/ticket/8845 [drnic]
2009-09-12 02:45:33 -07:00
Akira Matsuda
c5e3309bb4 Ruby 1.9 compat: Avoid using the return value of FileUtils.mkdir_p, as it does not return a String but an Array in Ruby 1.9
[#2018 state:committed milestone:2.3.5]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-09-11 19:21:31 -07:00
Akira Matsuda
44fbc86ab8 Ensure validation errors to be ordered in declared order
[#2301 state:committed milestone:2.3.5]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-09-11 18:37:32 -07:00
Akira Matsuda
596406f90a Fix default_error_messages back to the original message
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-09-11 18:31:28 -07:00
Akira Matsuda
3413643e83 1.9 compat: let -c option work with Ruby 1.9
[#3109 state:committed milestone:2.3.5]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-09-11 18:06:51 -07:00
Akira Matsuda
028d449fe9 1.9 compat: let -g option work with Ruby 1.9
[#3105 state:committed milestone:2.3.5]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-09-11 18:06:51 -07:00
Jakub Kuźma
5de75398c4 ruby 1.9 friendly secure_compare
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-09-12 12:47:53 +12:00
Shugo Maeda
d2cf33e903 Removed the copyright notice not to show it in the result of 'ri ActiveRecord'. 2009-09-11 15:18:08 -07:00
Nathaniel Talbott
ab9efe9e16 Fix filtering parameters when there are Fixnum or other un-dupable values.
[#3184 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-09-10 18:52:45 -07:00
Beau Harrington
a32eeebdcb Remove redundant checks for valid character regexp in ActiveSupport::Multibyte#clean and #verify.
[#3181 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-09-10 17:37:16 -07:00
José Valim
e1b109633c Allow scope to be changed for ActiveRecord::Errors#generate_full_message and change deprecation message [#1687 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-09-08 10:38:45 -05:00
Jeremy Kemper
8a2cfe9de4 Ruby 1.9: fix MessageVerifier#secure_compare 2009-09-08 14:06:35 +09:00
Michael Koziarski
a43ef2436c Prepare for 2.3.4 release 2009-09-04 09:56:09 +12:00
Michael Koziarski
9a68c72b4b Clean tag attributes before passing through the escape_once logic.
Addresses CVE-2009-3009
2009-09-04 09:26:13 +12:00
Manfred Stienstra
07c69380cf Add verify and clean methods to ActiveSupport::Multibyte.
When accepting character input from outside of your application you can't
blindly trust that all strings are properly encoded. With these methods
you can check incoming strings and clean them up if necessary.

Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-09-04 09:26:13 +12:00
Coda Hale
1f07a89c59 Fix timing attack vulnerability in ActiveSupport::MessageVerifier.
Use a constant-time comparison algorithm to compare the candidate HMAC with the calculated HMAC to prevent leaking information about the calculated HMAC.

Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-09-04 09:26:13 +12:00
Jeremy Kemper
2b82708b0e Revert "Assert primary key does not exist in habtm when the association is defined, instead of doing that everytime a record is inserted."
Test failures on PostgreSQL.

[#3128]

This reverts commit 594a281d66.
2009-09-02 13:57:33 -07:00
José Valim
594a281d66 Assert primary key does not exist in habtm when the association is defined, instead of doing that everytime a record is inserted.
[#3128 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-09-01 10:18:47 -07:00
Geoff Buesing
6bf17770af Rails::Info doesn't require version for unwanted frameworks
[#3124 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-09-01 02:29:46 -07:00
Joshua Peek
6fdfe4cb5f Deprecated "best fit" detection is to difficult. Just provide a switch to toggle the new behavor on.
# new_rails_defaults.rb
  ActionController::Routing.generate_best_match = false
2009-08-31 16:09:47 -05:00
Jay Pignata
49c4a79e59 Duplicating the options hash in Date#advance to prevent modification of the original [#1133 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-08-31 13:01:34 -05:00
Antonio Tapiador del Dujo
49342d1745 I18n support for plugins
Rails will now automatically add locale files found in any engine's locale
directory to the I18n.load_path (i.e. files that match the glob pattern
"config/locales/**/*.{rb,yml}" relative to engine directories).

[#2325 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-30 13:38:10 -07:00
Jay Pignata
ff8cb50f25 Ensuring that a singular model name is set for use in controllers when scaffold is passed a plural model name
[#3062 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-30 13:31:16 -07:00
Chad Woolley
70ed47f5b4 CI config updates: do not send CI emails unless explicitly enabled, use 'gem update --system', and send emails from an address which can post to the core list
[#3116 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-30 00:06:39 -07:00
Sven Fuchs + Mateo Murphy
13fb26b714 Fix ActiveRecord Error message I18n:
* allow messages and full_messages to be lazily translated at any time
* allow locales to be swapped and still obtain correctly localized messages
* allow localized global and error-type specific full_message formats
* extract an Error class

[#1687 state:open]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-29 09:48:16 -07:00
Jeremy Kemper
05d7409ae5 Prefer utf8_unicode_ci (better) over utf8_general_ci (faster) 2009-08-27 23:09:21 -07:00
Jeffrey Hardy
058459dc22 When running multiple test tasks, don't abort early if one produces failures
[#3107 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-27 11:17:25 -07:00
Jeffrey Hardy
8a49183563 Don't use AR::Base.connection for fixture column quoting. Use the connection given to Fixtures.new
[#3104 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-26 14:53:32 -07:00
Jeffrey Hardy
4240890b28 UrlRewriter#rewrite_url should call #to_param on the value given in :anchor option, just as #url_for does
[#2746 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-26 14:11:39 -07:00
Akira Matsuda
e46e67c71f I18n: use I18n for select helpers' prompt text
[#2252 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-26 13:56:15 -07:00
Jeremy Kemper
3cd245b7fa Revert "I18n: use I18n for select helpers' prompt text"
Broke CI.

[#2252 state:open]

This reverts commit d725ad39da.
2009-08-26 12:12:04 -07:00
Sven Fuchs
a4838ee466 allow ActiveRecord#RecordInvalid exception message to be localized
[#2754 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-26 11:23:30 -07:00
Akira Matsuda
d725ad39da I18n: use I18n for select helpers' prompt text
[#2252 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-26 09:39:01 -07:00
Jeremy Kemper
e213f0caaa Fix typo 2009-08-25 13:43:20 -07:00
Emilio Tagua
38d6e65c5a timestamps gives a created_at field not created_on.
[#3093 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-25 13:43:14 -07:00
Jeremy Kemper
f1355e6a4d Benchmark script via miloops' arel fork via DataMapper's AR comparison script 2009-08-25 13:43:03 -07:00
Jeremy Kemper
d6a944f778 Add active_support/all for forward compatibility. 2009-08-23 17:18:23 -07:00
Mike Gunderloy
9127c5b7f5 Fix trivial typo in template runner example [#3082 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-20 13:35:21 +01:00
Yehuda Katz
5f6e788e27 Removes examples so it can be replaced with separate repo 2009-08-18 11:15:31 -07:00
David Heinemeier Hansson
f3c7bbeedd Added db/seeds.rb as a default file for storing seed data for the database. Can be loaded with rake db:seed (or created alongside the db with db:setup). (This is also known as the "Stop Putting Gawd Damn Seed Data In Your Migrations" feature) [DHH]
Conflicts:

	railties/CHANGELOG
2009-08-18 16:08:50 +01:00
Pratik Naik
b9f668ea94 Deprecate SQLite2Adapter and DeprecatedSQLiteAdapter 2009-08-17 14:49:31 +01:00
Jeremy Kemper
d8ae3d5a8b 2-3-stable CI notifies rails core list 2009-08-15 20:31:02 -07:00
Jeremy Kemper
1cb433ce78 Bump pg gem requirement to 0.8.0. Build psql db with UTF8 encoding. 2009-08-15 19:04:16 -07:00
Hongli Lai (Phusion)
14b6ab0f01 Fix reloading of metal pieces.
- Do not hold references to old metal objects after metal classes have been reloaded.
- Obtain the reloader lock before building the middleware stack, so that reloading of metal pieces works in the face of multithreading.

[#2873 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-15 18:00:49 -07:00
Jay Pignata
1cf32ad35a Adding a call to logger from params_parser to give detailed debug information when invalid xml or json is posted
[#2481 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-15 16:46:43 -07:00
Jeremy Kemper
75a483e18e Normalize route generation order: associations, yield block, then own routes. 2009-08-15 15:58:20 -07:00
Jeremy Kemper
061b0ba6cb Refine the deprecated route check to explicitly check whether the future route pick comes before the deprecated route that was found. 2009-08-15 15:53:45 -07:00
Jatinder Singh
dbc62ad225 Fix ActiveResource load test for 64bit machines [#3051 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-15 19:57:22 +01:00
Jay Pignata
a249cad5ef Fix calculation tests on sqlite2 [#3053 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-15 19:52:08 +01:00
Jay Pignata
dad0f62dc9 Fix test_has_many_through_polymorphic_has_one on sqlite2 [#3054 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-15 19:27:35 +01:00
Jeremy Kemper
6f5d1f3190 'would of' => 'will be' 2009-08-11 01:25:15 -05:00
Bryan Helmkamp
e82b43599e Allow delegating to nil, because the method might actually exist on it 2009-08-10 18:49:37 -05:00
Hongli Lai (Phusion)
a91969803e Correctly unlock the reloader lock if the underlying app raises an exception.
[#2873 state:incomplete]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-10 16:18:35 -05:00
Kamal Fariz Mahyuddin
9284bcc35a find_cmd should return the full path of the db command
[#1488 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-10 00:04:51 -07:00
codeape
9a42096e95 Introduce grouped_collection_select helper.
[#1249 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-10 00:00:02 -07:00
Erik Ostrom
4e014379a3 Correctly handle offsets in Multibyte::Chars#index and #rindex.
The offset in codepoints was being passed directly to the wrapped string's index/rindex method. Now we translate the offset into bytes first.

[#3028 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 23:32:08 -07:00
Cristi Balan
25fe43bc14 Add tests for scoping schema_migrations index by global table prefix and suffix
[#1543 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 22:58:35 -07:00
Tim Peters
9e96f37edd Use table prefix and suffix for schema_migrations index.
[#1543 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 22:57:37 -07:00
Fabien Jakimowicz
c3da22c042 Add support for errors in JSON format.
[#1956 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 22:41:56 -07:00
Daniel Sheppard
9341655fa3 Fix that JSON parser fails to read escaped backslashes.
[#973 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 22:32:13 -07:00
Leonardo Borges
5c74cffae6 PostgreSQL: XML datatype support
[#1874 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 22:26:26 -07:00
Jaime Bellmyer
9d51f62866 raises an exception on habtm join table inserts if join table contains a primary key. Caches this check to save time on subsequent inserts.
[#2086 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 22:20:02 -07:00
Jaime Bellmyer
9a3a7983c3 raises exception (ActiveRecord::ConfigurationError with message) on habtm association creation if join table contains a primary key
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 22:19:56 -07:00
José Valim
e972acc0d7 Allow radio buttons to work with booleans.
[#2937 state:committed]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-09 22:15:35 -07:00
Morgan Schweers
d0bdff0799 Fix that creating a table whose primary key prefix type is :table_name generates an incorrectly pluralized primary key.
[#872 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 21:59:08 -07:00
Jeremy Kemper
011baa0f65 Fix test dependency on taggings 2009-08-09 21:31:22 -07:00
Gabe da Silveira
9bc80f4dd1 Fix that counter_cache breaks with has_many :dependent => :nullify.
[#1196 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 21:31:13 -07:00
Jatinder Singh
8a49af3158 AR should respect default values for MySQL BINARY and VARBINARY columns.
[#1273 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 21:05:29 -07:00
Joshua Peek
ff643ce967 Deprecate router generation "best match" sorting 2009-08-09 22:52:14 -05:00
Joshua Nichols
ebb6606a4d Only load db/schema.rb if it exists; otherwise, display a message to run db:migrate or remove active_record in environment.rb.
[#3012 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 20:19:31 -07:00
Joshua Nichols
15fd67e9d8 Backported XML serialization behavior from master for dealing with root nodes that have modules.
ie,
- the root node is dasherized, such that MyApplication::Business::Project becomes <my-application-project-business-project>
- association children nodes have type attributes, such that MyApplication::Business::Developer becomes <developer type="MyApplication::Project::Developer">

[#2723 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 20:13:42 -07:00
Dan Croak
33c054d7e0 has_many :through create should not raise validation errors
[#2934 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 18:47:25 -07:00
jeem
cc3183d4be make private_and_public_methods unmemoizable [#2372 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-08-09 20:04:15 -05:00
Max Lapshin
9e29c084eb Make sure link_to generates the form with the specified :href if any [#2254 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-10 01:00:07 +01:00
Visnu Pitiyanuvath
ecc9b705d7 Allow ho:through#build when the owner is a new record [#1749 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-10 00:49:51 +01:00
Tristan Dunn
491f1b5f36 Prevent overwriting of table name in merging SQL conditions [#2949 state:resolved] 2009-08-10 00:41:53 +01:00
Gabe da Silveira
b763858ed5 Enable has_many :through for going through a has_one association on the join model [#2719 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-10 00:34:32 +01:00
Arthur Zapparoli
9bcacf4962 Removed duplicated tests [#3026 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-10 00:08:50 +01:00
Arthur Zapparoli
18b4ac6992 Model#human_attribute_name now accept symbols [#3025 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2009-08-09 23:56:18 +01:00
Matt Duncan
ba961250bd Fixed to_label_tag to accept id attribute without changing for attribute [#2660 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2009-08-09 23:56:06 +01:00
Grzegorz Forysinski
59c3b0d0de Ensure ActiveResource#load works with numeric arrays [Grzegorz Forysinski, Elad Meidar]
[#2305 state:resolved]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-09 23:40:06 +01:00
Jordan Brough
be017fd7d5 Active Resource recognizes 410 as Resource Gone now [#2316 state:resolved] [Jordan Brough, Jatinder Singh]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>

Conflicts:

	activeresource/lib/active_resource/exceptions.rb

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-09 23:33:11 +01:00
Vladimir Meremyanin
93f5d9d5f0 Make sure association conditions work with :include and :joins [#358 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-09 23:10:34 +01:00
Tristan Dunn
7908cfabf7 No longer require database name for MySQL to allow cross database selects.
[#1122 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 14:36:51 -07:00
Hugo Peixoto
39de15f136 Added both the documentation and a test case for the collection path name customization feature.
[#1218 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 14:27:04 -07:00
Bence Nagy
250e718355 path_names could be used to customize collection actions too
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 14:27:04 -07:00
Jatinder Singh
323f58f19f Make ActiveResource#exists? work [#3020 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-09 22:25:20 +01:00
Joshua Nichols
29a5549b34 Added back support for destroying an association's object by id. [#2306 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2009-08-09 21:47:06 +01:00
David Burger
c9d4bcf163 Fix that Hash#to_xml and Array#to_xml shouldn't modify their options hashes [#672 state:resolved] [David Burger, Dana Jones]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-09 21:47:06 +01:00
Hugo Peixoto
2c4f4a8734 With multiparameter date attributes, the behaviour when empty fields are present is now coherent with the one described in the date_select documentation.
[#1715 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 13:39:31 -07:00
Roy Nicholson
de0b073f3e Add ability to set SSL options on ARes connections.
[#2370 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 13:23:48 -07:00
Elise Huard
f6f04f1549 validate uniqueness with limit in utf8
[#2653 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 12:53:09 -07:00
Hugo Peixoto
a8286af3c3 Added a uniqueness validation test that uses diacritics.
[#2883 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 11:56:16 -07:00
Jeremy Kemper
d44b5c6219 Fix that RedCloth shouldn't be required to run tests 2009-08-09 11:02:45 -07:00
Simon Jefford
c41fb5865f Add test for routes_for_controller_and_action deprecation [#3023]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-09 18:26:22 +01:00
Dan Croak
8058a1d7d7 Deprecation warning for routes_for_controller_and_action. Use routes_for instead. [#3023]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-09 18:01:54 +01:00
Matt Conway
d3a802cee0 Allow connect_timeout, read_timeout and write_timeout settings for MySQL [#2544 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-09 17:15:40 +01:00
railsbob
80d8608102 Ensure hm:t#find does not assign nil to :include [#1845 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-09 17:03:38 +01:00
rizwanreza
d1202cfeb2 Support passing Redcloth options via textilize helper [#2973 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-09 16:42:50 +01:00
Mike Breen
8056c57a94 Serialized attributes should only be saved with partial_updates when the serialized attribute is present [#2397 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-09 16:36:54 +01:00
Hugo Peixoto
5e4b946927 Fixed the end_of_* to work with Time.usec (and Time.nsec in ruby1.9) [#1225 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2009-08-09 16:11:55 +01:00
Hugo Peixoto
5f6623b1b4 added tests for namespaced models generation and fixed a bug related to it. Also fixed a pluralization=false issue.
Signed-off-by: José Valim <jose.valim@gmail.com>
2009-08-09 16:11:42 +01:00
Michael Siebert
4c96030d05 Fix deprecating =-methods by using send [#2431 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2009-08-09 16:11:36 +01:00
José Valim
2d2216fadb Make http digest work with different server/browser combinations. [#3006 status:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-09 16:11:27 +01:00
Dmitry Ratnikov
32c23552f5 Changed to use klass instead of constantizing in assign_ids generated method
[#260 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 02:51:39 -07:00
Jeremy Kemper
83cc7de2a4 Setting connection timeout also affects Net::HTTP open_timeout.
[#2947 state:resolved]
2009-08-09 02:28:27 -07:00
Yehuda Katz
ee8fe3ae4e Update bench harness in 2.3 to match master output 2009-08-09 05:45:44 -03:00
Yehuda Katz
3cad1df22e Benchmarks 2009-08-09 05:45:44 -03:00
Yehuda Katz
7d40ba1cbf Added benchmark to 2-3 2009-08-09 05:45:44 -03:00
Rich Bradley
0b95a2afab Fix for nested :include with namespaced models.
[#260 state:committed]
2009-08-09 00:31:05 -07:00
Tristan Dunn
9aa9bad024 Don't define a default primary key in the schema dumper.
[#1908 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-08 19:32:03 -07:00
Rob
a25296ab05 Fix binary fixture test on Windows
[#2597 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-08 19:18:54 -07:00
Hugo Peixoto
ac9f9a9c3e MySQL: fix diacritic uniqueness test by setting the default character set and collation to utf8/utf8_unicode_ci
[#2883 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-08 19:04:05 -07:00
Michael Koziarski
796b7c6ce6 Don't call additional methods on builders passed to the atom_feed helper.
Additionally, actually test that the atom_feed helper works with :xml as an option.

[#1836 state:committed]
2009-08-09 13:09:24 +12:00
Marc-Andre Lafortune
819c347f43 Enumerable#sum now works will all enumerables, even if they don't respond to :size
[#2489 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-08 17:51:34 -07:00
Matt Duncan
407fbb5090 Adding :from scoping to ActiveRecord calculations
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-08-09 12:42:47 +12:00
Jan Schwenzien
389449d9ae Fix HTTP basic authentication for long credentials [#2572 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-09 01:28:07 +01:00
Nick Quaranto and Josh Nichols
d39c45690e Adding a deprecation warning for output.flush when rendering a proc or lambda
[#2893 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-08 17:23:40 -07:00
Steve St. Martin
679a0bf17f Update truncate documentation / examples to more clearly demonstrate its actual behavior
[#3016 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-08 17:13:15 -07:00
Michael Koziarski
cd5e784389 Depend on rubygems 1.3.2
Also move the min_version definition up a line so it's present in the rescue block down below.
2009-08-09 11:13:12 +12:00
Marshall Huss
791c388039 HTTP proxy support
[#2133 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-08 15:35:59 -07:00
Jeremy Kemper
ab6d295ce4 Fix caller in assert_redirected_to deprecation warning.
[#2932 state:committed]
2009-08-08 14:45:45 -07:00
Emilio Tagua
6843fb9265 Fix models load order to be able to run unit tests.
[#2550 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-08 22:29:35 +01:00
Josh Sharpe
9aaeb18781 Tidy up the AR tests, removing duplicates and making tests clearer / more focussed.
Signed-off-by: Michael Koziarski <michael@koziarski.com>

[#2774 state:committed]
2009-08-08 14:52:16 +12:00
Mike Breen
1c6c216d91 Add option to routes task to target a specific controller with CONTROLLER=x.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#2928 state:committed]
2009-08-08 14:39:00 +12:00
Matt Duncan
f73d34c131 Default sent_on time to now in ActionMailer
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#2607 state:committed]
2009-08-08 14:10:46 +12:00
Brendan Schwartz
e1d27eedce Ruby 1.9 compat: fix for SSL in Active Resource
[#1272 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-07 12:25:13 -07:00
Jeremy Kemper
4b33155428 Merge branch '2-3-stable' of git@github.com:rails/rails into 2-3-stable 2009-08-05 17:09:43 -07:00
Akira Matsuda
8dab61d146 Ruby 1.9.2 compat: Array#* uses to_str instead of to_s to join values since Ruby 1.9.2
[#2959 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-05 17:09:20 -07:00
rick
55501b9f6a move the serialized AR record logic to #as_json. Leave ActiveRecord::Base#to_json to use the same Object#to_json implementation, but keep it around for documentation purposes. 2009-08-05 16:27:02 -07:00
Sven Fuchs
5a0e295911 Make app template git adapter sync back output immediately by using system() instead of backticks [#2047 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-05 19:40:11 +01:00
Michael Koziarski
95db8aaa5f Run the view tests too 2009-08-05 18:42:56 +12:00
Sven Fuchs
bf00de03de Stop messing with supposedly-deprecated interpolation placeholders when no interpolation values have been passed.
[#2885 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-01 20:51:15 -07:00
Jeremy Kemper
6cbcfffeb1 Ruby 1.9: fix reloader tests using lambdas with no env arg 2009-08-01 20:18:22 -07:00
Jeremy Kemper
f09ceb55c0 Ruby 1.9: fix encoding for test_file_stream 2009-08-01 20:17:30 -07:00
Sava Chankov
dc559f274f Ruby 1.9: fix Content-Length for multibyte send_data streaming
[#2661 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-01 20:07:12 -07:00
Jeremy Kemper
7244425b93 Extract String#bytesize shim 2009-08-01 19:52:00 -07:00
Jeremy Kemper
21029451d7 Fix errant require 2009-08-01 19:50:54 -07:00
Jeremy Kemper
32cfd4c2f8 SQLite: deprecate the 'dbfile' option in favor of 'database.' 2009-08-01 18:22:32 -07:00
Hongli Lai (Phusion)
d37ac7958f Make the new code reloading behavior work with multithreaded environments such as Mongrel.
[#2948 state:incomplete]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-01 13:25:38 -07:00
Jeremy Kemper
17f336e2f0 Revert "Methods invoked within named scope Procs should respect the scope stack. [#1267 state:resolved]"
This reverts commit 6a13376525.

Conflicts:

	activerecord/test/cases/named_scope_test.rb
2009-07-29 16:53:49 -07:00
Ross Kaffenburger and Bryan Helmkamp
523f3ba8da Don't check authenticity tokens for any AJAX requests 2009-07-27 23:15:35 +01:00
Luke Melia
60122e81a3 Avoid loading the ActiveRecord::SessionStore class on initialization if it is not in use [#2737 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-07-27 23:13:56 +01:00
Sebastian Delmont
ead5d88bf1 Fix filter_parameter_logging of non-hash values within array params
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#2927 state:committed]
2009-07-23 09:33:29 +12:00
Michael Koziarski
143c55d325 Memoize cookies so that updates to cookies are available in the current request. [#2733 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>

Conflicts:

	actionpack/test/controller/cookie_test.rb
2009-07-22 09:46:53 +12:00
Akira Matsuda
be4d743645 Ruby 1.9.2 compat: name method was renamed to __name__ since MiniTest 1.4.x [#2922 state:resolved]
Signed-off-by: Yehuda Katz <wycats@gmail.com>
2009-07-21 01:17:53 -07:00
Akira Matsuda
7a427a83ca Ruby 1.9.2 compat: Use File#expand_path for require path because "." will not be included in LOAD_PATH since Ruby 1.9.2 [#2921 state:resolved]
Signed-off-by: Yehuda Katz <wycats@gmail.com>
2009-07-21 01:17:20 -07:00
Michael Koziarski
c7bcbb983f Forgot to bump the railties versions 2009-07-19 17:27:45 +12:00
Michael Koziarski
a147becfb8 Move from referencing the BlueCloth constant directly, to referencing Markdown.
This supports alternative implementations of markdown such as rpeg-markdown or rdiscount, and later releases of bluecloth.  There are some performance issues with earlier releases of bluecloth, and you should probably upgrade.  In the event that you can't you can place the following code into an initializer:

  Markdown = BlueCloth
2009-07-16 13:30:47 +12:00
Szymon Nowak
b3ec7b2d03 Add primary_key option to belongs_to association
[#765 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-07-15 18:14:00 -07:00
Joshua Peek
ae85927ea8 Correctly setup the rack gem dependency. 2009-07-12 19:31:41 -05:00
Joshua Peek
f36d9a6758 Go back to depending on Rack 1.0.x gem 2009-07-12 19:28:04 -05:00
Michael Koziarski
18e68d9524 Prepare version numbers, changelogs and gem dependencies for 2.3.3. 2009-07-12 15:43:39 +12:00
Michael Koziarski
6a50d6c8e3 Match tests with new reloading behaviour 2009-07-08 17:30:33 +12:00
Hongli Lai (Phusion)
bc2c4a4595 Cleanup application after #close has been called on the Rack response body, not when AC::Reload#call is done.
The Rack body might lazily evaluate its output, which is for example the case
if one calls 'render :text => lambda { ... }'. The code which lazily evaluates
the output might use other application classes. So we will want to defer
cleanup until the Rack request is completely finished.

Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-07-08 13:46:10 +12:00
Lawrence Pit
29c5985849 Use the i18n gem if present instead of vendor code. [#2871 state:resolved]
Signed-off-by: Yehuda Katz <wycats@gmail.com>
2009-07-07 18:38:02 -07:00
Hongli Lai (Phusion)
d8f8066cd1 Add support for dumping non-standard primary keys when using the SQLite3 adapter. Fix unit tests so that this feature is tested for all adapters.
Signed-off-by: Yehuda Katz <wycats@yehuda-katzs-macbookpro41.local>
2009-07-07 16:17:49 -07:00
Hongli Lai (Phusion)
31254bedae Mocha >= 0.9.7 is required, otherwise mocking doesn't work. [#2874 state:resolved]
Signed-off-by: Yehuda Katz <wycats@yehuda-katzs-macbookpro41.local>
2009-07-07 16:14:22 -07:00
Jesús García Sáez
6673001a5e Allow symbols on routes declaration (:controller and :action values) [#2828 state:resolved]
Signed-off-by: Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>
2009-07-02 12:19:38 -07:00
Brian Abreu
944f4fc7d2 Fixed ActiveSupport::OrderedHash::[] work identically to ::Hash::[] in ruby 1.8.7 [#2832 state:resolved]
Signed-off-by: Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>
2009-07-02 12:01:46 -07:00
Jarl Friis
1c855ad4e7 My suggestion to fix ticket 2401 [#2401 state:resolved]
Signed-off-by: Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>
2009-07-02 11:56:56 -07:00
Levin Alexander
d8fff7d9d5 make #inspect if zero length duration return '0 seconds' instead of empty string [#2838 state:resolved]
Signed-off-by: Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>
2009-07-02 11:23:04 -07:00
Yehuda Katz + Carl Lerche
281c1a82de Fixes a number of tests that inexplicably didn't fail when we committed the original patch 2009-07-02 10:50:39 -07:00
J.D. Hollis
f6f24b71a4 Only check for built extensions on gem dependencies that are in vendor/gems. [#2825 state:resolved]
Signed-off-by: Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>
2009-07-02 10:28:25 -07:00
Elliot Winkler
0d3c5f0a82 Patch FormTagHelper so that when a form tag is created, the div which holds the form authenticity token is set to display:inline [#2846 state:resolved]
Signed-off-by: Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>
2009-07-01 17:12:45 -07:00
Yehuda Katz + Carl Lerche
4d8fd8d335 Fixes bug where Memcached connections get corrupted when an invalid expire is passed in [#2854 state:resolved] 2009-07-01 17:00:08 -07:00
Jeremy Kemper
5217c16b09 JSON.escape returns UTF-8 strings
[#2849 state:resolved]
2009-07-01 16:27:13 -07:00
Yehuda Katz + Carl Lerche
97ad936148 Updates CI to use latest mocha 2009-07-01 13:49:35 -07:00
Jeremy Kemper
dfdf8e5dab Merge branch '2-3-stable' of git@github.com:rails/rails into 2-3-stable 2009-07-01 12:55:47 -07:00
Yehuda Katz + Carl Lerche
a8bd3c8a10 Move mocha down below initial T::U require and bump version to 0.9.7 [#2858 state:resolved] 2009-07-01 12:09:32 -07:00
Yehuda Katz + Carl Lerche
e10305f0f4 Accept Symbol for contoller name [#2855 state:resolved]
Signed-off-by: Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>
2009-07-01 11:51:09 -07:00
Chris Mear
eb52dc3db7 Make text_area_tag escape contents by default.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-06-27 13:15:53 +12:00
Michael Koziarski
9407f6e9a4 Make filter_parameters work correctly with array parameters.
Conflicts:

	actionpack/lib/action_controller/base/filter_parameter_logging.rb
2009-06-27 13:11:01 +12:00
Joshua Peek
6720b25b2d send_data should set Content-Length as a string 2009-06-25 14:44:09 -05:00
Jeremy Kemper
22554745b7 Turn on autolist for debugging also 2009-06-18 21:54:56 -04:00
Jeremy Kemper
8b9b954f40 Friendlier runtime exception if delegatee is nil 2009-06-18 20:11:02 -04:00
Jeremy Kemper
b75bc05bc5 Delegated methods report the expected file/line in backtraces 2009-06-18 18:06:42 -04:00
Joshua Peek
a491b19502 Add :concat option to asset tag helpers to force concatenation.
This is useful for working around IE's stylesheet limit.

  stylesheet_link_tag :all, :concat => true
2009-06-15 10:23:55 -05:00
Luca Guidi
447d60e9ed Bytes calculation speed up
[#2800 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-06-13 14:06:01 -07:00
Jeremy Kemper
cb9429a259 Update memcache-client to 1.7.4 for cheaper timeouts 2009-06-11 22:34:23 -07:00
Joshua Peek
25fde77674 Vendor rack 1.0.x stable 2009-06-11 19:39:21 -05:00
Andrew Kaspick
d3d4822262 allow absolute paths for the asset caches
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-06-11 16:33:01 +12:00
Jeremy Kemper
7e1bcef985 Remove dead AbstractRequest autoload 2009-06-09 23:51:04 -07:00
Michael Koziarski
19c38a9b70 Whitelist the methods which are called by multiparameter attribute assignment.
This prevents users from causing NoMethodErrors and the like by editing the parameter names, and closes a potential exploit of CVE-2009-1904.
2009-06-10 12:11:18 +12:00
Matt Jones
f43404d42b Fix incorrect specification path in GemDependency#from_directory_name
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-06-10 09:54:49 +12:00
Stephen Anderson
cd14a4a00e Sanitized the id generated by text_area_tag helper method. text_area_tag('item[description]') should return: <textarea id="item_description" name="item[description]"></textarea> instead of: <textarea id="item[description]" name="item[description]"></textarea> The old id was causing HTML validation failures.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-06-09 20:36:37 +12:00
David Stevenson
898a8801ff Made label target radio button tags with values. Radio button now respects inherited :index options when generating id.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-06-09 20:29:02 +12:00
Friedrich Göpel
72d111a21c 1.9 compatibility - don't pass an array as the from address as this ends up generating invalid SMTP commands. 2009-06-09 20:24:19 +12:00
Steven Luscher
d63fab344f Fixes #2439. ActionController::Integration::Session no longer mangles multiparameter attribute params when processing multipart requests.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-06-09 20:14:01 +12:00
Eugene Pimenov
c5c022c705 PostgreSQL adapter should call thread safe quote_string function
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-06-09 20:11:51 +12:00
Tom Ward
d97073337c Change autoload declaration in ActionView::Helpers from JavascriptHelper to JavascriptHelper, matching the actual helper name. Also removed require from UrlHelper which was inadvertently preventing the autoload typo from causing a failure.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-06-09 20:08:23 +12:00
Michael Koziarski
b1a044b629 Revert "Ensure HasManyThroughAssociation#destroy delete orphan records"
This reverts commit 7a85927da2.

There's still some debate about the intended behaviour in the ticket, leaving in master but removing prior to shipping 2.3.3
2009-06-09 20:03:36 +12:00
Matt Jones
2c3d2906b2 Fix several issues with the 2.3.2 gem loader.
Incorporates the following:

- migrates back small change to gems:build:force from bfc1609a50 to finish closing #2266.

- unrolls to_proc calls in gems.rake, to match the change in master.

- fixes #2722 by passing the options hash to dependencies during build. (includes a test)

- fixes #2721 by loading the specification directly in from_directory_name. Adds an option to opt-out of specification loading when needed (in gems:refresh_specs, for instance). Includes tests.

- fixes #2679 by refreshing specs for all frozen gems rather than just gems loaded from the environment.

- fixes #2678 by passing the options hash to dependencies during unpack.

Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-06-09 19:57:23 +12:00
nate
056ddbdcfb A test to show that http_authentication needs to fail authentication if the password procedure returns nil. Also includes a fix to validate_digest_response to fail validation if the password procedure returns nil.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-06-09 19:47:16 +12:00
Pratik Naik
5fb66a3abb Vendor Rack edge ( commit : 815342a8e15db564b766f209ffb1e340233f064f ) 2009-06-08 23:47:36 -07:00
Jeremy Kemper
e70272e2a4 Clearer String#first and #last edge cases. Fix that 'foo'.first(0) == 'foo' instead of '' 2009-06-08 20:42:39 -07:00
Jeremy Kemper
63d0c33787 Fix AR json encoding 2009-06-08 20:42:39 -07:00
Jeremy Kemper
f9b2227649 Qualify constant references in BasicObjects 2009-06-08 20:42:39 -07:00
Jeremy Kemper
756e82d1b6 Prefer JSON.encode(value) to value.to_json 2009-06-08 20:42:39 -07:00
Jeremy Kemper
74f16a56e7 Simplify json decoder backend lazy load 2009-06-08 20:42:39 -07:00
Jeremy Kemper
f1e75e4378 Add #element and #collection to ModelName 2009-06-08 20:42:39 -07:00
Jeremy Kemper
cc5d313a48 Lazier Rakefile requires to avoid needing full rake gem on 1.9 2009-06-08 20:42:39 -07:00
Jeremy Kemper
91727ae5e4 Ruby 1.9: sqlite escape encoding 2009-06-08 20:42:31 -07:00
Jeremy Kemper
91fbdfd5b3 Failsafe doesn't return bare String body 2009-06-08 20:35:52 -07:00
Jeremy Kemper
05abd7c196 Check for to_str instead of String 2009-06-08 20:35:52 -07:00
Jeremy Kemper
aebd1ba5b4 Integration tests use Rack::Lint on 1.9 also 2009-06-08 20:35:51 -07:00
Jeremy Kemper
ec10f13939 Ruby 1.9: fix json encoding 2009-06-08 15:18:11 -07:00
Jeremy Kemper
01f820c3b2 Use to_json instead of rails_to_json 2009-06-08 14:09:16 -07:00
Jeremy Kemper
a69ee11968 JSON: split encoding and coercion 2009-06-08 01:37:28 -07:00
Jeremy Kemper
4a78dae2ab Revert rails_to_json -> to_json so we don't break compatibility
[#2753 state:resolved]
2009-06-08 00:11:12 -07:00
Jeremy Kemper
4b4164e8a8 Don't rely on Rails.logger 2009-06-08 00:09:50 -07:00
Tim Connor
84a755b27e Work around a gem dependency edge case that prevents Rails from booting..
If you have a frozen gem with unfrozen dependencies (for instance if the
dependency has native extensions so can't be frozen) you can have a
nightmare upgrade problem, where you cannot rake gems:install, because
rake is broken by a gem loading problem.

If you bump up your frozen gem to a newer version that requires a newer
dependency, everybody else on the team will have rake broken by that
dependency mismatch, since you will have had to specify the dependency
in your config.gems, otherwise nobody will have installed it, since the
parent is frozen. And now the config.gems loading code will kill rake.

[#2609 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-06-05 23:06:19 -07:00
Michael Koziarski
b600bf2cd7 name is case sensitive, update tests to reflect that 2009-06-01 14:21:08 +12:00
Han Kessels
4d7c597e84 fix for IE incompatibility of :disable_with in submit_tag
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-06-01 14:03:35 +12:00
Ian Terrell
a92790ab86 added a failing test case for counting has_many :through associations with scopes
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-06-01 13:54:56 +12:00
Michael Koziarski
34c3162c5c Revert "Ensure calculations respect scoped :select". Broke .count on a has_many :through association.
This reverts commit 6543426c73.
2009-06-01 13:54:20 +12:00
Joshua Peek
c73cf7d2c0 Revert "Only save the session if we're actually writing to it [#2703 state:resolved]"
This reverts commit 14edaa104d.
2009-05-30 09:36:32 -05:00
Johan Sörensen
14edaa104d Only save the session if we're actually writing to it [#2703 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-05-28 09:32:16 -05:00
Johan Sörensen
dc94c09503 The FlashHash and friends causes a lot of needless session storing, when we know for a fact that there's no content in the flash. By not storing the empty hash in the session we save a lot of communication with the various session backends, while still keeping the same interface to the flash. [#2703 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-05-28 09:22:35 -05:00
Hongli Lai (Phusion)
34a1ed0df8 Make the Failsafe middleware attempt to render 500.html during failsafe response rendering. Also make the default static failsafe response more friendly, in case 500.html rendering fails. [#2715 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-05-27 14:59:11 -05:00
calavera
4196616778 ensure initialize_database_middleware doesn't use ActionController if action_controller framework is not enabled [#2680 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-05-27 14:56:26 -05:00
Joshua Peek
b4c7b3e893 Ensure Memcache local cache returns duplicated values [#2302 state:resolved] 2009-05-27 14:55:13 -05:00
Hongli Lai (Phusion)
9b2a665aff activesupport/json/encoders fix that to_json should call rails_to_json, not just be an alias to the rails_to_json method defined in Object. Fixes #2690
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-05-25 15:28:14 +02:00
Eloy Duran
a70c78177a Ensure the parent record is always saved when the child is invalid. [#2249 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-05-20 21:19:30 +02:00
Bryan Helmkamp
542d6a0abd Use duck typing to also allow MemCache-like object when initializing a MemCacheStore
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-05-19 16:58:20 -07:00
Jeremy Kemper
2a657725f1 Mark pending release in changelog instead of edge 2009-05-19 10:59:24 -07:00
Bryan Helmkamp
6339e5d360 Allow MemCacheStore to be initialized with a MemCache object instead of addresses and options 2009-05-19 10:58:30 -07:00
Jeremy Kemper
9fcadcbd68 Fix imprecise float comparison 2009-05-18 14:34:32 -07:00
Joe Van Dyk
ad85771221 Add ability to get multiple memcached keys at the same time (via MemCacheStore#read_multi).
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-05-18 13:44:45 -07:00
Ken Collins
50608ecccd Reimplement Fixtures.identify so that it consistently generates identities across ruby versions.
[#2633 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-05-18 13:42:04 -07:00
Luca Guidi
7a85927da2 Ensure HasManyThroughAssociation#destroy delete orphan records [#2251 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-05-18 22:31:14 +02:00
Pratik Naik
97b75c9f16 Make sure default_scope#create checks for options[:conditions] [#2181 state:resolved] [James Le Cuirot] 2009-05-18 21:27:55 +02:00
Pratik Naik
dbb0258279 Ensure HTTP Digest auth uses appropriate HTTP method [#2490 state:resolved] [Steve Madsen] 2009-05-18 17:00:29 +02:00
rick
2b5e4f38f5 load the JSON Backend lazily. 2009-05-17 19:16:11 -07:00
Jeremy Kemper
5b80ead2a3 Extract json string escaping 2009-05-17 18:42:56 -07:00
Jeremy Kemper
cc47d3ff0c Only Object to_json alias is needed. Prefer nil options. 2009-05-17 18:42:44 -07:00
rick
d052e9fb58 Add pluggable JSON backends with support for the JSON gem.
Example: ActiveSupport::JSON.backend = "JSONGem"

All internal Rails JSON encoding is now handled by
ActiveSupport::JSON.encode().  Use of #to_json is not recommended, as it
may clash with other libraries that overwrite it.  However, you can
recover Rails specific functionality
if you really want to use #to_json.

    gem 'json'
    ActiveSupport::JSON.backend = "JSONGem"

    class ActiveRecord::Base
      alias to_json rails_to_json
    end
2009-05-17 18:40:38 -07:00
Joshua Peek
43e537b9e8 Missed a file from the previous commit 2009-05-17 14:45:06 -05:00
Joshua Peek
e30016c29e Fix reset_session with ActiveRecord store [#2200 state:resolved] 2009-05-17 14:44:19 -05:00
Mike Breen
f383a4aa33 Allow assert_template to take a symbol [#2011 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-05-17 19:40:18 +02:00
Paulo Schneider
14b769899c Fix typo in the generated routes.rb [#2433 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-05-17 15:00:41 +02:00
Jacob Kjeldahl
d5f018eb10 Supply valid ruby-prof parameters [#1804 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-05-17 14:53:50 +02:00
Daniel Guettler
4cd40726eb has_one :through should not create a new association when assigned nil [#698 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-05-17 14:50:09 +02:00
Pratik Naik
ba92e83bcc Include guides directory in the rails gem 2009-05-16 17:08:34 +02:00
José Valim
66ead4f148 Allow strings to be sent as collection to select.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#2391 state:committed]
2009-05-15 15:30:42 +12:00
Joshua Peek
f7cb7fce4c Sweeper does not belong in Sweeping module 2009-05-14 16:47:24 -05:00
Peter Marklund
0380e9ca5f Changed ActiveRecord::Base#exists? to invoke find_initial so that it is compatible with, and doesn't lose, :include scopes (references to eager loaded tables)
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#2543 state:committed]
2009-05-14 20:42:13 +12:00
Jeremy Kemper
35e1785081 Revert "Fixed bug with polymorphic has_one :as pointing to an STI record"
[#2594 state:open]

This reverts commit 93c557828e.
2009-05-11 12:21:59 -07:00
Douglas F Shearer
2bcb2443a9 ActiveSupport::OrderedHash[1,2,3,4] creates an OrderedHash instead of a Hash.
[#2615 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-05-11 11:46:43 -07:00
Joshua Peek
4051dd3412 Fix syntax error from 5ac05f15 2009-05-09 22:22:14 -05:00
Anthony Crumley
88d5e3341d Fixed eager load error on find with include => [:table_name] and hash conditions like {:table_name => {:column => 'value'}}
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-05-10 13:33:22 +12:00
John Small
7bf9bf3dd6 Add configuration options for :dasherize and :camelize calls to Hash#to_xml
People using ActiveResource & REST to integrate with other systems need to be able to control the default dasherize behavior of Hash.to_xml.
Currently there is no test for a default value, but existing code asssumes it's true. This patch adds tests for the default value and adds
mattr_accessor to ActiveSupport for :dasherize_xml and :camelize_xml. These module attributes set the defaults for :dasherize and :camelize in
rename_keys inside Hash#to_xml. The tests have been changed to separate out the testing of the parameter options for :camelize
and :dasherize so that we only test one thing at a time. We also test default values for :camelize_xml and :dasherize_xml.

The module attribute dasherize_xml is set to true in this patch to maintain existing code. But at some point in the future it should be set to
false because Hash#to_xml probably should not set underscores to dashes by default.

Changed documentation on ActiveResource#to_xml to correctly describe the behaviour of Hash#to_xml. The previous documentation said that
the default for :dasherize was false, in fact it was and still is true, but we now have a way to change the default. I've also added
documentation for the :camelize option.

Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-05-10 13:09:40 +12:00
Ken Collins
6dec3c45fc ActiveSupport::OrderedHash#to_a method returns an ordered set of arrays. Matches ruby1.9's Hash#to_a.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#2629 state:committed]
2009-05-10 13:05:14 +12:00
Joshua Peek
e61cceb37f Don't stream each line of the body, just send the whole thing 2009-05-08 17:00:16 -05:00
Joshua Peek
7f1f16c01f Deprecate assert_redirect_to's partial hash matching. This will be fully removed in 3.0. 2009-05-04 20:24:49 -05:00
Wincent Colaiuta
5ac05f15c6 Extract ActionController::Caching::Sweeper into separate file [#1977 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-05-04 20:17:27 -05:00
Tim Connor
49169f7a6a fix problems with requires in metal choking under development reloading [#2579 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-05-04 20:12:16 -05:00
codebrulee
ebe8dd6108 Remove stray underscore from the hash conversion methods which broke backwards compatibility with Hash.from_xml
Also add an all-caps test to prevent future regressions
2009-05-04 09:51:35 -07:00
Ruy Asan
17e712d3a3 Added routing test for irregular ID requirements and custom member action.
[#2595 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-05-01 15:02:51 -07:00
Ruy Asan
93c557828e Fixed bug with polymorphic has_one :as pointing to an STI record
[#2594 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-05-01 14:49:38 -07:00
Alexander Podgorbunsky
628b4ad679 Default scope :order should be overridden by named scopes.
[#2346 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-05-01 14:45:35 -07:00
Jeremy Kemper
a5ed7eede6 Missed commit for 7c4b325e0a 2009-04-30 16:49:34 -07:00
John F. Douthat
d1d1894c2f Fix action-cached exception responses.
Methods raising ActiveRecord::RecordNotFound were returning 404 on first request and 200 OK with blank body on subsequent requests.

[#2533 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-04-30 16:48:07 -07:00
Jeremy Kemper
7c4b325e0a Fix render :json => nil [#2589 state:resolved] 2009-04-30 16:47:42 -07:00
David Dollar
00eee49e1e Additional tests for the gem subsystem
* test_gem_ignores_development_dependencies
  * test_gem_guards_against_duplicate_unpacks
  * test_gem_does_not_unpack_framework_gems

[#2236 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-04-29 08:08:48 -07:00
David Dollar
6e3bede928 Attempt to deal with more cases of gems with native components.
This commit adds a rudimentary check for 'unbuilt' gems, so that we can abort
the application load if there are any gems that have native components that
have not yet been built.

The rake task gems:build has now only builds 'unbuilt' gems as a result.

The rake task gems:build:force has been added to deal with cases of incomplete
builds, or any case where you need to force the build of all of your gems.

Changes the gems:build task to get its gem list by parsing directory entries
in vendor/gems, which sidesteps the chicken/egg issues involved with having a
gem unpacked into vendor/gems without before its native bits are compiled.

[#2266 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-04-28 23:19:18 -07:00
Stephen Bannasch
4b68debb1c add JRuby-JDOM backend for XmlMini
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-04-26 16:23:22 -07:00
Hongli Lai (Phusion)
2633108e1f Fix environment variable testing code in failsafe.rb.
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-04-26 11:22:44 -05:00
Hongli Lai (Phusion)
5e57e2fa58 Remove reference to Rack::RewindableInput, which has been removed a while ago.
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-04-26 11:21:15 -05:00
Yehuda Katz
cb9a1f17f0 Updated 2-3-stable to Rack 1.0 2009-04-25 12:47:51 -07:00
Joshua Peek
61a1456937 Remove RewindableInput middleware since all input MUST be rewindable according to a recent change in the Rack 1.0 SPEC 2009-04-25 14:05:58 -05:00
Joshua Peek
16f36b6171 Remove vendored version of Rack 2009-04-25 13:59:26 -05:00
Joshua Peek
2d9b45722c Remove pending rack specifications until they are official 2009-04-25 13:44:34 -05:00
Jeremy Kemper
617d7eb57b Merge branch '2-3-stable' of git@github.com:rails/rails into 2-3-stable 2009-04-22 01:08:53 -07:00
Pratik Naik
09a976ac58 Change table to prevent copying indexes on sqlite2 2009-04-21 13:29:00 +01:00
Pratik Naik
5bbd097ce9 Specify :group with the table name for it to work on sqlite3 2009-04-21 13:12:15 +01:00
Pratik Naik
3267097393 Fix tests for sqlite3 3.6.xx 2009-04-21 13:08:26 +01:00
Max Lapshin
5a4603fafb Fixed dumping from postgresql columns in index in wrong order. [#2515 state:resolved]
Signed-off-by: Tarmo Tänav <tarmo@itech.ee>
2009-04-21 11:45:02 +01:00
Scott Woods
70ba90b072 Quote table names when casting to regclass so that capitalized tables are supported. [#2418 state:resolved]
Signed-off-by: Tarmo Tänav <tarmo@itech.ee>
2009-04-21 11:44:54 +01:00
Max Lapshin
de4cc53f74 Fixed wrong quoting of index names in postgres [#2402 state:resolved]
Signed-off-by: Tarmo Tänav <tarmo@itech.ee>
2009-04-21 11:44:47 +01:00
Max Lapshin
6060123470 Support multiple schemas in table names for postgresql [#390 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-04-21 11:40:12 +01:00
Pratik Naik
fc2421b784 Ensure :dependent => :delete_all works for association with hash conditions 2009-04-21 11:33:27 +01:00
Pratik Naik
375e8976e3 Ensure JoinAssociation uses aliased table name when multiple associations have hash conditions on the same table 2009-04-20 13:56:03 +01:00
Mislav Marohnić
35c5727ace Always buffer rack.input if it is not rewindable
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-04-17 21:54:09 -05:00
Mislav Marohnić
878aec9d95 Improve rewindable input test coverage so tests fail when you remove the middleware
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-04-17 19:35:25 -05:00
Jeremy Kemper
c9a3d99164 Clearer String#first and #last edge cases. Fix that foo.first(0) == instead of foo. 2009-04-17 18:06:47 -05:00
David Heinemeier Hansson
fa750e08a8 Added :touch option to belongs_to associations that will touch the parent record when the current record is saved or destroyed [DHH] 2009-04-16 17:26:10 -05:00
David Heinemeier Hansson
50e867480a Added ActiveRecord::Base#touch to update the updated_at/on attributes with the current time [DHH] 2009-04-16 16:48:07 -05:00
Doug McInnes
dc69d9308a Fix for TestResponse.cookies returning cookies unescaped [#1867 state:resolved]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
2009-04-07 13:22:21 -05:00
Kenny Ortmann
ace154d067 added tests for session options being defaulted correctly to rack defaults [#2403 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-04-07 11:08:04 -05:00
Ryan Angilly
651611999d adding session_options initialization and test [#2303 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-03-24 10:53:29 -05:00
thedarkone
6a1267a0b1 Fix template extension parsing. [#2315 state:resolved] [#2284 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-03-24 10:53:24 -05:00
thedarkone
d2e6a0fbc3 Simplify handling of absolute path templates. [#2276 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-03-24 10:53:20 -05:00
David Dollar
dace54b2e9 Updates tests to cause the tests for the Request class not to proxy through a fake TestRequest object [#2278 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-03-24 10:53:14 -05:00
Peter Marklund
daffa5cbdd Reset request_parameters in TestRequest#recycle! to avoid multiple posts clobbering each other [#2271 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-03-24 10:53:07 -05:00
Joshua Peek
c91912700d just kill brittle test 2009-03-24 10:52:49 -05:00
2302 changed files with 97081 additions and 121039 deletions

18
.gitignore vendored
View File

@@ -2,20 +2,18 @@ pkg
.bundle
debug.log
doc/rdoc
activemodel/doc
activeresource/doc
activerecord/doc
activerecord/sqlnet.log
actionpack/doc
actionmailer/doc
activesupport/doc
activemodel/test/fixtures/fixture_database.sqlite3
actionpack/test/tmp
activesupport/test/fixtures/isolation_test
dist
activeresource/pkg
activerecord/pkg
actionpack/pkg
actionmailer/pkg
activesupport/pkg
railties/pkg
railties/test/500.html
railties/test/fixtures/tmp
railties/test/initializer/root/log
railties/doc
railties/doc/guides/html/images
railties/doc/guides/html/stylesheets
railties/guides/output
railties/tmp

View File

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

View File

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

53
Gemfile
View File

@@ -1,53 +0,0 @@
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"
end
# for perf tests
gem "faker"
gem "rbench"
gem "addressable"
# AS
gem "memcache-client", ">= 1.8.5"
platforms :ruby do
gem 'json'
gem 'yajl-ruby'
gem "nokogiri", ">= 1.4.4"
# AR
gem "sqlite3", "~> 1.3.3"
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"
end
end
env :AREL do
gem "arel", :path => ENV['AREL']
end
# gems that are necessary for ActiveRecord tests with Oracle database
if ENV['ORACLE_ENHANCED_PATH'] || ENV['ORACLE_ENHANCED']
platforms :ruby do
gem 'ruby-oci8', ">= 2.0.4"
end
if ENV['ORACLE_ENHANCED_PATH']
gem 'activerecord-oracle_enhanced-adapter', :path => ENV['ORACLE_ENHANCED_PATH']
else
gem "activerecord-oracle_enhanced-adapter", :git => "git://github.com/rsim/oracle-enhanced.git"
end
end

View File

@@ -1,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 +0,0 @@
3.0.20

View File

@@ -1,68 +0,0 @@
== 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.
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.
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
{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].
== Getting Started
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:
rails new myapp
where "myapp" is the application name.
3. Change directory to +myapp+ and start the web server:
cd myapp; rails server
Run with <tt>--help</tt> for options.
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:
* 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].
== 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
to proceed. {Join us}[http://contributors.rubyonrails.org]!
== License
Ruby on \Rails is released under the MIT license.

128
Rakefile
View File

@@ -1,128 +1,70 @@
gem 'rdoc', '>= 2.5.10'
require 'rdoc'
require 'rake'
require 'rdoc/task'
$:.unshift File.expand_path('..', __FILE__)
require "tasks/release"
env = %(PKG_BUILD="#{ENV['PKG_BUILD']}") if ENV['PKG_BUILD']
desc "Build gem files for all projects"
task :build => "all:build"
PROJECTS = %w(activesupport railties actionpack actionmailer activeresource activerecord)
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
Dir["#{File.dirname(__FILE__)}/*/lib/*/version.rb"].each do |version_path|
require version_path
end
PROJECTS = %w(activesupport activemodel actionpack actionmailer activeresource activerecord railties)
desc 'Run all tests by default'
task :default => %w(test test:isolated)
task :default => :test
%w(test test:isolated package gem).each do |task_name|
%w(test rdoc pgem package release gem).each do |task_name|
desc "Run #{task_name} task for all projects"
task task_name do
errors = []
PROJECTS.each do |project|
system(%(cd #{project} && #{$0} #{task_name})) || errors << project
system %(cd #{project} && #{env} #{$0} #{task_name})
end
fail("Errors in #{errors.join(', ')}") unless errors.empty?
end
end
desc "Smoke-test all projects"
task :smoke do
(PROJECTS - %w(activerecord)).each do |project|
system %(cd #{project} && #{$0} test:isolated)
end
system %(cd activerecord && #{$0} sqlite3:isolated_test)
end
desc "Install gems for all projects."
task :install => :gem do
version = File.read("RAILS_VERSION").strip
(PROJECTS - ["railties"]).each do |project|
puts "INSTALLING #{project}"
system("gem install #{project}/pkg/#{project}-#{version}.gem --no-ri --no-rdoc")
end
system("gem install railties/pkg/railties-#{version}.gem --no-ri --no-rdoc")
system("gem install pkg/rails-#{version}.gem --no-ri --no-rdoc")
end
desc "Generate documentation for the Rails framework"
RDoc::Task.new do |rdoc|
hijack_rdoc!
rdoc.rdoc_dir = 'doc/rdoc'
rdoc.title = "Ruby on Rails Documentation"
rdoc.main = "railties/README"
rdoc.options << '-f' << 'horo'
rdoc.options << '-c' << 'utf-8'
rdoc.options << '-m' << 'README.rdoc'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.options << '-A cattr_accessor=object'
rdoc.options << '--charset' << 'utf-8'
rdoc.options << '--main' << 'railties/README'
rdoc.rdoc_files.include('README.rdoc')
rdoc.template = ENV['template'] ? "#{ENV['template']}.rb" : './doc/template/horo'
rdoc.rdoc_files.include('railties/CHANGELOG')
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.include('railties/README')
rdoc.rdoc_files.include('railties/lib/{*.rb,commands/*.rb,rails/*.rb,rails_generator/*.rb}')
rdoc.rdoc_files.include('activerecord/README.rdoc')
rdoc.rdoc_files.include('activerecord/README')
rdoc.rdoc_files.include('activerecord/CHANGELOG')
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/README')
rdoc.rdoc_files.include('activeresource/CHANGELOG')
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/README')
rdoc.rdoc_files.include('actionpack/CHANGELOG')
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')
rdoc.rdoc_files.include('actionpack/lib/action_view/**/*.rb')
rdoc.rdoc_files.exclude('actionpack/lib/action_controller/vendor/*')
rdoc.rdoc_files.include('actionmailer/README.rdoc')
rdoc.rdoc_files.include('actionmailer/README')
rdoc.rdoc_files.include('actionmailer/CHANGELOG')
rdoc.rdoc_files.include('actionmailer/lib/action_mailer/base.rb')
rdoc.rdoc_files.exclude('actionmailer/lib/action_mailer/vendor/*')
rdoc.rdoc_files.include('activesupport/README.rdoc')
rdoc.rdoc_files.include('activesupport/README')
rdoc.rdoc_files.include('activesupport/CHANGELOG')
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/lib/active_model/**/*.rb')
end
# Enhance rdoc task to copy referenced images also
@@ -131,31 +73,11 @@ task :rdoc do
FileUtils.copy "activerecord/examples/associations.png", "doc/rdoc/files/examples/associations.png"
end
desc 'Bump all versions to match version.rb'
task :update_versions do
require File.dirname(__FILE__) + "/version"
File.open("RAILS_VERSION", "w") do |f|
f.write Rails::VERSION::STRING + "\n"
end
constants = {
"activesupport" => "ActiveSupport",
"activemodel" => "ActiveModel",
"actionpack" => "ActionPack",
"actionmailer" => "ActionMailer",
"activeresource" => "ActiveResource",
"activerecord" => "ActiveRecord",
"railties" => "Rails"
}
version_file = File.read("version.rb")
desc "Publish API docs for Rails as a whole and for each component"
task :pdoc => :rdoc do
require 'rake/contrib/sshpublisher'
Rake::SshDirPublisher.new("wrath.rubyonrails.org", "public_html/api", "doc/rdoc").upload
PROJECTS.each do |project|
Dir["#{project}/lib/*/version.rb"].each do |file|
File.open(file, "w") do |f|
f.write version_file.gsub(/Rails/, constants[project])
end
end
system %(cd #{project} && #{env} #{$0} pdoc)
end
end

View File

@@ -1,128 +1,30 @@
## Rails 3.0.20 (unreleased)
*2.3.11 (February 9, 2011)*
*2.3.10 (October 15, 2010)*
*2.3.9 (September 4, 2010)*
*2.3.8 (May 24, 2010)*
*2.3.7 (May 24, 2010)*
## Rails 3.0.19 (Jan 8, 2013)
* Version bump.
* No changes.
## Rails 3.0.18 (Jan 2, 2013)
*2.3.6 (May 23, 2010)*
* No changes.
* Upgrade TMail from 1.2.3 to 1.2.7. [Mikel Lindsaar]
## Rails 3.0.17 (Aug 9, 2012)
* No changes.
*2.3.5 (November 25, 2009)*
## Rails 3.0.16 (Jul 26, 2012)
* Minor Bug Fixes and deprecation warnings
* No changes.
## Rails 3.0.14 (Jun 12, 2012)
*2.3.4 (September 4, 2009)*
* No changes.
* Minor bug fixes.
* Rails 3.0.13 (May 31, 2012)
* No changes.
*2.3.3 (July 12, 2009)*
*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
* No changes, just a version bump.
*2.3.2 [Final] (March 15, 2009)*
@@ -243,7 +145,7 @@
* ActionMailer::Base documentation rewrite. Closes #4991 [Kevin Clark, Marcel Molina Jr.]
* Replace alias method chaining with Module#alias_method_chain. [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.]
@@ -389,7 +291,7 @@
* 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]
* 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]
@@ -428,7 +330,7 @@
@body = "Nothing to see here."
@charset = "iso-8859-1"
end
def unencoded_subject(recipient)
@recipients = recipient
@subject = "testing unencoded subject"
@@ -437,7 +339,7 @@
@encode_subject = false
@charset = "iso-8859-1"
end
*0.6.1* (January 18th, 2005)

149
actionmailer/README Normal file
View File

@@ -0,0 +1,149 @@
= Action Mailer -- Easy email delivery and testing
Action Mailer is a framework for designing email-service layers. These layers
are used to consolidate code for sending out forgotten passwords, welcome
wishes on signup, invoices for billing, and any other use case that requires
a written notification to either a person or another system.
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
have been sent from a phone).
== Sending emails
The framework works by setting up all the email details, except the body,
in methods on the service layer. Subject, recipients, sender, and timestamp
are all set up this way. An example of such a method:
def signed_up(recipient)
recipients recipient
subject "[Signed up] Welcome #{recipient}"
from "system@loudthinking.com"
body :recipient => recipient
end
The body of the email is created by using an Action View template (regular
ERb) that has the content of the body hash parameter available as instance variables.
So the corresponding body template for the method above could look like this:
Hello there,
Mr. <%= @recipient %>
And if the recipient was given as "david@loudthinking.com", the email
generated would look like this:
Date: Sun, 12 Dec 2004 00:00:00 +0100
From: system@loudthinking.com
To: david@loudthinking.com
Subject: [Signed up] Welcome david@loudthinking.com
Hello there,
Mr. david@loudthinking.com
You never actually call the instance methods like signed_up directly. Instead,
you call class methods like deliver_* and create_* that are automatically
created for each instance method. So if the signed_up method sat on
ApplicationMailer, it would look like this:
ApplicationMailer.create_signed_up("david@loudthinking.com") # => tmail object for testing
ApplicationMailer.deliver_signed_up("david@loudthinking.com") # sends the email
ApplicationMailer.new.signed_up("david@loudthinking.com") # won't work!
== Receiving emails
To receive emails, you need to implement a public instance method called receive that takes a
tmail object as its single parameter. The Action Mailer framework has a corresponding class method,
which is also called receive, that accepts a raw, unprocessed email as a string, which it then turns
into the tmail object and calls the receive instance method.
Example:
class Mailman < ActionMailer::Base
def receive(email)
page = Page.find_by_address(email.to.first)
page.emails.create(
:subject => email.subject, :body => email.body
)
if email.has_attachments?
for attachment in email.attachments
page.attachments.create({
:file => attachment, :description => email.subject
})
end
end
end
end
This Mailman can be the target for Postfix or other MTAs. In Rails, you would use the runner in the
trivial case like this:
./script/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
a limited number of email.
== Configuration
The Base class has the full list of configuration options. Here's an example:
ActionMailer::Base.smtp_settings = {
:address => 'smtp.yourserver.com', # default: localhost
:port => '25', # default: 25
:user_name => 'user',
:password => 'pass',
:authentication => :plain # :plain, :login or :cram_md5
}
== Dependencies
Action Mailer requires that the Action Pack is either available to be required immediately
or is accessible as a GEM.
== Bundled software
* tmail 0.10.8 by Minero Aoki released under LGPL
Read more on http://i.loveruby.net/en/prog/tmail.html
* Text::Format 0.63 by Austin Ziegler released under OpenSource
Read more on http://www.halostatue.ca/ruby/Text__Format.html
== Download
The latest version of Action Mailer can be found at
* http://rubyforge.org/project/showfiles.php?group_id=361
Documentation can be found at
* http://actionmailer.rubyonrails.org
== Installation
You can install Action Mailer with the following command.
% [sudo] ruby install.rb
from its distribution directory.
== License
Action Mailer is released under the MIT license.
== Support
The Action Mailer homepage is http://www.rubyonrails.org. You can find
the Action Mailer RubyForge page at http://rubyforge.org/projects/actionmailer.
And as Jim from Rake says:
Feel free to submit commits or feature requests. If you send a patch,
remember to update the corresponding unit tests. If fact, I prefer
new feature to be submitted in the form of new unit tests.

View File

@@ -1,147 +0,0 @@
= Action Mailer -- Easy email delivery and testing
Action Mailer is a framework for designing email-service layers. These layers
are used to consolidate code for sending out forgotten passwords, welcome
wishes on signup, invoices for billing, and any other use case that requires
a written notification to either a person or another system.
Action Mailer is in essence a wrapper around Action Controller and the
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
have been sent from a phone).
== Sending emails
The framework works by initializing any instance variables you want to be
available in the email template, followed by a call to +mail+ to deliver
the email.
This can be as simple as:
class Notifier < ActionMailer::Base
delivers_from 'system@loudthinking.com'
def welcome(recipient)
@recipient = recipient
mail(:to => recipient,
:subject => "[Signed up] Welcome #{recipient}")
end
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.
So the corresponding body template for the method above could look like this:
Hello there,
Mr. <%= @recipient %>
Thank you for signing up!
And if the recipient was given as "david@loudthinking.com", the email
generated would look like this:
Date: Mon, 25 Jan 2010 22:48:09 +1100
From: system@loudthinking.com
To: david@loudthinking.com
Message-ID: <4b5d84f9dd6a5_7380800b81ac29578@void.loudthinking.com.mail>
Subject: [Signed up] Welcome david@loudthinking.com
Mime-Version: 1.0
Content-Type: text/plain;
charset="US-ASCII";
Content-Transfer-Encoding: 7bit
Hello there,
Mr. david@loudthinking.com
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.
Calling the method returns a Mail Message object:
message = Notifier.welcome # => Returns a Mail::Message object
message.deliver # => delivers the email
Or you can just chain the methods together like:
Notifier.welcome.deliver # Creates the email and sends it immediately
== 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,
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.
Example:
class Mailman < ActionMailer::Base
def receive(email)
page = Page.find_by_address(email.to.first)
page.emails.create(
:subject => email.subject, :body => email.body
)
if email.has_attachments?
for attachment in email.attachments
page.attachments.create({
:file => attachment, :description => email.subject
})
end
end
end
end
This Mailman can be the target for Postfix or other MTAs. In Rails, you would use the runner in the
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
a limited number of email.
== Configuration
The Base class has the full list of configuration options. Here's an example:
ActionMailer::Base.smtp_settings = {
:address => 'smtp.yourserver.com', # default: localhost
:port => '25', # default: 25
:user_name => 'user',
:password => 'pass',
:authentication => :plain # :plain, :login or :cram_md5
}
== Download and installation
The latest version of Action Mailer can be installed with Rubygems:
% [sudo] gem install actionmailer
Source code can be downloaded as part of the Rails project on GitHub
* http://github.com/rails/rails/tree/master/actionmailer/
== License
Action Mailer is released under the MIT license.
== Support
API documentation is at
* http://api.rubyonrails.com
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

View File

@@ -1,7 +1,20 @@
require 'rubygems'
require 'rake'
require 'rake/testtask'
require 'rdoc/task'
require 'rake/packagetask'
require 'rubygems/package_task'
require File.join(File.dirname(__FILE__), 'lib', 'action_mailer', 'version')
PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
PKG_NAME = 'actionmailer'
PKG_VERSION = ActionMailer::VERSION::STRING + PKG_BUILD
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
RELEASE_NAME = "REL #{PKG_VERSION}"
RUBY_FORGE_PROJECT = "actionmailer"
RUBY_FORGE_USER = "webster132"
desc "Default Task"
task :default => [ :test ]
@@ -9,28 +22,76 @@ task :default => [ :test ]
# Run the unit tests
Rake::TestTask.new { |t|
t.libs << "test"
t.pattern = 'test/**/*_test.rb'
t.warning = true
t.pattern = 'test/*_test.rb'
t.verbose = true
t.warning = false
}
namespace :test do
task :isolated do
ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
Dir.glob("test/**/*_test.rb").all? do |file|
sh(ruby, '-Ilib:test', file)
end or raise "Failures"
end
# Generate the RDoc documentation
RDoc::Task.new { |rdoc|
rdoc.rdoc_dir = 'doc'
rdoc.title = "Action Mailer -- Easy email delivery and testing"
rdoc.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object'
rdoc.options << '--charset' << 'utf-8'
rdoc.template = ENV['template'] ? "#{ENV['template']}.rb" : '../doc/template/horo'
rdoc.rdoc_files.include('README', 'CHANGELOG')
rdoc.rdoc_files.include('lib/action_mailer.rb')
rdoc.rdoc_files.include('lib/action_mailer/*.rb')
}
# Create compressed packages
spec = Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = PKG_NAME
s.summary = "Service layer for easy email delivery and testing."
s.description = %q{Makes it trivial to test and deliver emails sent from a single service layer.}
s.version = PKG_VERSION
s.author = "David Heinemeier Hansson"
s.email = "david@loudthinking.com"
s.rubyforge_project = "actionmailer"
s.homepage = "http://www.rubyonrails.org"
s.add_dependency('actionpack', '= 2.3.14' + PKG_BUILD)
s.requirements << 'none'
s.require_path = 'lib'
s.files = [ "Rakefile", "install.rb", "README", "CHANGELOG", "MIT-LICENSE" ]
s.files = s.files + Dir.glob( "lib/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
s.files = s.files + Dir.glob( "test/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
end
spec = eval(File.read('actionmailer.gemspec'))
Gem::PackageTask.new(spec) do |p|
p.gem_spec = spec
p.need_tar = true
p.need_zip = true
end
desc "Release to gemcutter"
task :release => :package do
require 'rake/gemcutter'
Rake::Gemcutter::Tasks.new(spec).define
Rake::Task['gem:push'].invoke
desc "Publish the API documentation"
task :pgem => [:package] do
require 'rake/contrib/sshpublisher'
Rake::SshFilePublisher.new("gems.rubyonrails.org", "/u/sites/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
`ssh gems.rubyonrails.org '/u/sites/gems/gemupdate.sh'`
end
desc "Publish the API documentation"
task :pdoc => [:rdoc] do
require 'rake/contrib/sshpublisher'
Rake::SshDirPublisher.new("wrath.rubyonrails.org", "public_html/am", "doc").upload
end
desc "Publish the release files to RubyForge."
task :release => [ :package ] do
require 'rubyforge'
require 'rake/contrib/rubyforgepublisher'
packages = %w( gem tgz zip ).collect{ |ext| "pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}" }
rubyforge = RubyForge.new
rubyforge.login
rubyforge.add_release(PKG_NAME, PKG_NAME, "REL #{PKG_VERSION}", *packages)
end

View File

@@ -1,22 +0,0 @@
version = File.read(File.expand_path("../../RAILS_VERSION", __FILE__)).strip
Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = 'actionmailer'
s.version = version
s.summary = 'Email composition, delivery, and receiving framework (part of Rails).'
s.description = 'Email on Rails. Compose, deliver, receive, and test emails using the familiar controller/view pattern. First-class support for multipart email and attachments.'
s.required_ruby_version = '>= 1.8.7'
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.require_path = 'lib'
s.requirements << 'none'
s.add_dependency('actionpack', version)
s.add_dependency('mail', '~> 2.2')
end

30
actionmailer/install.rb Normal file
View File

@@ -0,0 +1,30 @@
require 'rbconfig'
require 'find'
require 'ftools'
include Config
# this was adapted from rdoc's install.rb by way of Log4r
$sitedir = CONFIG["sitelibdir"]
unless $sitedir
version = CONFIG["MAJOR"] + "." + CONFIG["MINOR"]
$libdir = File.join(CONFIG["libdir"], "ruby", version)
$sitedir = $:.find {|x| x =~ /site_ruby/ }
if !$sitedir
$sitedir = File.join($libdir, "site_ruby")
elsif $sitedir !~ Regexp.quote(version)
$sitedir = File.join($sitedir, version)
end
end
# the actual gruntwork
Dir.chdir("lib")
Find.find("action_mailer", "action_mailer.rb") { |f|
if f[-3..-1] == ".rb"
File::install(f, File.join($sitedir, *f.split(/\//)), 0644, true)
else
File::makedirs(File.join($sitedir, *f.split(/\//)))
end
}

View File

@@ -21,32 +21,40 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++
actionpack_path = File.expand_path('../../../actionpack/lib', __FILE__)
$:.unshift(actionpack_path) if File.directory?(actionpack_path) && !$:.include?(actionpack_path)
begin
require 'action_controller'
rescue LoadError
actionpack_path = "#{File.dirname(__FILE__)}/../../actionpack/lib"
if File.directory?(actionpack_path)
$:.unshift actionpack_path
require 'action_controller'
end
end
require 'abstract_controller'
require 'action_view'
require 'action_mailer/version'
# Common Active Support usage in Action Mailer
require 'active_support/core_ext/class'
require 'active_support/core_ext/object/blank'
require 'active_support/core_ext/array/uniq_by'
require 'active_support/core_ext/module/attr_internal'
require 'active_support/core_ext/module/delegation'
require 'active_support/core_ext/string/inflections'
require 'active_support/lazy_load_hooks'
module ActionMailer
extend ::ActiveSupport::Autoload
def self.load_all!
[Base, Part, ::Text::Format, ::Net::SMTP]
end
autoload :AdvAttrAccessor
autoload :Collector
autoload :Base
autoload :DeliveryMethods
autoload :DeprecatedApi
autoload :MailHelper
autoload :OldApi
autoload :TestCase
autoload :TestHelper
autoload :AdvAttrAccessor, 'action_mailer/adv_attr_accessor'
autoload :Base, 'action_mailer/base'
autoload :Helpers, 'action_mailer/helpers'
autoload :Part, 'action_mailer/part'
autoload :PartContainer, 'action_mailer/part_container'
autoload :Quoting, 'action_mailer/quoting'
autoload :TestCase, 'action_mailer/test_case'
autoload :TestHelper, 'action_mailer/test_helper'
autoload :Utils, 'action_mailer/utils'
end
module Text
autoload :Format, 'action_mailer/vendor/text_format'
end
module Net
autoload :SMTP, 'net/smtp'
end
autoload :MailHelper, 'action_mailer/mail_helper'

View File

@@ -1,25 +1,29 @@
module ActionMailer
module AdvAttrAccessor #:nodoc:
def adv_attr_accessor(*names)
names.each do |name|
ivar = "@#{name}"
def self.included(base)
base.extend(ClassMethods)
end
class_eval <<-ACCESSORS, __FILE__, __LINE__ + 1
def #{name}=(value)
#{ivar} = value
module ClassMethods #:nodoc:
def adv_attr_accessor(*names)
names.each do |name|
ivar = "@#{name}"
define_method("#{name}=") do |value|
instance_variable_set(ivar, value)
end
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})
define_method(name) do |*parameters|
raise ArgumentError, "expected 0 or 1 parameters" unless parameters.length <= 1
if parameters.empty?
if instance_variable_names.include?(ivar)
instance_variable_get(ivar)
end
else
#{ivar} = args.first
instance_variable_set(ivar, parameters.first)
end
end
ACCESSORS
self.protected_instance_variables << ivar if self.respond_to?(:protected_instance_variables)
end
end
end
end

File diff suppressed because it is too large Load Diff

View File

@@ -1,30 +0,0 @@
require 'abstract_controller/collector'
require 'active_support/core_ext/hash/reverse_merge'
require 'active_support/core_ext/array/extract_options'
module ActionMailer #:nodoc:
class Collector
include AbstractController::Collector
attr_reader :responses
def initialize(context, &block)
@context = context
@responses = []
@default_render = block
end
def any(*args, &block)
options = args.extract_options!
raise "You have to supply at least one format" if args.empty?
args.each { |type| send(type, options.dup, &block) }
end
alias :all :any
def custom(mime, options={})
options.reverse_merge!(:content_type => mime.to_s)
@context.freeze_formats([mime.to_sym])
options[:body] = block_given? ? yield : @default_render.call
@responses << options
end
end
end

View File

@@ -1,86 +0,0 @@
require 'tmpdir'
module ActionMailer
# This modules handles everything related to the delivery, from registering new
# delivery methods to configuring the mail object to be sent.
module DeliveryMethods
extend ActiveSupport::Concern
included do
class_attribute :delivery_methods, :delivery_method
# Do not make this inheritable, because we always want it to propagate
cattr_accessor :raise_delivery_errors
self.raise_delivery_errors = true
cattr_accessor :perform_deliveries
self.perform_deliveries = true
self.delivery_methods = {}.freeze
self.delivery_method = :smtp
add_delivery_method :smtp, Mail::SMTP,
:address => "localhost",
:port => 25,
:domain => 'localhost.localdomain',
:user_name => nil,
:password => nil,
:authentication => nil,
:enable_starttls_auto => true
add_delivery_method :file, Mail::FileDelivery,
:location => defined?(Rails.root) ? "#{Rails.root}/tmp/mails" : "#{Dir.tmpdir}/mails"
add_delivery_method :sendmail, Mail::Sendmail,
:location => '/usr/sbin/sendmail',
:arguments => '-i -t'
add_delivery_method :test, Mail::TestMailer
end
module ClassMethods
# Provides a list of emails that have been delivered by Mail::TestMailer
delegate :deliveries, :deliveries=, :to => Mail::TestMailer
# Adds a new delivery method through the given class using the given symbol
# as alias and the default options supplied:
#
# Example:
#
# add_delivery_method :sendmail, Mail::Sendmail,
# :location => '/usr/sbin/sendmail',
# :arguments => '-i -t'
#
def add_delivery_method(symbol, klass, default_options={})
class_attribute(:"#{symbol}_settings") unless respond_to?(:"#{symbol}_settings")
send(:"#{symbol}_settings=", default_options)
self.delivery_methods = delivery_methods.merge(symbol.to_sym => klass).freeze
end
def wrap_delivery_behavior(mail, method=nil) #:nodoc:
method ||= self.delivery_method
mail.delivery_handler = self
case method
when NilClass
raise "Delivery method cannot be nil"
when Symbol
if klass = delivery_methods[method.to_sym]
mail.delivery_method(klass, send(:"#{method}_settings"))
else
raise "Invalid delivery method #{method.inspect}"
end
else
mail.delivery_method(method)
end
mail.perform_deliveries = perform_deliveries
mail.raise_delivery_errors = raise_delivery_errors
end
end
def wrap_delivery_behavior!(*args) #:nodoc:
self.class.wrap_delivery_behavior(message, *args)
end
end
end

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

@@ -0,0 +1,113 @@
require 'active_support/dependencies'
module ActionMailer
module Helpers #:nodoc:
def self.included(base) #:nodoc:
# Initialize the base module to aggregate its helpers.
base.class_inheritable_accessor :master_helper_module
base.master_helper_module = Module.new
# Extend base with class methods to declare helpers.
base.extend(ClassMethods)
base.class_eval do
# Wrap inherited to create a new master helper module for subclasses.
class << self
alias_method_chain :inherited, :helper
end
# Wrap initialize_template_class to extend new template class
# instances with the master helper module.
alias_method_chain :initialize_template_class, :helper
end
end
module ClassMethods
# Makes all the (instance) methods in the helper module available to templates rendered through this controller.
# See ActionView::Helpers (link:classes/ActionView/Helpers.html) for more about making your own helper modules
# available to the templates.
def add_template_helper(helper_module) #:nodoc:
master_helper_module.module_eval "include #{helper_module}"
end
# Declare a helper:
# helper :foo
# requires 'foo_helper' and includes FooHelper in the template class.
# helper FooHelper
# includes FooHelper in the template class.
# helper { def foo() "#{bar} is the very best" end }
# evaluates the block in the template class, adding method +foo+.
# helper(:three, BlindHelper) { def mice() 'mice' end }
# does all three.
def helper(*args, &block)
args.flatten.each do |arg|
case arg
when Module
add_template_helper(arg)
when String, Symbol
file_name = arg.to_s.underscore + '_helper'
class_name = file_name.camelize
begin
require_dependency(file_name)
rescue LoadError => load_error
requiree = / -- (.*?)(\.rb)?$/.match(load_error.message).to_a[1]
msg = (requiree == file_name) ? "Missing helper file helpers/#{file_name}.rb" : "Can't load file: #{requiree}"
raise LoadError.new(msg).copy_blame!(load_error)
end
add_template_helper(class_name.constantize)
else
raise ArgumentError, 'helper expects String, Symbol, or Module argument'
end
end
# Evaluate block in template class if given.
master_helper_module.module_eval(&block) if block_given?
end
# Declare a controller method as a helper. For example,
# helper_method :link_to
# def link_to(name, options) ... end
# makes the link_to controller method available in the view.
def helper_method(*methods)
methods.flatten.each do |method|
master_helper_module.module_eval <<-end_eval
def #{method}(*args, &block)
controller.__send__(%(#{method}), *args, &block)
end
end_eval
end
end
# Declare a controller attribute as a helper. For example,
# helper_attr :name
# attr_accessor :name
# makes the name and name= controller methods available in the view.
# The is a convenience wrapper for helper_method.
def helper_attr(*attrs)
attrs.flatten.each { |attr| helper_method(attr, "#{attr}=") }
end
private
def inherited_with_helper(child)
inherited_without_helper(child)
begin
child.master_helper_module = Module.new
child.master_helper_module.__send__(:include, master_helper_module)
child.helper child.name.to_s.underscore
rescue MissingSourceFile => e
raise unless e.is_missing?("helpers/#{child.name.to_s.underscore}_helper")
end
end
end
private
# Extend the template class instance with our controller's helper module.
def initialize_template_class_with_helper(assigns)
initialize_template_class_without_helper(assigns).tap do |template|
template.extend self.class.master_helper_module
end
end
end
end

View File

@@ -1,22 +0,0 @@
require 'active_support/core_ext/array/wrap'
module ActionMailer
class LogSubscriber < ActiveSupport::LogSubscriber
def deliver(event)
recipients = Array.wrap(event.payload[:to]).join(', ')
info("\nSent mail to #{recipients} (%1.fms)" % event.duration)
debug(event.payload[:mail])
end
def receive(event)
info("\nReceived mail (%.1fms)" % event.duration)
debug(event.payload[:mail])
end
def logger
ActionMailer::Base.logger
end
end
end
ActionMailer::LogSubscriber.attach_to :action_mailer

View File

@@ -1,49 +1,17 @@
module ActionMailer
module MailHelper
# Uses Text::Format to take the text and format it, indented two spaces for
# each line, and wrapped at 72 columns.
def block_format(text)
formatted = text.split(/\n\r\n/).collect { |paragraph|
simple_format(paragraph)
}.join("\n")
module MailHelper
# Uses Text::Format to take the text and format it, indented two spaces for
# each line, and wrapped at 72 columns.
def block_format(text)
formatted = text.split(/\n\r\n/).collect { |paragraph|
Text::Format.new(
:columns => 72, :first_indent => 2, :body_indent => 2, :text => paragraph
).format
}.join("\n")
# Make list points stand on their own line
formatted.gsub!(/[ ]*([*]+) ([^*]*)/) { |s| " #{$1} #{$2.strip}\n" }
formatted.gsub!(/[ ]*([#]+) ([^#]*)/) { |s| " #{$1} #{$2.strip}\n" }
# Make list points stand on their own line
formatted.gsub!(/[ ]*([*]+) ([^*]*)/) { |s| " #{$1} #{$2.strip}\n" }
formatted.gsub!(/[ ]*([#]+) ([^#]*)/) { |s| " #{$1} #{$2.strip}\n" }
formatted
end
# Access the mailer instance.
def mailer
@_controller
end
# Access the message instance.
def message
@_message
end
# Access the message attachments list.
def attachments
@_message.attachments
end
private
def simple_format(text, len = 72, indent = 2)
sentences = [[]]
text.split.each do |word|
if (sentences.last + [word]).join(' ').length > len
sentences << [word]
else
sentences.last << word
end
end
sentences.map { |sentence|
"#{" " * indent}#{sentence.join(' ')}"
}.join "\n"
end
formatted
end
end

View File

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

View File

@@ -0,0 +1,107 @@
module ActionMailer
# Represents a subpart of an email message. It shares many similar
# attributes of ActionMailer::Base. Although you can create parts manually
# and add them to the +parts+ list of the mailer, it is easier
# to use the helper methods in ActionMailer::PartContainer.
class Part
include AdvAttrAccessor, PartContainer, Utils
# Represents the body of the part, as a string. This should not be a
# Hash (like ActionMailer::Base), but if you want a template to be rendered
# into the body of a subpart you can do it with the mailer's +render+ method
# and assign the result here.
adv_attr_accessor :body
# Specify the charset for this subpart. By default, it will be the charset
# of the containing part or mailer.
adv_attr_accessor :charset
# The content disposition of this part, typically either "inline" or
# "attachment".
adv_attr_accessor :content_disposition
# The content type of the part.
adv_attr_accessor :content_type
# The filename to use for this subpart (usually for attachments).
adv_attr_accessor :filename
# Accessor for specifying additional headers to include with this part.
adv_attr_accessor :headers
# The transfer encoding to use for this subpart, like "base64" or
# "quoted-printable".
adv_attr_accessor :transfer_encoding
# Create a new part from the given +params+ hash. The valid params keys
# correspond to the accessors.
def initialize(params)
@content_type = params[:content_type]
@content_disposition = params[:disposition] || "inline"
@charset = params[:charset]
@body = params[:body]
@filename = params[:filename]
@transfer_encoding = params[:transfer_encoding] || "quoted-printable"
@headers = params[:headers] || {}
@parts = []
end
# Convert the part to a mail object which can be included in the parts
# list of another mail object.
def to_mail(defaults)
part = TMail::Mail.new
real_content_type, ctype_attrs = parse_content_type(defaults)
if @parts.empty?
part.content_transfer_encoding = transfer_encoding || "quoted-printable"
case (transfer_encoding || "").downcase
when "base64" then
part.body = TMail::Base64.folding_encode(body)
when "quoted-printable"
part.body = [normalize_new_lines(body)].pack("M*")
else
part.body = body
end
# Always set the content_type after setting the body and or parts!
# Also don't set filename and name when there is none (like in
# non-attachment parts)
if content_disposition == "attachment"
ctype_attrs.delete "charset"
part.set_content_type(real_content_type, nil,
squish("name" => filename).merge(ctype_attrs))
part.set_content_disposition(content_disposition,
squish("filename" => filename).merge(ctype_attrs))
else
part.set_content_type(real_content_type, nil, ctype_attrs)
part.set_content_disposition(content_disposition)
end
else
if String === body
@parts.unshift Part.new(:charset => charset, :body => @body, :content_type => 'text/plain')
@body = nil
end
@parts.each do |p|
prt = (TMail::Mail === p ? p : p.to_mail(defaults))
part.parts << prt
end
if real_content_type =~ /multipart/
ctype_attrs.delete 'charset'
part.set_content_type(real_content_type, nil, ctype_attrs)
end
end
headers.each { |k,v| part[k] = v }
part
end
private
def squish(values={})
values.delete_if { |k,v| v.nil? }
end
end
end

View File

@@ -0,0 +1,55 @@
module ActionMailer
# Accessors and helpers that ActionMailer::Base and ActionMailer::Part have
# in common. Using these helpers you can easily add subparts or attachments
# to your message:
#
# def my_mail_message(...)
# ...
# part "text/plain" do |p|
# p.body "hello, world"
# p.transfer_encoding "base64"
# end
#
# attachment "image/jpg" do |a|
# a.body = File.read("hello.jpg")
# a.filename = "hello.jpg"
# end
# end
module PartContainer
# The list of subparts of this container
attr_reader :parts
# Add a part to a multipart message, with the given content-type. The
# part itself is yielded to the block so that other properties (charset,
# body, headers, etc.) can be set on it.
def part(params)
params = {:content_type => params} if String === params
part = Part.new(params)
yield part if block_given?
@parts << part
end
# Add an attachment to a multipart message. This is simply a part with the
# content-disposition set to "attachment".
def attachment(params, &block)
params = { :content_type => params } if String === params
params = { :disposition => "attachment",
:transfer_encoding => "base64" }.merge(params)
part(params, &block)
end
private
def parse_content_type(defaults=nil)
if content_type.blank?
return defaults ?
[ defaults.content_type, { 'charset' => defaults.charset } ] :
[ nil, {} ]
end
ctype, *attrs = content_type.split(/;\s*/)
attrs = attrs.inject({}) { |h,s| k,v = s.split(/=/, 2); h[k] = v; h }
[ctype, {"charset" => charset || defaults && defaults.charset}.merge(attrs)]
end
end
end

View File

@@ -0,0 +1,62 @@
# encoding: us-ascii
module ActionMailer
module Quoting #:nodoc:
# Convert the given text into quoted printable format, with an instruction
# that the text be eventually interpreted in the given charset.
def quoted_printable(text, charset)
text = text.gsub( /[^a-z ]/i ) { quoted_printable_encode($&) }.
gsub( / /, "_" )
"=?#{charset}?Q?#{text}?="
end
# Convert the given character to quoted printable format, taking into
# account multi-byte characters (if executing with $KCODE="u", for instance)
def quoted_printable_encode(character)
result = ""
character.each_byte { |b| result << "=%02X" % b }
result
end
# A quick-and-dirty regexp for determining whether a string contains any
# characters that need escaping.
if !defined?(CHARS_NEEDING_QUOTING)
CHARS_NEEDING_QUOTING = /[\000-\011\013\014\016-\037\177-\377]/
end
# Quote the given text if it contains any "illegal" characters
def quote_if_necessary(text, charset)
text = text.dup.force_encoding(Encoding::ASCII_8BIT) if text.respond_to?(:force_encoding)
(text =~ CHARS_NEEDING_QUOTING) ?
quoted_printable(text, charset) :
text
end
# Quote any of the given strings if they contain any "illegal" characters
def quote_any_if_necessary(charset, *args)
args.map { |v| quote_if_necessary(v, charset) }
end
# Quote the given address if it needs to be. The address may be a
# regular email address, or it can be a phrase followed by an address in
# brackets. The phrase is the only part that will be quoted, and only if
# it needs to be. This allows extended characters to be used in the
# "to", "from", "cc", "bcc" and "reply-to" headers.
def quote_address_if_necessary(address, charset)
if Array === address
address.map { |a| quote_address_if_necessary(a, charset) }
elsif address =~ /^(\S.*)\s+(<.*>)$/
address = $2
phrase = quote_if_necessary($1.gsub(/^['"](.*)['"]$/, '\1'), charset)
"\"#{phrase}\" #{address}"
else
address
end
end
# Quote any of the given addresses, if they need to be.
def quote_any_address_if_necessary(charset, *args)
args.map { |v| quote_address_if_necessary(v, charset) }
end
end
end

View File

@@ -1,30 +0,0 @@
require "action_mailer"
require "rails"
module ActionMailer
class Railtie < Rails::Railtie
config.action_mailer = ActiveSupport::OrderedOptions.new
initializer "action_mailer.logger" do
ActiveSupport.on_load(:action_mailer) { self.logger ||= Rails.logger }
end
initializer "action_mailer.set_configs" do |app|
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
ActiveSupport.on_load(:action_mailer) do
include app.routes.url_helpers
register_interceptors(options.delete(:interceptors))
register_observers(options.delete(:observers))
options.each { |k,v| send("#{k}=", v) }
end
end
end
end

View File

@@ -1,3 +1,5 @@
require 'active_support/test_case'
module ActionMailer
class NonInferrableMailerError < ::StandardError
def initialize(name)
@@ -8,69 +10,55 @@ module ActionMailer
end
class TestCase < ActiveSupport::TestCase
module Behavior
extend ActiveSupport::Concern
include Quoting, TestHelper
include TestHelper
setup :initialize_test_deliveries
setup :set_expected_mail
module ClassMethods
def tests(mailer)
write_inheritable_attribute(:mailer_class, mailer)
end
class << self
def tests(mailer)
write_inheritable_attribute(:mailer_class, mailer)
end
def mailer_class
if mailer = read_inheritable_attribute(:mailer_class)
mailer
else
tests determine_default_mailer(name)
end
end
def determine_default_mailer(name)
name.sub(/Test$/, '').constantize
rescue NameError
raise NonInferrableMailerError.new(name)
def mailer_class
if mailer = read_inheritable_attribute(:mailer_class)
mailer
else
tests determine_default_mailer(name)
end
end
module InstanceMethods
protected
def initialize_test_deliveries
ActionMailer::Base.delivery_method = :test
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.deliveries.clear
end
def set_expected_mail
@expected = Mail.new
@expected.content_type ["text", "plain", { "charset" => charset }]
@expected.mime_version = '1.0'
end
private
def charset
"UTF-8"
end
def encode(subject)
Mail::Encodings.q_value_encode(subject, charset)
end
def read_fixture(action)
IO.readlines(File.join(Rails.root, 'test', 'fixtures', self.class.mailer_class.name.underscore, action))
end
end
included do
setup :initialize_test_deliveries
setup :set_expected_mail
def determine_default_mailer(name)
name.sub(/Test$/, '').constantize
rescue NameError => e
raise NonInferrableMailerError.new(name)
end
end
include Behavior
protected
def initialize_test_deliveries
ActionMailer::Base.delivery_method = :test
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.deliveries = []
end
def set_expected_mail
@expected = TMail::Mail.new
@expected.set_content_type "text", "plain", { "charset" => charset }
@expected.mime_version = '1.0'
end
private
def charset
"utf-8"
end
def encode(subject)
quoted_printable(subject, charset)
end
def read_fixture(action)
IO.readlines(File.join(RAILS_ROOT, 'test', 'fixtures', self.class.mailer_class.name.underscore, action))
end
end
end

View File

@@ -1,7 +1,5 @@
module ActionMailer
module TestHelper
extend ActiveSupport::Concern
# Asserts that the number of emails sent matches the given number.
#
# def test_emails
@@ -59,3 +57,12 @@ module ActionMailer
end
end
end
# TODO: Deprecate this
module Test
module Unit
class TestCase
include ActionMailer::TestHelper
end
end
end

View File

@@ -1,34 +0,0 @@
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])
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])
content_transfer_encoding(value)
else
old_transfer_encoding
end
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])
self.content_transfer_encoding = value
end
def original_filename
ActiveSupport::Deprecation.warn('Message#original_filename is deprecated, ' <<
'please call Message#filename', caller[0,2])
filename
end
end
end

View File

@@ -0,0 +1,7 @@
module ActionMailer
module Utils #:nodoc:
def normalize_new_lines(text)
text.to_s.gsub(/\r\n?/, "\n")
end
end
end

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,10 @@
# Prefer gems to the bundled libs.
require 'rubygems'
begin
gem 'text-format', '>= 0.6.3'
rescue Gem::LoadError
$:.unshift "#{File.dirname(__FILE__)}/text-format-0.6.3"
end
require 'text/format'

View File

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

View File

@@ -0,0 +1,2 @@
require 'action_mailer'
ActiveSupport::Deprecation.warn 'require "actionmailer" is deprecated and will be removed in Rails 3. Use require "action_mailer" instead.'

View File

@@ -1,16 +0,0 @@
module Rails
module Generators
class MailerGenerator < NamedBase
source_root File.expand_path("../templates", __FILE__)
argument :actions, :type => :array, :default => [], :banner => "method method"
check_class_collision
def create_mailer_file
template "mailer.rb", File.join('app/mailers', class_path, "#{file_name}.rb")
end
hook_for :template_engine, :test_framework
end
end
end

View File

@@ -1,16 +0,0 @@
class <%= class_name %> < ActionMailer::Base
default :from => "from@example.com"
<% for action in actions -%>
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.<%= file_path.gsub("/",".") %>.<%= action %>.subject
#
def <%= action %>
@greeting = "Hi"
mail :to => "to@example.org"
end
<% end -%>
end

View File

@@ -1,37 +1,9 @@
# Pathname has a warning, so require it first while silencing
# warnings to shut it up.
#
# Also, in 1.9, Bundler creates warnings due to overriding
# Rubygems methods
begin
old, $VERBOSE = $VERBOSE, nil
require 'pathname'
require File.expand_path('../../../load_paths', __FILE__)
ensure
$VERBOSE = old
end
require 'active_support/core_ext/kernel/reporting'
require 'active_support/core_ext/string/encoding'
if "ruby".encoding_aware?
# These are the normal settings that will be set up by Railties
# TODO: Have these tests support other combinations of these values
silence_warnings do
Encoding.default_internal = "UTF-8"
Encoding.default_external = "UTF-8"
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)
require 'rubygems'
require 'test/unit'
$:.unshift File.expand_path('../../lib', __FILE__)
$:.unshift File.expand_path('../../../activesupport/lib', __FILE__)
$:.unshift File.expand_path('../../../actionpack/lib', __FILE__)
require 'action_mailer'
require 'action_mailer/test_case'
@@ -42,8 +14,11 @@ ActiveSupport::Deprecation.debug = true
ActionView::Template.register_template_handler :haml, lambda { |template| "Look its HAML!".inspect }
ActionView::Template.register_template_handler :bak, lambda { |template| "Lame backup".inspect }
FIXTURE_LOAD_PATH = File.expand_path('fixtures', File.dirname(__FILE__))
ActionMailer::Base.view_paths = FIXTURE_LOAD_PATH
$:.unshift "#{File.dirname(__FILE__)}/fixtures/helpers"
ActionView::Base.cache_template_loading = true
FIXTURE_LOAD_PATH = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures'))
ActionMailer::Base.template_root = FIXTURE_LOAD_PATH
class MockSMTP
def self.deliveries
@@ -69,9 +44,17 @@ class Net::SMTP
end
end
def set_delivery_method(method)
def uses_gem(gem_name, test_name, version = '> 0')
gem gem_name.to_s, version
require gem_name.to_s
yield
rescue LoadError
$stderr.puts "Skipping #{test_name} tests. `gem install #{gem_name}` and try again."
end
def set_delivery_method(delivery_method)
@old_delivery_method = ActionMailer::Base.delivery_method
ActionMailer::Base.delivery_method = method
ActionMailer::Base.delivery_method = delivery_method
end
def restore_delivery_method

View File

@@ -0,0 +1,54 @@
require 'abstract_unit'
class AssetHostMailer < ActionMailer::Base
def email_with_asset(recipient)
recipients recipient
subject "testing email containing asset path while asset_host is set"
from "tester@example.com"
end
end
class AssetHostTest < Test::Unit::TestCase
def setup
set_delivery_method :test
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.deliveries = []
@recipient = 'test@localhost'
end
def teardown
restore_delivery_method
end
def test_asset_host_as_string
ActionController::Base.asset_host = "http://www.example.com"
mail = AssetHostMailer.deliver_email_with_asset(@recipient)
assert_equal "<img alt=\"Somelogo\" src=\"http://www.example.com/images/somelogo.png\" />", mail.body.strip
end
def test_asset_host_as_one_arguement_proc
ActionController::Base.asset_host = Proc.new { |source|
if source.starts_with?('/images')
"http://images.example.com"
else
"http://assets.example.com"
end
}
mail = AssetHostMailer.deliver_email_with_asset(@recipient)
assert_equal "<img alt=\"Somelogo\" src=\"http://images.example.com/images/somelogo.png\" />", mail.body.strip
end
def test_asset_host_as_two_arguement_proc
ActionController::Base.asset_host = Proc.new {|source,request|
if request && request.ssl?
"https://www.example.com"
else
"http://www.example.com"
end
}
mail = nil
assert_nothing_raised { mail = AssetHostMailer.deliver_email_with_asset(@recipient) }
assert_equal "<img alt=\"Somelogo\" src=\"http://www.example.com/images/somelogo.png\" />", mail.body.strip
end
end

View File

@@ -1,605 +0,0 @@
# encoding: utf-8
require 'abstract_unit'
require 'active_support/time'
require 'mailers/base_mailer'
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
end
test "method call to mail does not raise error" do
assert_nothing_raised { BaseMailer.welcome }
end
# Basic mail usage without block
test "mail() should set the headers of the mail message" do
email = BaseMailer.welcome
assert_equal(['system@test.lindsaar.net'], email.to)
assert_equal(['jose@test.plataformatec.com'], email.from)
assert_equal('The first email on new API!', email.subject)
end
test "mail() with from overwrites the class level default" do
email = BaseMailer.welcome(:from => 'someone@example.com',
:to => 'another@example.org')
assert_equal(['someone@example.com'], email.from)
assert_equal(['another@example.org'], email.to)
end
test "mail() with bcc, cc, content_type, charset, mime_version, reply_to and date" do
@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)
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)
end
test "mail() renders the template using the method being processed" do
email = BaseMailer.welcome
assert_equal("Welcome", email.body.encoded)
end
test "can pass in :body to the mail method hash" do
email = BaseMailer.welcome(:body => "Hello there")
assert_equal("text/plain", email.mime_type)
assert_equal("Hello there", email.body.encoded)
end
test "should set template content type if mail has only one part" do
mail = BaseMailer.html_only
assert_equal('text/html', mail.mime_type)
mail = BaseMailer.plain_text_only
assert_equal('text/plain', mail.mime_type)
end
# Custom headers
test "custom headers" do
email = BaseMailer.welcome
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' }
mail = BaseMailer.welcome(hash)
assert_equal('SecretValue', mail['X-Special-Domain-Specific-Header'].decoded)
assert_equal('1234@mikel.me.com', mail['In-Reply-To'].decoded)
end
test "can pass random headers in as a hash to headers" do
hash = {'X-Special-Domain-Specific-Header' => "SecretValue",
'In-Reply-To' => '1234@mikel.me.com' }
mail = BaseMailer.welcome_with_headers(hash)
assert_equal('SecretValue', mail['X-Special-Domain-Specific-Header'].decoded)
assert_equal('1234@mikel.me.com', mail['In-Reply-To'].decoded)
end
# Attachments
test "attachment with content" do
email = BaseMailer.attachment_with_content
assert_equal(1, email.attachments.length)
assert_equal('invoice.pdf', email.attachments[0].filename)
assert_equal('This is test File content', email.attachments['invoice.pdf'].decoded)
end
test "attachment gets content type from filename" do
email = BaseMailer.attachment_with_content
assert_equal('invoice.pdf', email.attachments[0].filename)
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)
expected = "\312\213\254\232)b"
expected.force_encoding(Encoding::BINARY) if '1.9'.respond_to?(:force_encoding)
assert_equal expected, email.attachments['invoice.jpg'].decoded
end
test "attachment with hash using default mail encoding" do
email = BaseMailer.attachment_with_hash_default_encoding
assert_equal(1, email.attachments.length)
assert_equal('invoice.jpg', email.attachments[0].filename)
expected = "\312\213\254\232)b"
expected.force_encoding(Encoding::BINARY) if '1.9'.respond_to?(:force_encoding)
assert_equal expected, email.attachments['invoice.jpg'].decoded
end
test "sets mime type to multipart/mixed when attachment is included" do
email = BaseMailer.attachment_with_content
assert_equal(1, email.attachments.length)
assert_equal("multipart/mixed", email.mime_type)
end
test "adds the rendered template as part" do
email = BaseMailer.attachment_with_content
assert_equal(2, email.parts.length)
assert_equal("multipart/mixed", email.mime_type)
assert_equal("text/html", email.parts[0].mime_type)
assert_equal("Attachment with content", email.parts[0].body.encoded)
assert_equal("application/pdf", email.parts[1].mime_type)
assert_equal("VGhpcyBpcyB0ZXN0IEZpbGUgY29udGVudA==\r\n", email.parts[1].body.encoded)
end
test "adds the given :body as part" do
email = BaseMailer.attachment_with_content(:body => "I'm the eggman")
assert_equal(2, email.parts.length)
assert_equal("multipart/mixed", email.mime_type)
assert_equal("text/plain", email.parts[0].mime_type)
assert_equal("I'm the eggman", email.parts[0].body.encoded)
assert_equal("application/pdf", email.parts[1].mime_type)
assert_equal("VGhpcyBpcyB0ZXN0IEZpbGUgY29udGVudA==\r\n", email.parts[1].body.encoded)
end
test "can embed an inline attachment" do
email = BaseMailer.inline_attachment
# Need to call #encoded to force the JIT sort on parts
email.encoded
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("logo.png", email.parts[1].filename)
end
# Defaults values
test "uses default charset from class" do
with_default BaseMailer, :charset => "US-ASCII" do
email = BaseMailer.welcome
assert_equal("US-ASCII", email.charset)
email = BaseMailer.welcome(:charset => "iso-8559-1")
assert_equal("iso-8559-1", email.charset)
end
end
test "uses default content type from class" do
with_default BaseMailer, :content_type => "text/html" do
email = BaseMailer.welcome
assert_equal("text/html", email.mime_type)
email = BaseMailer.welcome(:content_type => "text/plain")
assert_equal("text/plain", email.mime_type)
end
end
test "uses default mime version from class" do
with_default BaseMailer, :mime_version => "2.0" do
email = BaseMailer.welcome
assert_equal("2.0", email.mime_version)
email = BaseMailer.welcome(:mime_version => "1.0")
assert_equal("1.0", email.mime_version)
end
end
test "uses random default headers from class" do
with_default BaseMailer, "X-Custom" => "Custom" do
email = BaseMailer.welcome
assert_equal("Custom", email["X-Custom"].decoded)
end
end
test "subject gets default from I18n" do
BaseMailer.default :subject => nil
email = BaseMailer.welcome(:subject => nil)
assert_equal "Welcome", email.subject
I18n.backend.store_translations('en', :base_mailer => {:welcome => {:subject => "New Subject!"}})
email = BaseMailer.welcome(:subject => nil)
assert_equal "New Subject!", email.subject
end
test "translations are scoped properly" do
I18n.backend.store_translations('en', :base_mailer => {:email_with_translations => {:greet_user => "Hello %{name}!"}})
email = BaseMailer.email_with_translations
assert_equal 'Hello lifo!', email.body.encoded
end
# Implicit multipart
test "implicit multipart" do
email = BaseMailer.implicit_multipart
assert_equal(2, email.parts.size)
assert_equal("multipart/alternative", email.mime_type)
assert_equal("text/plain", email.parts[0].mime_type)
assert_equal("TEXT Implicit Multipart", email.parts[0].body.encoded)
assert_equal("text/html", email.parts[1].mime_type)
assert_equal("HTML Implicit Multipart", email.parts[1].body.encoded)
end
test "implicit multipart with sort order" do
order = ["text/html", "text/plain"]
with_default BaseMailer, :parts_order => order do
email = BaseMailer.implicit_multipart
assert_equal("text/html", email.parts[0].mime_type)
assert_equal("text/plain", email.parts[1].mime_type)
email = BaseMailer.implicit_multipart(:parts_order => order.reverse)
assert_equal("text/plain", email.parts[0].mime_type)
assert_equal("text/html", email.parts[1].mime_type)
end
end
test "implicit multipart with attachments creates nested parts" do
email = BaseMailer.implicit_multipart(:attachments => true)
assert_equal("application/pdf", email.parts[0].mime_type)
assert_equal("multipart/alternative", email.parts[1].mime_type)
assert_equal("text/plain", email.parts[1].parts[0].mime_type)
assert_equal("TEXT Implicit Multipart", email.parts[1].parts[0].body.encoded)
assert_equal("text/html", email.parts[1].parts[1].mime_type)
assert_equal("HTML Implicit Multipart", email.parts[1].parts[1].body.encoded)
end
test "implicit multipart with attachments and sort order" do
order = ["text/html", "text/plain"]
with_default BaseMailer, :parts_order => order do
email = BaseMailer.implicit_multipart(:attachments => true)
assert_equal("application/pdf", email.parts[0].mime_type)
assert_equal("multipart/alternative", email.parts[1].mime_type)
assert_equal("text/plain", email.parts[1].parts[1].mime_type)
assert_equal("text/html", email.parts[1].parts[0].mime_type)
end
end
test "implicit multipart with default locale" do
email = BaseMailer.implicit_with_locale
assert_equal(2, email.parts.size)
assert_equal("multipart/alternative", email.mime_type)
assert_equal("text/plain", email.parts[0].mime_type)
assert_equal("Implicit with locale TEXT", email.parts[0].body.encoded)
assert_equal("text/html", email.parts[1].mime_type)
assert_equal("Implicit with locale EN HTML", email.parts[1].body.encoded)
end
test "implicit multipart with other locale" do
swap I18n, :locale => :pl do
email = BaseMailer.implicit_with_locale
assert_equal(2, email.parts.size)
assert_equal("multipart/alternative", email.mime_type)
assert_equal("text/plain", email.parts[0].mime_type)
assert_equal("Implicit with locale PL TEXT", email.parts[0].body.encoded)
assert_equal("text/html", email.parts[1].mime_type)
assert_equal("Implicit with locale HTML", email.parts[1].body.encoded)
end
end
test "implicit multipart with several view paths uses the first one with template" do
old = BaseMailer.view_paths
begin
BaseMailer.view_paths = [File.join(FIXTURE_LOAD_PATH, "another.path")] + old.dup
email = BaseMailer.welcome
assert_equal("Welcome from another path", email.body.encoded)
ensure
BaseMailer.view_paths = old
end
end
test "implicit multipart with inexistent templates uses the next view path" do
old = BaseMailer.view_paths
begin
BaseMailer.view_paths = [File.join(FIXTURE_LOAD_PATH, "unknown")] + old.dup
email = BaseMailer.welcome
assert_equal("Welcome", email.body.encoded)
ensure
BaseMailer.view_paths = old
end
end
# Explicit multipart
test "explicit multipart" do
email = BaseMailer.explicit_multipart
assert_equal(2, email.parts.size)
assert_equal("multipart/alternative", email.mime_type)
assert_equal("text/plain", email.parts[0].mime_type)
assert_equal("TEXT Explicit Multipart", email.parts[0].body.encoded)
assert_equal("text/html", email.parts[1].mime_type)
assert_equal("HTML Explicit Multipart", email.parts[1].body.encoded)
end
test "explicit multipart have a boundary" do
mail = BaseMailer.explicit_multipart
assert_not_nil(mail.content_type_parameters[:boundary])
end
test "explicit multipart does not sort order" do
order = ["text/html", "text/plain"]
with_default BaseMailer, :parts_order => order do
email = BaseMailer.explicit_multipart
assert_equal("text/plain", email.parts[0].mime_type)
assert_equal("text/html", email.parts[1].mime_type)
email = BaseMailer.explicit_multipart(:parts_order => order.reverse)
assert_equal("text/plain", email.parts[0].mime_type)
assert_equal("text/html", email.parts[1].mime_type)
end
end
test "explicit multipart with attachments creates nested parts" do
email = BaseMailer.explicit_multipart(:attachments => true)
assert_equal("application/pdf", email.parts[0].mime_type)
assert_equal("multipart/alternative", email.parts[1].mime_type)
assert_equal("text/plain", email.parts[1].parts[0].mime_type)
assert_equal("TEXT Explicit Multipart", email.parts[1].parts[0].body.encoded)
assert_equal("text/html", email.parts[1].parts[1].mime_type)
assert_equal("HTML Explicit Multipart", email.parts[1].parts[1].body.encoded)
end
test "explicit multipart with templates" do
email = BaseMailer.explicit_multipart_templates
assert_equal(2, email.parts.size)
assert_equal("multipart/alternative", email.mime_type)
assert_equal("text/html", email.parts[0].mime_type)
assert_equal("HTML Explicit Multipart Templates", email.parts[0].body.encoded)
assert_equal("text/plain", email.parts[1].mime_type)
assert_equal("TEXT Explicit Multipart Templates", email.parts[1].body.encoded)
end
test "explicit multipart with format.any" do
email = BaseMailer.explicit_multipart_with_any
assert_equal(2, email.parts.size)
assert_equal("multipart/alternative", email.mime_type)
assert_equal("text/plain", email.parts[0].mime_type)
assert_equal("Format with any!", email.parts[0].body.encoded)
assert_equal("text/html", email.parts[1].mime_type)
assert_equal("Format with any!", email.parts[1].body.encoded)
end
test "explicit multipart with format(Hash)" do
email = BaseMailer.explicit_multipart_with_options(true)
email.ready_to_send!
assert_equal(2, email.parts.size)
assert_equal("multipart/alternative", email.mime_type)
assert_equal("text/plain", email.parts[0].mime_type)
assert_equal("base64", email.parts[0].content_transfer_encoding)
assert_equal("text/html", email.parts[1].mime_type)
assert_equal("7bit", email.parts[1].content_transfer_encoding)
end
test "explicit multipart with one part is rendered as body and options are merged" do
email = BaseMailer.explicit_multipart_with_options
assert_equal(0, email.parts.size)
assert_equal("text/plain", email.mime_type)
assert_equal("base64", email.content_transfer_encoding)
end
test "explicit multipart with one template has the expected format" do
email = BaseMailer.explicit_multipart_with_one_template
assert_equal(2, email.parts.size)
assert_equal("multipart/alternative", email.mime_type)
assert_equal("text/html", email.parts[0].mime_type)
assert_equal("[:html]", email.parts[0].body.encoded)
assert_equal("text/plain", email.parts[1].mime_type)
assert_equal("[:text]", email.parts[1].body.encoded)
end
# Class level API with method missing
test "should respond to action methods" do
assert_respond_to BaseMailer, :welcome
assert_respond_to BaseMailer, :implicit_multipart
assert !BaseMailer.respond_to?(:mail)
assert !BaseMailer.respond_to?(:headers)
end
test "calling just the action should return the generated mail object" do
BaseMailer.deliveries.clear
email = BaseMailer.welcome
assert_equal(0, BaseMailer.deliveries.length)
assert_equal('The first email on new API!', email.subject)
end
test "calling deliver on the action should deliver the mail object" do
BaseMailer.deliveries.clear
BaseMailer.expects(:deliver_mail).once
mail = BaseMailer.welcome.deliver
assert_instance_of Mail::Message, mail
end
test "calling deliver on the action should increment the deliveries collection if using the test mailer" do
BaseMailer.delivery_method = :test
BaseMailer.deliveries.clear
BaseMailer.welcome.deliver
assert_equal(1, BaseMailer.deliveries.length)
end
test "calling deliver, ActionMailer should yield back to mail to let it call :do_delivery on itself" do
mail = Mail::Message.new
mail.expects(:do_delivery).once
BaseMailer.expects(:welcome).returns(mail)
BaseMailer.welcome.deliver
end
# Rendering
test "you can specify a different template for implicit render" do
mail = BaseMailer.implicit_different_template('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 "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)
assert_equal("TEXT Explicit Multipart Templates", mail.text_part.body.decoded)
end
test "you can specify a different layout" do
mail = BaseMailer.different_layout('different_layout').deliver
assert_equal("HTML -- HTML", mail.html_part.body.decoded)
assert_equal("PLAIN -- PLAIN", mail.text_part.body.decoded)
end
test "you can specify the template path for implicit lookup" do
mail = BaseMailer.welcome_from_another_path('another.path/base_mailer').deliver
assert_equal("Welcome from another path", mail.body.encoded)
mail = BaseMailer.welcome_from_another_path(['unknown/invalid', 'another.path/base_mailer']).deliver
assert_equal("Welcome from another path", mail.body.encoded)
end
test "assets tags should use ActionMailer's asset_host settings" do
ActionMailer::Base.config.asset_host = "http://global.com"
ActionMailer::Base.config.assets_dir = "global/"
mail = AssetMailer.welcome
assert_equal(%{<img alt="Dummy" src="http://global.com/images/dummy.png" />}, mail.body.to_s.strip)
end
test "assets tags should use a Mailer's asset_host settings when available" do
ActionMailer::Base.config.asset_host = "global.com"
ActionMailer::Base.config.assets_dir = "global/"
AssetMailer.asset_host = "http://local.com"
mail = AssetMailer.welcome
assert_equal(%{<img alt="Dummy" src="http://local.com/images/dummy.png" />}, mail.body.to_s.strip)
end
# Before and After hooks
class MyObserver
def self.delivered_email(mail)
end
end
class MySecondObserver
def self.delivered_email(mail)
end
end
test "you can register an observer to the mail object that gets informed on email delivery" do
ActionMailer::Base.register_observer(MyObserver)
mail = BaseMailer.welcome
MyObserver.expects(:delivered_email).with(mail)
mail.deliver
end
test "you can register an observer using its stringified name to the mail object that gets informed on email delivery" do
ActionMailer::Base.register_observer("BaseTest::MyObserver")
mail = BaseMailer.welcome
MyObserver.expects(:delivered_email).with(mail)
mail.deliver
end
test "you can register multiple observers to the mail object that both get informed on email delivery" do
ActionMailer::Base.register_observers("BaseTest::MyObserver", MySecondObserver)
mail = BaseMailer.welcome
MyObserver.expects(:delivered_email).with(mail)
MySecondObserver.expects(:delivered_email).with(mail)
mail.deliver
end
class MyInterceptor
def self.delivering_email(mail)
end
end
class MySecondInterceptor
def self.delivering_email(mail)
end
end
test "you can register an interceptor to the mail object that gets passed the mail object before delivery" do
ActionMailer::Base.register_interceptor(MyInterceptor)
mail = BaseMailer.welcome
MyInterceptor.expects(:delivering_email).with(mail)
mail.deliver
end
test "you can register an interceptor using its stringified name to the mail object that gets passed the mail object before delivery" do
ActionMailer::Base.register_interceptor("BaseTest::MyInterceptor")
mail = BaseMailer.welcome
MyInterceptor.expects(:delivering_email).with(mail)
mail.deliver
end
test "you can register multiple interceptors to the mail object that both get passed the mail object before delivery" do
ActionMailer::Base.register_interceptors("BaseTest::MyInterceptor", MySecondInterceptor)
mail = BaseMailer.welcome
MyInterceptor.expects(:delivering_email).with(mail)
MySecondInterceptor.expects(:delivering_email).with(mail)
mail.deliver
end
test "being able to put proc's into the defaults hash and they get evaluated on mail sending" do
mail1 = ProcMailer.welcome
yesterday = 1.day.ago
Time.stubs(:now).returns(yesterday)
mail2 = ProcMailer.welcome
assert(mail1['X-Proc-Method'].to_s.to_i > mail2['X-Proc-Method'].to_s.to_i)
end
test "we can call other defined methods on the class as needed" do
mail = ProcMailer.welcome
assert_equal("Thanks for signing up this afternoon", mail.subject)
end
test "action methods should be refreshed after defining new method" do
class FooMailer < ActionMailer::Base
# this triggers action_methods
self.respond_to?(:foo)
def notify
end
end
assert_equal ["notify"], FooMailer.action_methods
end
protected
# Execute the block setting the given values and restoring old values after
# the block is executed.
def swap(klass, new_values)
old_values = {}
new_values.each do |key, value|
old_values[key] = klass.send key
klass.send :"#{key}=", value
end
yield
ensure
old_values.each do |key, value|
klass.send :"#{key}=", value
end
end
def with_default(klass, new_values)
old = klass.default_params
klass.default(new_values)
yield
ensure
klass.default_params = old
end
end

View File

@@ -0,0 +1,51 @@
require 'abstract_unit'
class DefaultDeliveryMethodMailer < ActionMailer::Base
end
class NonDefaultDeliveryMethodMailer < ActionMailer::Base
self.delivery_method = :sendmail
end
class ActionMailerBase_delivery_method_Test < Test::Unit::TestCase
def setup
set_delivery_method :smtp
end
def teardown
restore_delivery_method
end
def test_should_be_the_default_smtp
assert_equal :smtp, ActionMailer::Base.delivery_method
end
end
class DefaultDeliveryMethodMailer_delivery_method_Test < Test::Unit::TestCase
def setup
set_delivery_method :smtp
end
def teardown
restore_delivery_method
end
def test_should_be_the_default_smtp
assert_equal :smtp, DefaultDeliveryMethodMailer.delivery_method
end
end
class NonDefaultDeliveryMethodMailer_delivery_method_Test < Test::Unit::TestCase
def setup
set_delivery_method :smtp
end
def teardown
restore_delivery_method
end
def test_should_be_the_set_delivery_method
assert_equal :sendmail, NonDefaultDeliveryMethodMailer.delivery_method
end
end

View File

@@ -1,172 +0,0 @@
require 'abstract_unit'
require 'mail'
class MyCustomDelivery
end
class BogusDelivery
def initialize(*)
end
def deliver!(mail)
raise "failed"
end
end
class DefaultsDeliveryMethodsTest < ActiveSupport::TestCase
test "default smtp settings" do
settings = { :address => "localhost",
:port => 25,
:domain => 'localhost.localdomain',
:user_name => nil,
:password => nil,
:authentication => nil,
:enable_starttls_auto => true }
assert_equal settings, ActionMailer::Base.smtp_settings
end
test "default file delivery settings" do
settings = {:location => "#{Dir.tmpdir}/mails"}
assert_equal settings, ActionMailer::Base.file_settings
end
test "default sendmail settings" do
settings = {:location => '/usr/sbin/sendmail',
:arguments => '-i -t'}
assert_equal settings, ActionMailer::Base.sendmail_settings
end
end
class CustomDeliveryMethodsTest < ActiveSupport::TestCase
def setup
@old_delivery_method = ActionMailer::Base.delivery_method
ActionMailer::Base.add_delivery_method :custom, MyCustomDelivery
end
def teardown
ActionMailer::Base.delivery_method = @old_delivery_method
new = ActionMailer::Base.delivery_methods.dup
new.delete(:custom)
ActionMailer::Base.delivery_methods = new
end
test "allow to add custom delivery method" do
ActionMailer::Base.delivery_method = :custom
assert_equal :custom, ActionMailer::Base.delivery_method
end
test "allow to customize custom settings" do
ActionMailer::Base.custom_settings = { :foo => :bar }
assert_equal Hash[:foo => :bar], ActionMailer::Base.custom_settings
end
test "respond to custom settings" do
assert_respond_to ActionMailer::Base, :custom_settings
assert_respond_to ActionMailer::Base, :custom_settings=
end
test "does not respond to unknown settings" do
assert_raise NoMethodError do
ActionMailer::Base.another_settings
end
end
end
class MailDeliveryTest < ActiveSupport::TestCase
class DeliveryMailer < ActionMailer::Base
DEFAULT_HEADERS = {
:to => 'mikel@test.lindsaar.net',
:from => 'jose@test.plataformatec.com'
}
def welcome(hash={})
mail(DEFAULT_HEADERS.merge(hash))
end
end
def setup
ActionMailer::Base.delivery_method = :smtp
end
def teardown
DeliveryMailer.delivery_method = :smtp
DeliveryMailer.perform_deliveries = true
DeliveryMailer.raise_delivery_errors = true
end
test "ActionMailer should be told when Mail gets delivered" do
DeliveryMailer.deliveries.clear
DeliveryMailer.expects(:deliver_mail).once
DeliveryMailer.welcome.deliver
end
test "delivery method can be customized per instance" do
email = DeliveryMailer.welcome.deliver
assert_instance_of Mail::SMTP, email.delivery_method
email = DeliveryMailer.welcome(:delivery_method => :test).deliver
assert_instance_of Mail::TestMailer, email.delivery_method
end
test "delivery method can be customized in subclasses not changing the parent" do
DeliveryMailer.delivery_method = :test
assert_equal :smtp, ActionMailer::Base.delivery_method
$BREAK = true
email = DeliveryMailer.welcome.deliver
assert_instance_of Mail::TestMailer, email.delivery_method
end
test "non registered delivery methods raises errors" do
DeliveryMailer.delivery_method = :unknown
assert_raise RuntimeError do
DeliveryMailer.welcome.deliver
end
end
test "does not perform deliveries if requested" do
DeliveryMailer.perform_deliveries = false
DeliveryMailer.deliveries.clear
Mail::Message.any_instance.expects(:deliver!).never
DeliveryMailer.welcome.deliver
end
test "does not append the deliveries collection if told not to perform the delivery" do
DeliveryMailer.perform_deliveries = false
DeliveryMailer.deliveries.clear
DeliveryMailer.welcome.deliver
assert_equal(0, DeliveryMailer.deliveries.length)
end
test "raise errors on bogus deliveries" do
DeliveryMailer.delivery_method = BogusDelivery
DeliveryMailer.deliveries.clear
assert_raise RuntimeError do
DeliveryMailer.welcome.deliver
end
end
test "does not increment the deliveries collection on error" do
DeliveryMailer.delivery_method = BogusDelivery
DeliveryMailer.deliveries.clear
assert_raise RuntimeError do
DeliveryMailer.welcome.deliver
end
assert_equal(0, DeliveryMailer.deliveries.length)
end
test "does not raise errors on bogus deliveries if set" do
DeliveryMailer.delivery_method = BogusDelivery
DeliveryMailer.raise_delivery_errors = false
assert_nothing_raised do
DeliveryMailer.welcome.deliver
end
end
test "does not increment the deliveries collection on bogus deliveries" do
DeliveryMailer.delivery_method = BogusDelivery
DeliveryMailer.raise_delivery_errors = false
DeliveryMailer.deliveries.clear
DeliveryMailer.welcome.deliver
assert_equal(0, DeliveryMailer.deliveries.length)
end
end

View File

@@ -1 +0,0 @@
Welcome from another path

View File

@@ -1 +0,0 @@
<%= image_tag "dummy.png" %>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -1 +0,0 @@
Attachment with content

View File

@@ -1 +0,0 @@
HTML

View File

@@ -1 +0,0 @@
PLAIN

View File

@@ -1 +0,0 @@
body_text

View File

@@ -1 +0,0 @@
<%= t('.greet_user', :name => 'lifo') %>

View File

@@ -1 +0,0 @@
HTML Explicit Multipart Templates

View File

@@ -1 +0,0 @@
TEXT Explicit Multipart Templates

View File

@@ -1 +0,0 @@
<%= self.formats.inspect %>

View File

@@ -1 +0,0 @@
<h1>Testing</h1>

View File

@@ -1 +0,0 @@
HTML Implicit Multipart

View File

@@ -1 +0,0 @@
TEXT Implicit Multipart

View File

@@ -1 +0,0 @@
Implicit with locale EN HTML

View File

@@ -1 +0,0 @@
Implicit with locale HTML

View File

@@ -1 +0,0 @@
Implicit with locale PL TEXT

View File

@@ -1 +0,0 @@
Implicit with locale TEXT

View File

@@ -1,5 +0,0 @@
<h1>Inline Image</h1>
<%= image_tag attachments['logo.png'].url %>
<p>This is an image that is inline</p>

View File

@@ -1,4 +0,0 @@
Inline Image
No image for you

View File

@@ -1 +0,0 @@
Testing

View File

@@ -1 +0,0 @@
Welcome

View File

@@ -0,0 +1 @@
So, <%= example_format(@text) %>

View File

@@ -0,0 +1 @@
Hello, <%= person_name %>. Thanks for registering!

View File

@@ -0,0 +1 @@
This message brought to you by <%= name_of_the_mailer_class %>.

View File

@@ -0,0 +1,5 @@
From "Romeo and Juliet":
<%= block_format @text %>
Good ol' Shakespeare.

View File

@@ -0,0 +1,5 @@
module ExampleHelper
def example_format(text)
"<em><strong><small>#{h(text)}</small></strong></em>".html_safe
end
end

View File

@@ -1,4 +0,0 @@
Hello there,
Mr. <%= @recipient %>. Be greeted, new member!

View File

@@ -1 +0,0 @@
HTML -- <%= yield %>

View File

@@ -1 +0,0 @@
PLAIN -- <%= yield %>

View File

@@ -1 +0,0 @@
We do not spam

View File

@@ -1 +1 @@
Have some dots. Enjoy!
Have a lovely picture, from me. Enjoy!

View File

@@ -15,6 +15,6 @@ Content-Type: text/plain; charset=X-UNKNOWN
Test test. Hi. Waving. m
----------------------------------------------------------------
Sent via Bell Mobility's Text Messaging service.
Sent via Bell Mobility's Text Messaging service.
Envoyé par le service de messagerie texte de Bell Mobilité.
----------------------------------------------------------------

View File

@@ -32,7 +32,7 @@ To: xxxxx xxxx <xxxxx@xxxxxxxxx.com>
Subject: Fwd: Signed email causes file attachments
In-Reply-To: <F6E2D0B4-CC35-4A91-BA4C-C7C712B10C13@mac.com>
Mime-Version: 1.0
Content-Type: multipart/mixed;
Content-Type: multipart/mixed;
boundary="----=_Part_5028_7368284.1115579351471"
References: <F6E2D0B4-CC35-4A91-BA4C-C7C712B10C13@mac.com>

View File

@@ -31,7 +31,7 @@ Reply-To: Test Tester <xxxx@xxxx.com>
To: xxxx@xxxx.com, xxxx@xxxx.com
Subject: Another PDF
Mime-Version: 1.0
Content-Type: multipart/mixed;
Content-Type: multipart/mixed;
boundary="----=_Part_2192_32400445.1115745999735"
X-Virus-Scanned: amavisd-new at textdrive.com

View File

@@ -14,6 +14,6 @@ Importance: normal
Test test. Hi. Waving. m
----------------------------------------------------------------
Sent via Bell Mobility's Text Messaging service.
Sent via Bell Mobility's Text Messaging service.
Envoyé par le service de messagerie texte de Bell Mobilité.
----------------------------------------------------------------

View File

@@ -15,6 +15,6 @@ Content-Type: text/plain; charset=us-ascii
Test test. Hi. Waving. m
----------------------------------------------------------------
Sent via Bell Mobility's Text Messaging service.
Sent via Bell Mobility's Text Messaging service.
Envoyé par le service de messagerie texte de Bell Mobilité.
----------------------------------------------------------------

View File

@@ -8,7 +8,7 @@ To: xxxxx xxxx <xxxxx@xxxxxxxxx.com>
Subject: Fwd: Signed email causes file attachments
In-Reply-To: <F6E2D0B4-CC35-4A91-BA4C-C7C712B10C13@mac.com>
Mime-Version: 1.0
Content-Type: multipart/mixed;
Content-Type: multipart/mixed;
boundary="----=_Part_5028_7368284.1115579351471"
References: <F6E2D0B4-CC35-4A91-BA4C-C7C712B10C13@mac.com>

View File

@@ -10,19 +10,19 @@ Date: Wed, 23 Feb 2005 18:20:17 -0400
From: "xxx xxx" <xxx@xxx.xxx>
Message-ID: <4D6AA7EB.6490534@xxx.xxx>
To: xxx@xxx.com
Subject: Stop adware/spyware once and for all.
Subject: Stop adware/spyware once and for all.
X-Scanned-By: MIMEDefang 2.11 (www dot roaringpenguin dot com slash mimedefang)
You are infected with:
You are infected with:
Ad Ware and Spy Ware
Get your free scan and removal download now,
before it gets any worse.
Get your free scan and removal download now,
before it gets any worse.
http://xxx.xxx.info?aid=3D13&?stat=3D4327kdzt
no more? (you will still be infected)
no more? (you will still be infected)
http://xxx.xxx.info/discon/?xxx@xxx.com

View File

@@ -1,3 +1,3 @@
Hello there,
Hello there,
Mr. <%= @recipient %>

View File

@@ -0,0 +1,2 @@
body: <%= @body %>
bar: <%= @bar %>

View File

@@ -1 +0,0 @@
<strong>foo</strong> <%= @foo %>

View File

@@ -1 +0,0 @@
foo: <%= @foo %>

View File

@@ -0,0 +1,2 @@
xml.instruct!
xml.test

View File

@@ -1,3 +1,3 @@
Hello there,
Hello there,
Mr. <%= @recipient %>

View File

@@ -1,4 +1,4 @@
Hello there,
Hello there,
Mr. <%= @recipient %>. Please see our greeting at <%= @welcome_url %> <%= welcome_url %>

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