aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2010-06-08 21:23:29 +0200
committerXavier Noria <fxn@hashref.com>2010-06-08 21:23:29 +0200
commit751f79a03351f1f0d21436b2b947352b97ded093 (patch)
tree9dd053597389241398c9173ab7f565697bef055f /railties
parente7e6ee3e7b075f5447697a6038cb46d65f9b137a (diff)
parentab2877cbe89e266ee986fc12e603abd93ac017ad (diff)
downloadrails-751f79a03351f1f0d21436b2b947352b97ded093.tar.gz
rails-751f79a03351f1f0d21436b2b947352b97ded093.tar.bz2
rails-751f79a03351f1f0d21436b2b947352b97ded093.zip
Merge remote branch 'rails/master'
Diffstat (limited to 'railties')
-rw-r--r--railties/CHANGELOG2
-rw-r--r--railties/guides/source/3_0_release_notes.textile1
-rw-r--r--railties/guides/source/action_mailer_basics.textile31
-rw-r--r--railties/lib/rails/configuration.rb4
-rw-r--r--railties/lib/rails/generators.rb6
-rw-r--r--railties/lib/rails/version.rb2
-rw-r--r--railties/test/application/middleware_test.rb6
-rw-r--r--railties/test/generators/app_generator_test.rb4
-rw-r--r--railties/test/isolation/abstract_unit.rb2
9 files changed, 51 insertions, 7 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index fe3ab3cdcf..61924745c8 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -1,4 +1,4 @@
-*Rails 3.0.0 [beta 4/release candidate] (unreleased)*
+*Rails 3.0.0 [beta 4] (June 8th, 2010)*
* Version bump
* Removed Rails Metal [YK & JV].
diff --git a/railties/guides/source/3_0_release_notes.textile b/railties/guides/source/3_0_release_notes.textile
index 44ada7f5a4..41ea5d5822 100644
--- a/railties/guides/source/3_0_release_notes.textile
+++ b/railties/guides/source/3_0_release_notes.textile
@@ -565,6 +565,7 @@ Action Mailer has been given a new API with TMail being replaced out with the ne
* All mailers are now in <tt>app/mailers</tt> by default.
* Can now send email using new API with three methods: +attachments+, +headers+ and +mail+.
+* ActionMailer now has native support for inline attachments using the <tt>attachments.inline</tt> method.
* Action Mailer emailing methods now return <tt>Mail::Message</tt> objects, which can then be sent the +deliver+ message to send itself.
* All delivery methods are now abstracted out to the Mail gem.
* The mail delivery method can accept a hash of all valid mail header fields with their value pair.
diff --git a/railties/guides/source/action_mailer_basics.textile b/railties/guides/source/action_mailer_basics.textile
index a2a748c749..8eb48e2751 100644
--- a/railties/guides/source/action_mailer_basics.textile
+++ b/railties/guides/source/action_mailer_basics.textile
@@ -211,6 +211,37 @@ attachments['filename.jpg'] = {:mime_type => 'application/x-gzip',
NOTE: If you specify an encoding, Mail will assume that your content is already encoded and not try to Base64 encode it.
+h5. Making Inline Attachments
+
+Inline attachments are now possible in ActionMailer. While previously in the pre 3.0 version of Rails, you could do inline attachments, it involved a lot of hacking and determination to pull it off.
+
+ActionMailer now makes inline attachments as trivial as they should be.
+
+* Firstly, to tell Mail to turn an attachment into an inline attachment, you just call <tt>#inline</tt> on the attachments method within your Mailer:
+
+<ruby>
+def welcome
+ attachments.inline['image.jpg'] = File.read('/path/to/image.jpg')
+end
+</ruby>
+
+* Then in your view, you can just reference <tt>attachments[]</tt> as a hash and specify which attachment you want to show, calling +url+ on it and then passing the result into the <tt>image_tag</tt> method:
+
+<erb>
+<p>Hello there, this is our image</p>
+
+<%= image_tag attachments['image.jpg'].url %>
+</erb>
+
+* As this is a standard call to +image_tag+ you can pass in an options hash after the attachment url as you could for any other image:
+
+<erb>
+<p>Hello there, this is our image</p>
+
+<%= image_tag attachments['image.jpg'].url, :alt => 'My Photo',
+ :class => 'photos' %>
+</erb>
+
h4. Mailer Views
Mailer views are located in the +app/views/name_of_mailer_class+ directory. The specific mailer view is known to the class because it's name is the same as the mailer method. So for example, in our example from above, our mailer view for the +welcome_email+ method will be in +app/views/user_mailer/welcome_email.html.erb+ for the HTML version and +welcome_email.text.erb+ for the plain text version.
diff --git a/railties/lib/rails/configuration.rb b/railties/lib/rails/configuration.rb
index ee0fca6592..0becb780de 100644
--- a/railties/lib/rails/configuration.rb
+++ b/railties/lib/rails/configuration.rb
@@ -28,6 +28,10 @@ module Rails
@operations << [:use, args, block]
end
+ def delete(*args, &block)
+ @operations << [:delete, args, block]
+ end
+
def merge_into(other)
@operations.each do |operation, args, block|
other.send(operation, *args, &block)
diff --git a/railties/lib/rails/generators.rb b/railties/lib/rails/generators.rb
index af92757053..f4990bfb4c 100644
--- a/railties/lib/rails/generators.rb
+++ b/railties/lib/rails/generators.rb
@@ -178,6 +178,7 @@ module Rails
"#{orm}:migration",
"#{orm}:model",
"#{orm}:observer",
+ "#{orm}:session_migration",
"#{test}:controller",
"#{test}:helper",
"#{test}:integration",
@@ -186,8 +187,11 @@ module Rails
"#{test}:observer",
"#{test}:scaffold",
"#{test}:view",
+ "#{test}:performance",
+ "#{test}:plugin",
"#{template}:controller",
- "#{template}:scaffold"
+ "#{template}:scaffold",
+ "#{template}:mailer"
]
end
end
diff --git a/railties/lib/rails/version.rb b/railties/lib/rails/version.rb
index c10876134a..34d96fd0f3 100644
--- a/railties/lib/rails/version.rb
+++ b/railties/lib/rails/version.rb
@@ -3,7 +3,7 @@ module Rails
MAJOR = 3
MINOR = 0
TINY = 0
- BUILD = "beta3"
+ BUILD = "beta4"
STRING = [MAJOR, MINOR, TINY, BUILD].join('.')
end
diff --git a/railties/test/application/middleware_test.rb b/railties/test/application/middleware_test.rb
index bab17d8af5..aa75fed793 100644
--- a/railties/test/application/middleware_test.rb
+++ b/railties/test/application/middleware_test.rb
@@ -57,6 +57,12 @@ module ApplicationTests
assert !middleware.include?("ActionDispatch::Static")
end
+ test "can delete a middleware from the stack" do
+ add_to_config "config.middleware.delete ActionDispatch::Static"
+ boot!
+ assert !middleware.include?("ActionDispatch::Static")
+ end
+
test "removes show exceptions if action_dispatch.show_exceptions is disabled" do
add_to_config "config.action_dispatch.show_exceptions = false"
boot!
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index 3975a39ab1..8bd9dc9f39 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -70,9 +70,7 @@ class AppGeneratorTest < Rails::Generators::TestCase
end
def test_name_collision_raises_an_error
- reserved_words = %w[generate g console c server s dbconsole db
- application destroy benchmarker profiler
- plugin runner test]
+ reserved_words = %w[application destroy plugin runner test]
reserved_words.each do |reserved|
content = capture(:stderr){ run_generator [File.join(destination_root, reserved)] }
assert_equal "Invalid application name #{reserved}. Please give a name which does not match one of the reserved rails words.\n", content
diff --git a/railties/test/isolation/abstract_unit.rb b/railties/test/isolation/abstract_unit.rb
index 6f4c5d77f3..b46ac0efaf 100644
--- a/railties/test/isolation/abstract_unit.rb
+++ b/railties/test/isolation/abstract_unit.rb
@@ -232,7 +232,7 @@ Module.new do
require_environment = "-r #{environment}"
end
- `#{Gem.ruby} #{require_environment} #{RAILS_FRAMEWORK_ROOT}/bin/rails #{tmp_path('app_template')}`
+ `#{Gem.ruby} #{require_environment} #{RAILS_FRAMEWORK_ROOT}/bin/rails new #{tmp_path('app_template')}`
File.open("#{tmp_path}/app_template/config/boot.rb", 'w') do |f|
if require_environment
f.puts "Dir.chdir('#{File.dirname(environment)}') do"