aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/middleware/show_exceptions.rb14
-rw-r--r--actionpack/lib/action_view/helpers/asset_tag_helper.rb4
-rw-r--r--actionpack/lib/action_view/helpers/form_helper.rb72
-rw-r--r--actionpack/lib/action_view/helpers/form_options_helper.rb2
-rw-r--r--actionpack/lib/action_view/helpers/form_tag_helper.rb10
-rw-r--r--actionpack/lib/action_view/helpers/javascript_helper.rb2
-rw-r--r--actionpack/lib/action_view/helpers/prototype_helper.rb2
-rw-r--r--actionpack/lib/action_view/helpers/record_tag_helper.rb8
-rw-r--r--actionpack/lib/action_view/helpers/tag_helper.rb2
-rw-r--r--actionpack/lib/action_view/helpers/text_helper.rb4
-rw-r--r--actionpack/lib/action_view/helpers/url_helper.rb2
-rw-r--r--actionpack/lib/action_view/render/layouts.rb4
-rw-r--r--actionpack/lib/action_view/render/partials.rb6
13 files changed, 59 insertions, 73 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/show_exceptions.rb b/actionpack/lib/action_dispatch/middleware/show_exceptions.rb
index 3bcd004e12..43440e5f7c 100644
--- a/actionpack/lib/action_dispatch/middleware/show_exceptions.rb
+++ b/actionpack/lib/action_dispatch/middleware/show_exceptions.rb
@@ -5,20 +5,6 @@ require 'action_dispatch/http/request'
module ActionDispatch
# This middleware rescues any exception returned by the application and renders
# nice exception pages if it's being rescued locally.
- #
- # Every time an exception is caught, a notification is published, becoming a good API
- # to deal with exceptions. So, if you want send an e-mail through ActionMailer
- # everytime this notification is published, you just need to do the following:
- #
- # ActiveSupport::Notifications.subscribe "action_dispatch.show_exception" do |name, start, end, instrumentation_id, payload|
- # ExceptionNotifier.deliver_exception(start, payload)
- # end
- #
- # The payload is a hash which has two pairs:
- #
- # * :env - Contains the rack env for the given request;
- # * :exception - The exception raised;
- #
class ShowExceptions
LOCALHOST = ['127.0.0.1', '::1'].freeze
diff --git a/actionpack/lib/action_view/helpers/asset_tag_helper.rb b/actionpack/lib/action_view/helpers/asset_tag_helper.rb
index 64d8eebcfc..02ad41719b 100644
--- a/actionpack/lib/action_view/helpers/asset_tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/asset_tag_helper.rb
@@ -59,7 +59,7 @@ module ActionView
# +asset_host+ to a proc like this:
#
# ActionController::Base.asset_host = Proc.new { |source|
- # "http://assets#{rand(2) + 1}.example.com"
+ # "http://assets#{source.hash % 2 + 1}.example.com"
# }
# image_tag("rails.png")
# # => <img alt="Rails" src="http://assets0.example.com/images/rails.png?1230601161" />
@@ -67,7 +67,7 @@ module ActionView
# # => <link href="http://assets1.example.com/stylesheets/application.css?1232285206" media="screen" rel="stylesheet" type="text/css" />
#
# The example above generates "http://assets1.example.com" and
- # "http://assets2.example.com" randomly. This option is useful for example if
+ # "http://assets2.example.com". This option is useful for example if
# you need fewer/more than four hosts, custom host names, etc.
#
# As you see the proc takes a +source+ parameter. That's a string with the
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb
index 01a585af95..2ba5339b7d 100644
--- a/actionpack/lib/action_view/helpers/form_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_helper.rb
@@ -28,7 +28,7 @@ module ActionView
#
# # Note: a @person variable will have been created in the controller.
# # For example: @person = Person.new
- # <% form_for :person, @person, :url => { :action => "create" } do |f| %>
+ # <%= form_for :person, @person, :url => { :action => "create" } do |f| %>
# <%= f.text_field :first_name %>
# <%= f.text_field :last_name %>
# <%= submit_tag 'Create' %>
@@ -44,7 +44,7 @@ module ActionView
#
# If you are using a partial for your form fields, you can use this shortcut:
#
- # <% form_for :person, @person, :url => { :action => "create" } do |f| %>
+ # <%= form_for :person, @person, :url => { :action => "create" } do |f| %>
# <%= render :partial => f %>
# <%= submit_tag 'Create' %>
# <% end %>
@@ -102,7 +102,7 @@ module ActionView
# Rails provides succinct resource-oriented form generation with +form_for+
# like this:
#
- # <% form_for @offer do |f| %>
+ # <%= form_for @offer do |f| %>
# <%= f.label :version, 'Version' %>:
# <%= f.text_field :version %><br />
# <%= f.label :author, 'Author' %>:
@@ -119,7 +119,7 @@ module ActionView
# The generic way to call +form_for+ yields a form builder around a
# model:
#
- # <% form_for :person, :url => { :action => "update" } do |f| %>
+ # <%= form_for :person, :url => { :action => "update" } do |f| %>
# <%= f.error_messages %>
# First name: <%= f.text_field :first_name %><br />
# Last name : <%= f.text_field :last_name %><br />
@@ -143,7 +143,7 @@ module ActionView
# If the instance variable is not <tt>@person</tt> you can pass the actual
# record as the second argument:
#
- # <% form_for :person, person, :url => { :action => "update" } do |f| %>
+ # <%= form_for :person, person, :url => { :action => "update" } do |f| %>
# ...
# <% end %>
#
@@ -175,7 +175,7 @@ module ActionView
# possible to use both the stand-alone FormHelper methods and methods
# from FormTagHelper. For example:
#
- # <% form_for :person, @person, :url => { :action => "update" } do |f| %>
+ # <%= form_for :person, @person, :url => { :action => "update" } do |f| %>
# First name: <%= f.text_field :first_name %>
# Last name : <%= f.text_field :last_name %>
# Biography : <%= text_area :person, :biography %>
@@ -195,37 +195,37 @@ module ActionView
#
# For example, if <tt>@post</tt> is an existing record you want to edit
#
- # <% form_for @post do |f| %>
+ # <%= form_for @post do |f| %>
# ...
# <% end %>
#
# is equivalent to something like:
#
- # <% form_for :post, @post, :url => post_path(@post), :html => { :method => :put, :class => "edit_post", :id => "edit_post_45" } do |f| %>
+ # <%= form_for :post, @post, :url => post_path(@post), :html => { :method => :put, :class => "edit_post", :id => "edit_post_45" } do |f| %>
# ...
# <% end %>
#
# And for new records
#
- # <% form_for(Post.new) do |f| %>
+ # <%= form_for(Post.new) do |f| %>
# ...
# <% end %>
#
# expands to
#
- # <% form_for :post, Post.new, :url => posts_path, :html => { :class => "new_post", :id => "new_post" } do |f| %>
+ # <%= form_for :post, Post.new, :url => posts_path, :html => { :class => "new_post", :id => "new_post" } do |f| %>
# ...
# <% end %>
#
# You can also overwrite the individual conventions, like this:
#
- # <% form_for(@post, :url => super_post_path(@post)) do |f| %>
+ # <%= form_for(@post, :url => super_post_path(@post)) do |f| %>
# ...
# <% end %>
#
# And for namespaced routes, like +admin_post_url+:
#
- # <% form_for([:admin, @post]) do |f| %>
+ # <%= form_for([:admin, @post]) do |f| %>
# ...
# <% end %>
#
@@ -243,7 +243,7 @@ module ActionView
#
# Example:
#
- # <% form_for(:post, @post, :remote => true, :html => { :id => 'create-post', :method => :put }) do |f| %>
+ # <%= form_for(:post, @post, :remote => true, :html => { :id => 'create-post', :method => :put }) do |f| %>
# ...
# <% end %>
#
@@ -263,7 +263,7 @@ module ActionView
# custom builder. For example, let's say you made a helper to
# automatically add labels to form inputs.
#
- # <% form_for :person, @person, :url => { :action => "update" }, :builder => LabellingFormBuilder do |f| %>
+ # <%= form_for :person, @person, :url => { :action => "update" }, :builder => LabellingFormBuilder do |f| %>
# <%= f.text_field :first_name %>
# <%= f.text_field :last_name %>
# <%= text_area :person, :biography %>
@@ -340,11 +340,11 @@ module ActionView
#
# === Generic Examples
#
- # <% form_for @person, :url => { :action => "update" } do |person_form| %>
+ # <%= form_for @person, :url => { :action => "update" } do |person_form| %>
# First name: <%= person_form.text_field :first_name %>
# Last name : <%= person_form.text_field :last_name %>
#
- # <% fields_for @person.permission do |permission_fields| %>
+ # <%= fields_for @person.permission do |permission_fields| %>
# Admin? : <%= permission_fields.check_box :admin %>
# <% end %>
# <% end %>
@@ -352,13 +352,13 @@ module ActionView
# ...or if you have an object that needs to be represented as a different
# parameter, like a Client that acts as a Person:
#
- # <% fields_for :person, @client do |permission_fields| %>
+ # <%= fields_for :person, @client do |permission_fields| %>
# Admin?: <%= permission_fields.check_box :admin %>
# <% end %>
#
# ...or if you don't have an object, just a name of the parameter:
#
- # <% fields_for :person do |permission_fields| %>
+ # <%= fields_for :person do |permission_fields| %>
# Admin?: <%= permission_fields.check_box :admin %>
# <% end %>
#
@@ -402,9 +402,9 @@ module ActionView
#
# This model can now be used with a nested fields_for, like so:
#
- # <% form_for @person, :url => { :action => "update" } do |person_form| %>
+ # <%= form_for @person, :url => { :action => "update" } do |person_form| %>
# ...
- # <% person_form.fields_for :address do |address_fields| %>
+ # <%= person_form.fields_for :address do |address_fields| %>
# Street : <%= address_fields.text_field :street %>
# Zip code: <%= address_fields.text_field :zip_code %>
# <% end %>
@@ -427,15 +427,15 @@ module ActionView
# accepts_nested_attributes_for :address, :allow_destroy => true
# end
#
- # Now, when you use a form element with the <tt>_delete</tt> parameter,
+ # Now, when you use a form element with the <tt>_destroy</tt> parameter,
# with a value that evaluates to +true+, you will destroy the associated
# model (eg. 1, '1', true, or 'true'):
#
- # <% form_for @person, :url => { :action => "update" } do |person_form| %>
+ # <%= form_for @person, :url => { :action => "update" } do |person_form| %>
# ...
- # <% person_form.fields_for :address do |address_fields| %>
+ # <%= person_form.fields_for :address do |address_fields| %>
# ...
- # Delete: <%= address_fields.check_box :_delete %>
+ # Delete: <%= address_fields.check_box :_destroy %>
# <% end %>
# <% end %>
#
@@ -459,9 +459,9 @@ module ActionView
# the nested fields_for call will be repeated for each instance in the
# collection:
#
- # <% form_for @person, :url => { :action => "update" } do |person_form| %>
+ # <%= form_for @person, :url => { :action => "update" } do |person_form| %>
# ...
- # <% person_form.fields_for :projects do |project_fields| %>
+ # <%= person_form.fields_for :projects do |project_fields| %>
# <% if project_fields.object.active? %>
# Name: <%= project_fields.text_field :name %>
# <% end %>
@@ -470,11 +470,11 @@ module ActionView
#
# It's also possible to specify the instance to be used:
#
- # <% form_for @person, :url => { :action => "update" } do |person_form| %>
+ # <%= form_for @person, :url => { :action => "update" } do |person_form| %>
# ...
# <% @person.projects.each do |project| %>
# <% if project.active? %>
- # <% person_form.fields_for :projects, project do |project_fields| %>
+ # <%= person_form.fields_for :projects, project do |project_fields| %>
# Name: <%= project_fields.text_field :name %>
# <% end %>
# <% end %>
@@ -483,9 +483,9 @@ module ActionView
#
# Or a collection to be used:
#
- # <% form_for @person, :url => { :action => "update" } do |person_form| %>
+ # <%= form_for @person, :url => { :action => "update" } do |person_form| %>
# ...
- # <% person_form.fields_for :projects, @active_projects do |project_fields| %>
+ # <%= person_form.fields_for :projects, @active_projects do |project_fields| %>
# Name: <%= project_fields.text_field :name %>
# <% end %>
# <% end %>
@@ -508,14 +508,14 @@ module ActionView
# end
#
# This will allow you to specify which models to destroy in the
- # attributes hash by adding a form element for the <tt>_delete</tt>
+ # attributes hash by adding a form element for the <tt>_destroy</tt>
# parameter with a value that evaluates to +true+
# (eg. 1, '1', true, or 'true'):
#
- # <% form_for @person, :url => { :action => "update" } do |person_form| %>
+ # <%= form_for @person, :url => { :action => "update" } do |person_form| %>
# ...
- # <% person_form.fields_for :projects do |project_fields| %>
- # Delete: <%= project_fields.check_box :_delete %>
+ # <%= person_form.fields_for :projects do |project_fields| %>
+ # Delete: <%= project_fields.check_box :_destroy %>
# <% end %>
# <% end %>
def fields_for(record_or_name_or_array, *args, &block)
@@ -725,7 +725,7 @@ module ActionView
# Unfortunately that workaround does not work when the check box goes
# within an array-like parameter, as in
#
- # <% fields_for "project[invoice_attributes][]", invoice, :index => nil do |form| %>
+ # <%= fields_for "project[invoice_attributes][]", invoice, :index => nil do |form| %>
# <%= form.check_box :paid %>
# ...
# <% end %>
@@ -1115,7 +1115,7 @@ module ActionView
# Add the submit button for the given form. When no value is given, it checks
# if the object is a new resource or not to create the proper label:
#
- # <% form_for @post do |f| %>
+ # <%= form_for @post do |f| %>
# <%= f.submit %>
# <% end %>
#
diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb
index 7039ecd233..4c523d4b20 100644
--- a/actionpack/lib/action_view/helpers/form_options_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_options_helper.rb
@@ -151,7 +151,7 @@ module ActionView
# end
#
# Sample usage (selecting the associated Author for an instance of Post, <tt>@post</tt>):
- # collection_select(:post, :author_id, Author.all, :id, :name_with_initial, {:prompt => true})
+ # collection_select(:post, :author_id, Author.all, :id, :name_with_initial, :prompt => true)
#
# If <tt>@post.author_id</tt> is already <tt>1</tt>, this would return:
# <select name="post[author_id]">
diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb
index 573733ffea..07694f5ebb 100644
--- a/actionpack/lib/action_view/helpers/form_tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb
@@ -37,12 +37,12 @@ module ActionView
# form_tag('/upload', :multipart => true)
# # => <form action="/upload" method="post" enctype="multipart/form-data">
#
- # <% form_tag('/posts')do -%>
+ # <%= form_tag('/posts')do -%>
# <div><%= submit_tag 'Save' %></div>
# <% end -%>
# # => <form action="/posts" method="post"><div><input type="submit" name="submit" value="Save" /></div></form>
#
- # <% form_tag('/posts', :remote => true) %>
+ # <%= form_tag('/posts', :remote => true) %>
# # => <form action="/posts" method="post" data-remote="true">
#
def form_tag(url_for_options = {}, options = {}, *parameters_for_url, &block)
@@ -430,17 +430,17 @@ module ActionView
# <tt>options</tt> accept the same values as tag.
#
# ==== Examples
- # <% field_set_tag do %>
+ # <%= field_set_tag do %>
# <p><%= text_field_tag 'name' %></p>
# <% end %>
# # => <fieldset><p><input id="name" name="name" type="text" /></p></fieldset>
#
- # <% field_set_tag 'Your details' do %>
+ # <%= field_set_tag 'Your details' do %>
# <p><%= text_field_tag 'name' %></p>
# <% end %>
# # => <fieldset><legend>Your details</legend><p><input id="name" name="name" type="text" /></p></fieldset>
#
- # <% field_set_tag nil, :class => 'format' do %>
+ # <%= field_set_tag nil, :class => 'format' do %>
# <p><%= text_field_tag 'name' %></p>
# <% end %>
# # => <fieldset class="format"><p><input id="name" name="name" type="text" /></p></fieldset>
diff --git a/actionpack/lib/action_view/helpers/javascript_helper.rb b/actionpack/lib/action_view/helpers/javascript_helper.rb
index 5635f88c11..b0a7718f22 100644
--- a/actionpack/lib/action_view/helpers/javascript_helper.rb
+++ b/actionpack/lib/action_view/helpers/javascript_helper.rb
@@ -70,7 +70,7 @@ module ActionView
#
# Instead of passing the content as an argument, you can also use a block
# in which case, you pass your +html_options+ as the first parameter.
- # <% javascript_tag :defer => 'defer' do -%>
+ # <%= javascript_tag :defer => 'defer' do -%>
# alert('All is good')
# <% end -%>
def javascript_tag(content_or_options_with_block = nil, html_options = {}, &block)
diff --git a/actionpack/lib/action_view/helpers/prototype_helper.rb b/actionpack/lib/action_view/helpers/prototype_helper.rb
index f53aafa679..ccdc8181db 100644
--- a/actionpack/lib/action_view/helpers/prototype_helper.rb
+++ b/actionpack/lib/action_view/helpers/prototype_helper.rb
@@ -35,7 +35,7 @@ module ActionView
#
# ...through a form...
#
- # <% form_remote_tag :url => '/shipping' do -%>
+ # <%= form_remote_tag :url => '/shipping' do -%>
# <div><%= submit_tag 'Recalculate Shipping' %></div>
# <% end -%>
#
diff --git a/actionpack/lib/action_view/helpers/record_tag_helper.rb b/actionpack/lib/action_view/helpers/record_tag_helper.rb
index 31411dc08a..a9cf15f418 100644
--- a/actionpack/lib/action_view/helpers/record_tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/record_tag_helper.rb
@@ -4,7 +4,7 @@ module ActionView
# Produces a wrapper DIV element with id and class parameters that
# relate to the specified Active Record object. Usage example:
#
- # <% div_for(@person, :class => "foo") do %>
+ # <%= div_for(@person, :class => "foo") do %>
# <%=h @person.name %>
# <% end %>
#
@@ -19,7 +19,7 @@ module ActionView
# content_tag_for creates an HTML element with id and class parameters
# that relate to the specified Active Record object. For example:
#
- # <% content_tag_for(:tr, @person) do %>
+ # <%= content_tag_for(:tr, @person) do %>
# <td><%=h @person.first_name %></td>
# <td><%=h @person.last_name %></td>
# <% end %>
@@ -31,7 +31,7 @@ module ActionView
#
# If you require the HTML id attribute to have a prefix, you can specify it:
#
- # <% content_tag_for(:tr, @person, :foo) do %> ...
+ # <%= content_tag_for(:tr, @person, :foo) do %> ...
#
# produces:
#
@@ -41,7 +41,7 @@ module ActionView
# additional HTML attributes. If you specify a <tt>:class</tt> value, it will be combined
# with the default class name for your object. For example:
#
- # <% content_tag_for(:li, @person, :class => "bar") %>...
+ # <%= content_tag_for(:li, @person, :class => "bar") %>...
#
# produces:
#
diff --git a/actionpack/lib/action_view/helpers/tag_helper.rb b/actionpack/lib/action_view/helpers/tag_helper.rb
index bbbc1f0981..9b4cacd4d7 100644
--- a/actionpack/lib/action_view/helpers/tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/tag_helper.rb
@@ -65,7 +65,7 @@ module ActionView
# content_tag("select", options, :multiple => true)
# # => <select multiple="multiple">...options...</select>
#
- # <% content_tag :div, :class => "strong" do -%>
+ # <%= content_tag :div, :class => "strong" do -%>
# Hello world!
# <% end -%>
# # => <div class="strong">Hello world!</div>
diff --git a/actionpack/lib/action_view/helpers/text_helper.rb b/actionpack/lib/action_view/helpers/text_helper.rb
index 13fad0ed7a..27be1690dd 100644
--- a/actionpack/lib/action_view/helpers/text_helper.rb
+++ b/actionpack/lib/action_view/helpers/text_helper.rb
@@ -17,7 +17,7 @@ module ActionView
# concat "hello"
# # is the equivalent of <%= "hello" %>
#
- # if (logged_in == true):
+ # if logged_in
# concat "Logged in!"
# else
# concat link_to('login', :action => login)
@@ -415,7 +415,7 @@ module ActionView
# {:first => 'Emily', :middle => 'Shannon', :maiden => 'Pike', :last => 'Hicks'},
# {:first => 'June', :middle => 'Dae', :last => 'Jones'}]
# <% @items.each do |item| %>
- # <tr class="<%= cycle("even", "odd", :name => "row_class") -%>">
+ # <tr class="<%= cycle("odd", "even", :name => "row_class") -%>">
# <td>
# <% item.values.each do |value| %>
# <%# Create a named cycle "colors" %>
diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb
index bc7302ef9e..b23d5fcb68 100644
--- a/actionpack/lib/action_view/helpers/url_helper.rb
+++ b/actionpack/lib/action_view/helpers/url_helper.rb
@@ -170,7 +170,7 @@ module ActionView
#
# You can use a block as well if your link target is hard to fit into the name parameter. ERb example:
#
- # <% link_to(@profile) do %>
+ # <%= link_to(@profile) do %>
# <strong><%= @profile.name %></strong> -- <span>Check it out!</span>
# <% end %>
# # => <a href="/profiles/1">
diff --git a/actionpack/lib/action_view/render/layouts.rb b/actionpack/lib/action_view/render/layouts.rb
index c790a70b3e..578f39d817 100644
--- a/actionpack/lib/action_view/render/layouts.rb
+++ b/actionpack/lib/action_view/render/layouts.rb
@@ -10,7 +10,7 @@ module ActionView
# ==== Example
#
# # The template
- # <% render :layout => "my_layout" do %>Content<% end %>
+ # <%= render :layout => "my_layout" do %>Content<% end %>
#
# # The layout
# <html><% yield %></html>
@@ -24,7 +24,7 @@ module ActionView
# ==== Example
#
# # The template
- # <% render :layout => "my_layout" do |customer| %>Hello <%= customer.name %><% end %>
+ # <%= render :layout => "my_layout" do |customer| %>Hello <%= customer.name %><% end %>
#
# # The layout
# <html><% yield Struct.new(:name).new("David") %></html>
diff --git a/actionpack/lib/action_view/render/partials.rb b/actionpack/lib/action_view/render/partials.rb
index 0fe2d560f7..17d16556b9 100644
--- a/actionpack/lib/action_view/render/partials.rb
+++ b/actionpack/lib/action_view/render/partials.rb
@@ -123,7 +123,7 @@ module ActionView
# You can also apply a layout to a block within any template:
#
# <%# app/views/users/_chief.html.erb &>
- # <% render(:layout => "administrator", :locals => { :user => chief }) do %>
+ # <%= render(:layout => "administrator", :locals => { :user => chief }) do %>
# Title: <%= chief.title %>
# <% end %>
#
@@ -146,7 +146,7 @@ module ActionView
# </div>
#
# <%# app/views/users/index.html.erb &>
- # <% render :layout => @users do |user| %>
+ # <%= render :layout => @users do |user| %>
# Title: <%= user.title %>
# <% end %>
#
@@ -162,7 +162,7 @@ module ActionView
# </div>
#
# <%# app/views/users/index.html.erb &>
- # <% render :layout => @users do |user, section| %>
+ # <%= render :layout => @users do |user, section| %>
# <%- case section when :header -%>
# Title: <%= user.title %>
# <%- when :footer -%>