From 8de49fe4613ee4362385dd69d984da463d195a7e Mon Sep 17 00:00:00 2001 From: Avi Tzurel Date: Sun, 11 Mar 2012 12:34:31 +0200 Subject: Squash commits into a single commit --- railties/guides/source/contributing_to_ruby_on_rails.textile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/railties/guides/source/contributing_to_ruby_on_rails.textile b/railties/guides/source/contributing_to_ruby_on_rails.textile index aac5e13978..69a95ff214 100644 --- a/railties/guides/source/contributing_to_ruby_on_rails.textile +++ b/railties/guides/source/contributing_to_ruby_on_rails.textile @@ -374,6 +374,8 @@ Write your branch name in branch field (is filled with master by default) and pr Ensure the changesets you introduced are included in the "Commits" tab and that the "Files Changed" incorporate all of your changes. +If possible, it is encouraged that you squash your commits into a single commit, this makes the pull to master easier, and simplifies the git log for the main repository, so your entire unit of work shows in a single line in the log. + Fill in some details about your potential patch including a meaningful title. When finished, press "Send pull request." Rails Core will be notified about your submission. h4. Get Some Feedback -- cgit v1.2.3 From 625cb12f21d08630577047ccf11678f886145234 Mon Sep 17 00:00:00 2001 From: Andrew France Date: Sun, 11 Mar 2012 13:28:25 +0000 Subject: attr_accessor_with_default was deprecated and removed. Deprecated in 673372152032a886ba9196c69348386834590eab and removed in 9cafc28874a681082f9f7e1e445db91f195a25ae. --- .../source/active_support_core_extensions.textile | 49 ---------------------- 1 file changed, 49 deletions(-) diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index 2091ce0395..5d0a3f82e8 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -509,55 +509,6 @@ end NOTE: Defined in +active_support/core_ext/module/aliasing.rb+. -h5. +attr_accessor_with_default+ - -The method +attr_accessor_with_default+ serves the same purpose as the Ruby macro +attr_accessor+ but allows you to set a default value for the attribute: - - -class Url - attr_accessor_with_default :port, 80 -end - -Url.new.port # => 80 - - -The default value can be also specified with a block, which is called in the context of the corresponding object: - - -class User - attr_accessor :name, :surname - attr_accessor_with_default(:full_name) do - [name, surname].compact.join(" ") - end -end - -u = User.new -u.name = 'Xavier' -u.surname = 'Noria' -u.full_name # => "Xavier Noria" - - -The result is not cached, the block is invoked in each call to the reader. - -You can overwrite the default with the writer: - - -url = Url.new -url.host # => 80 -url.host = 8080 -url.host # => 8080 - - -The default value is returned as long as the attribute is unset. The reader does not rely on the value of the attribute to know whether it has to return the default. It rather monitors the writer: if there's any assignment the value is no longer considered to be unset. - -Active Resource uses this macro to set a default value for the +:primary_key+ attribute: - - -attr_accessor_with_default :primary_key, 'id' - - -NOTE: Defined in +active_support/core_ext/module/attr_accessor_with_default.rb+. - h5. Internal Attributes When you are defining an attribute in a class that is meant to be subclassed, name collisions are a risk. That's remarkably important for libraries. -- cgit v1.2.3 From ddbea9474e20a40e80110944c1e3493ba0efe572 Mon Sep 17 00:00:00 2001 From: Michael de Silva Date: Sun, 11 Mar 2012 23:31:11 +0300 Subject: Fixed Issue #2884 ActiveModel::SecurePassword code / rdoc conflict; an elucidated explanation has been provided and ActiveModel en-locale updated to present a less confusing attribute name for 'password_digest' in form errors due to "has_secure_password" --- activemodel/lib/active_model/locale/en.yml | 4 ++++ activemodel/lib/active_model/secure_password.rb | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/activemodel/lib/active_model/locale/en.yml b/activemodel/lib/active_model/locale/en.yml index ba49c6beaa..1842ba002f 100644 --- a/activemodel/lib/active_model/locale/en.yml +++ b/activemodel/lib/active_model/locale/en.yml @@ -1,4 +1,8 @@ en: + attributes: + # Prevent confusion in form errors due to 'has_secure_password' + password_digest: "Password" + errors: # The default format to use in full error messages. format: "%{attribute} %{message}" diff --git a/activemodel/lib/active_model/secure_password.rb b/activemodel/lib/active_model/secure_password.rb index e7a57cf691..7c529cb67b 100644 --- a/activemodel/lib/active_model/secure_password.rb +++ b/activemodel/lib/active_model/secure_password.rb @@ -10,6 +10,19 @@ module ActiveModel # a "password_confirmation" attribute) are automatically added. # You can add more validations by hand if need be. # + # Note: the implementation of has_secure_password enforces presence validation + # on the :password_digest attribute rather than on :password, which is + # in fact a virtual reader attribute. However, validates_confirmation_of ensures + # an indirect means of presence validation of :password if the + # :password_confirmation attribute is not nil. + # + # You may want to add presence validation on :password for the benefit of your forms + # + # class User < ActiveRecord::Base + # has_secure_password + # validates :password, :presence => { :on => :create } + # end + # # You need to add bcrypt-ruby (~> 3.0.0) to Gemfile to use has_secure_password: # # gem 'bcrypt-ruby', '~> 3.0.0' -- cgit v1.2.3 From 4daef7427b3d63bdda4ac99df25fb3de32dfe9cd Mon Sep 17 00:00:00 2001 From: Ryan Bigg Date: Wed, 7 Mar 2012 07:36:08 -0800 Subject: [instrumentation guide] Cover receive.action_mailer event --- .../source/active_support_instrumentation.textile | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/railties/guides/source/active_support_instrumentation.textile b/railties/guides/source/active_support_instrumentation.textile index f9452400ad..79901a619c 100644 --- a/railties/guides/source/active_support_instrumentation.textile +++ b/railties/guides/source/active_support_instrumentation.textile @@ -21,8 +21,35 @@ You are even able to create your own events inside your application which you ca h3. Rails framework hooks +Within the Ruby on Rails framework, there are a number of hooks provided for common events. These are detailed below. + h4. Action Mailer +h5. receive.action_mailer + +This hook is called when the +receive+ method of an +ActionMailer::Base+ class is called: + + + class Mailer < ActionMailer::Base + def receive(mail) + + end + end + + +The payload for this event has the following parameters related to the incoming email: + +|_.Key |_.Value| +|mailer |Name of the mailer class| +|message_id |ID of the message, generated by the Mail gem| +|subject |Subject of the mail| +|to |To address(es) of the mail| +|from |From address of the mail| +|bcc |BCC addresses of the mail| +|cc |CC addresses of the mail| +|date |Date of the mail| +|mail |The encoded form of the mail| + h4. Action Controller h4. Action View -- cgit v1.2.3 From a42eedb3a3d55097624d5b6a9509d4d79264a391 Mon Sep 17 00:00:00 2001 From: Ryan Bigg Date: Wed, 7 Mar 2012 07:39:20 -0800 Subject: [instrumentation guide] Cover deliver.action_mailer event --- .../source/active_support_instrumentation.textile | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/railties/guides/source/active_support_instrumentation.textile b/railties/guides/source/active_support_instrumentation.textile index 79901a619c..26a5265143 100644 --- a/railties/guides/source/active_support_instrumentation.textile +++ b/railties/guides/source/active_support_instrumentation.textile @@ -50,6 +50,24 @@ The payload for this event has the following parameters related to the incoming |date |Date of the mail| |mail |The encoded form of the mail| +h5. deliver.action_mailer + +This hook is called when the +deliver+ method is called on a +Mail::Message+ object. This is due to a hook inserted by Action Mailer, rather than a specific feature of the Mail gem itself. + +The payload for this event has the following parameters related to the outgoing email: + +|_.Key |_.Value| +|mailer |Name of the mailer class| +|message_id |ID of the message, generated by the Mail gem| +|subject |Subject of the mail| +|to |To address(es) of the mail| +|from |From address of the mail| +|bcc |BCC addresses of the mail| +|cc |CC addresses of the mail| +|date |Date of the mail| +|mail |The encoded form of the mail| + + h4. Action Controller h4. Action View -- cgit v1.2.3 From 507df096f4dd875ba602164b997ef7d5f7739bb6 Mon Sep 17 00:00:00 2001 From: Ryan Bigg Date: Sun, 11 Mar 2012 16:18:48 -0700 Subject: [instrumentation] Add further action placeholders --- .../guides/source/active_support_instrumentation.textile | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/railties/guides/source/active_support_instrumentation.textile b/railties/guides/source/active_support_instrumentation.textile index 26a5265143..8e2866dfc3 100644 --- a/railties/guides/source/active_support_instrumentation.textile +++ b/railties/guides/source/active_support_instrumentation.textile @@ -70,6 +70,18 @@ The payload for this event has the following parameters related to the outgoing h4. Action Controller +h5. write_fragment.action_controller + +h5. read_fragment.action_controller + +h5. exist_fragment?.action_controller + +h5. expire_fragment.action_controller + +h5. write_page.action_controller + +h5. expire_page.action_controller + h4. Action View h4. Active Record -- cgit v1.2.3 From 36bd5c97420e46a19658e34dbe24bcab265311af Mon Sep 17 00:00:00 2001 From: Ryan Bigg Date: Sun, 11 Mar 2012 16:20:11 -0700 Subject: Add engines guide to documents.yaml --- railties/guides/source/documents.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/railties/guides/source/documents.yaml b/railties/guides/source/documents.yaml index 08aafda288..1c8d7d284c 100644 --- a/railties/guides/source/documents.yaml +++ b/railties/guides/source/documents.yaml @@ -96,6 +96,10 @@ name: Asset Pipeline url: asset_pipeline.html description: This guide documents the asset pipeline. + - + name: Getting Started with Engines + url: engines.html + description: This guide explains how to write a mountable engine. - name: The Rails Initialization Process work_in_progress: true -- cgit v1.2.3 From 0b36ad706667b95eee444f1b9272f59c0495d724 Mon Sep 17 00:00:00 2001 From: Filipe Moreira Date: Mon, 12 Mar 2012 21:13:17 +0100 Subject: Advise to keep secret token private --- .../rails/app/templates/config/initializers/secret_token.rb.tt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/secret_token.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/initializers/secret_token.rb.tt index a3143f1346..e02397aaf9 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/initializers/secret_token.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/initializers/secret_token.rb.tt @@ -4,4 +4,6 @@ # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. +# Make sure your secret_token is kept private +# if you're sharing your code publicly. <%= app_const %>.config.secret_token = '<%= app_secret %>' -- cgit v1.2.3 From 6c93fbc516f85fa59fa165f130872d02262f4a28 Mon Sep 17 00:00:00 2001 From: Filipe Moreira Date: Mon, 12 Mar 2012 21:19:58 +0100 Subject: Advise to keep secret token private --- .../guides/code/getting_started/config/initializers/secret_token.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/railties/guides/code/getting_started/config/initializers/secret_token.rb b/railties/guides/code/getting_started/config/initializers/secret_token.rb index b0c8ee23c1..f36ebdda18 100644 --- a/railties/guides/code/getting_started/config/initializers/secret_token.rb +++ b/railties/guides/code/getting_started/config/initializers/secret_token.rb @@ -4,4 +4,6 @@ # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. +# Make sure your secret key is kept private +# if you're sharing your code publicly. Blog::Application.config.secret_token = '685a9bf865b728c6549a191c90851c1b5ec41ecb60b9e94ad79dd3f824749798aa7b5e94431901960bee57809db0947b481570f7f13376b7ca190fa28099c459' -- cgit v1.2.3 From 30b2dd431e889ba613511763152a28bab623b90e Mon Sep 17 00:00:00 2001 From: Ryan Bigg Date: Mon, 12 Mar 2012 16:01:38 -0700 Subject: [config guide] Add mass_assignment_sanitizer to Active Record config options --- railties/guides/source/configuring.textile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/railties/guides/source/configuring.textile b/railties/guides/source/configuring.textile index 0ab1076fff..7a93a30702 100644 --- a/railties/guides/source/configuring.textile +++ b/railties/guides/source/configuring.textile @@ -286,6 +286,8 @@ h4. Configuring Active Record * +config.active_record.dependent_restrict_raises+ will control the behavior when an object with a :dependent => :restrict association is deleted. Setting this to false will prevent +DeleteRestrictionError+ from being raised and instead will add an error on the model object. Defaults to false in the development mode. +* +config.active_record.mass_assignment_sanitizer+ will determine the strictness of the mass assignment sanitization within Rails. Defaults to +:strict+. In this mode, mass assigning any non-+attr_accessible+ attribute in a +create+ or +update_attributes+ call will raise an exception. Setting this option to +:logger+ will only print to the log file when an attribute is being assigned and will not raise an exception. + The MySQL adapter adds one additional configuration option: * +ActiveRecord::ConnectionAdapters::MysqlAdapter.emulate_booleans+ controls whether Active Record will consider all +tinyint(1)+ columns in a MySQL database to be booleans and is true by default. -- cgit v1.2.3