Skip to content

Commit

Permalink
Merge branch 'master' of github.com:lifo/docrails
Browse files Browse the repository at this point in the history
Conflicts:
	railties/guides/source/active_support_core_extensions.textile
  • Loading branch information
vijaydev committed Dec 23, 2011
2 parents a805a7f + 150217f commit a51c4a3
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 22 deletions.
10 changes: 6 additions & 4 deletions actionmailer/README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ So the corresponding body template for the method above could look like this:

Thank you for signing up!

And if the recipient was given as "david@loudthinking.com", the email
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
Expand All @@ -62,7 +62,7 @@ generated would look like this:
Thank you for signing up!

In previous version of Rails you would call <tt>create_method_name</tt> and
<tt>deliver_method_name</tt>. Rails 3.0 has a much simpler interface, you
<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:
Expand All @@ -76,7 +76,7 @@ Or you can just chain the methods together like:

== Setting defaults

It is possible to set default values that will be used in every method in your Action Mailer class. To implement this functionality, you just call the public class method <tt>default</tt> which you get for free from ActionMailer::Base. This method accepts a Hash as the parameter. You can use any of the headers e-mail messages has, like <tt>:from</tt> as the key. You can also pass in a string as the key, like "Content-Type", but Action Mailer does this out of the box for you, so you won't need to worry about that. Finally it is also possible to pass in a Proc that will get evaluated when it is needed.
It is possible to set default values that will be used in every method in your Action Mailer class. To implement this functionality, you just call the public class method <tt>default</tt> which you get for free from ActionMailer::Base. This method accepts a Hash as the parameter. You can use any of the headers e-mail messages has, like <tt>:from</tt> as the key. You can also pass in a string as the key, like "Content-Type", but Action Mailer does this out of the box for you, so you won't need to worry about that. Finally, it is also possible to pass in a Proc that will get evaluated when it is needed.

Note that every value you set with this method will get over written if you use the same key in your mailer method.

Expand Down Expand Up @@ -148,7 +148,9 @@ Source code can be downloaded as part of the Rails project on GitHub

== License

Action Mailer is released under the MIT license.
Action Mailer is released under the MIT license:

* http://www.opensource.org/licenses/MIT


== Support
Expand Down
2 changes: 1 addition & 1 deletion actionmailer/lib/rails/generators/mailer/USAGE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Description:
============
Stubs out a new mailer and its views. Pass the mailer name, either
Stubs out a new mailer and its views. Passes the mailer name, either
CamelCased or under_scored, and an optional list of emails as arguments.

This generates a mailer class in app/mailers and invokes your template
Expand Down
31 changes: 16 additions & 15 deletions activemodel/lib/active_model/mass_assignment_security.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,13 @@ module ClassMethods
#
# class Customer
# include ActiveModel::MassAssignmentSecurity
#
# attr_accessor :name, :credit_rating
#
# attr_protected :credit_rating, :last_login
# attr_protected :last_login, :as => :admin
#
#
# attr_accessor :name, :email, :logins_count
#
# attr_protected :logins_count
# # Suppose that admin can not change email for customer
# attr_protected :logins_count, :email, :as => :admin
#
# def assign_attributes(values, options = {})
# sanitize_for_mass_assignment(values, options[:as]).each do |k, v|
# send("#{k}=", v)
Expand All @@ -86,21 +87,21 @@ module ClassMethods
# When using the :default role :
#
# customer = Customer.new
# customer.assign_attributes({ "name" => "David", "credit_rating" => "Excellent", :last_login => 1.day.ago }, :as => :default)
# customer.assign_attributes({ "name" => "David", "email" => "a@b.com", :logins_count => 5 }, :as => :default)
# customer.name # => "David"
# customer.credit_rating # => nil
# customer.last_login # => nil
#
# customer.credit_rating = "Average"
# customer.credit_rating # => "Average"
# customer.email # => "a@b.com"
# customer.logins_count # => nil
#
# And using the :admin role :
#
# customer = Customer.new
# customer.assign_attributes({ "name" => "David", "credit_rating" => "Excellent", :last_login => 1.day.ago }, :as => :admin)
# customer.assign_attributes({ "name" => "David", "email" => "a@b.com", :logins_count => 5}, :as => :admin)
# customer.name # => "David"
# customer.credit_rating # => "Excellent"
# customer.last_login # => nil
# customer.email # => nil
# customer.logins_count # => nil
#
# customer.email = "c@d.com"
# customer.email # => "c@d.com"
#
# To start from an all-closed default and enable attributes as needed,
# have a look at +attr_accessible+.
Expand Down
4 changes: 3 additions & 1 deletion railties/README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ Source code can be downloaded as part of the Rails project on GitHub

== License

Railties is released under the MIT license.
Railties is released under the MIT license:

* http://www.opensource.org/licenses/MIT

== Support

Expand Down
2 changes: 1 addition & 1 deletion railties/guides/source/active_record_querying.textile
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ When a +lambda+ is used for a +scope+, it can take arguments:

<ruby>
class Post < ActiveRecord::Base
scope :1_week_before, lambda { |time| where("created_at < ?", time)
scope :1_week_before, lambda { |time| where("created_at < ?", time) }
end
</ruby>

Expand Down

0 comments on commit a51c4a3

Please sign in to comment.