提交 70d6e16f 编写于 作者: T Thiago Pinto

Merge branch 'master' of github.com:rails/docrails

......@@ -64,7 +64,7 @@ def wrap_delivery_behavior(mail, method=nil, options=nil) # :nodoc:
raise "Delivery method cannot be nil"
when Symbol
if klass = delivery_methods[method]
mail.delivery_method(klass,(send(:"#{method}_settings") || {}).merge!(options || {}))
mail.delivery_method(klass, (send(:"#{method}_settings") || {}).merge(options || {}))
else
raise "Invalid delivery method #{method.inspect}"
end
......
......@@ -152,6 +152,9 @@ def teardown
assert_equal "overridden", delivery_method_instance.settings[:user_name]
assert_equal "somethingobtuse", delivery_method_instance.settings[:password]
assert_equal delivery_method_instance.settings.merge(overridden_options), delivery_method_instance.settings
# make sure that overriding delivery method options per mail instance doesn't affect the Base setting
assert_equal settings, ActionMailer::Base.smtp_settings
end
test "non registered delivery methods raises errors" do
......
......@@ -59,7 +59,7 @@ module ActionController
# <input type="text" name="post[address]" value="hyacintvej">
#
# A request stemming from a form holding these inputs will include <tt>{ "post" => { "name" => "david", "address" => "hyacintvej" } }</tt>.
# If the address input had been named "post[address][street]", the params would have included
# If the address input had been named <tt>post[address][street]</tt>, the params would have included
# <tt>{ "post" => { "address" => { "street" => "hyacintvej" } } }</tt>. There's no limit to the depth of the nesting.
#
# == Sessions
......
......@@ -514,11 +514,12 @@ def initialize(options, recall, set)
@recall = recall.dup
@set = set
normalize_recall!
normalize_options!
normalize_controller_action_id!
use_relative_controller!
normalize_controller!
handle_nil_action!
normalize_action!
end
def controller
......@@ -537,6 +538,11 @@ def use_recall_for(key)
end
end
# Set 'index' as default action for recall
def normalize_recall!
@recall[:action] ||= 'index'
end
def normalize_options!
# If an explicit :controller was given, always make :action explicit
# too, so that action expiry works as expected for things like
......@@ -552,8 +558,8 @@ def normalize_options!
options[:controller] = options[:controller].to_s
end
if options[:action]
options[:action] = options[:action].to_s
if options.key?(:action)
options[:action] = (options[:action] || 'index').to_s
end
end
......@@ -563,8 +569,6 @@ def normalize_options!
# :controller, :action or :id is not found, don't pull any
# more keys from the recall.
def normalize_controller_action_id!
@recall[:action] ||= 'index' if current_controller
use_recall_for(:controller) or return
use_recall_for(:action) or return
use_recall_for(:id)
......@@ -586,13 +590,11 @@ def normalize_controller!
@options[:controller] = controller.sub(%r{^/}, '') if controller
end
# This handles the case of action: nil being explicitly passed.
# It is identical to action: "index"
def handle_nil_action!
if options.has_key?(:action) && options[:action].nil?
options[:action] = 'index'
# Move 'index' action from options to recall
def normalize_action!
if @options[:action] == 'index'
@recall[:action] = @options.delete(:action)
end
recall[:action] = options.delete(:action) if options[:action] == 'index'
end
# Generates a path from routes, returns [path, params].
......
......@@ -646,6 +646,7 @@ def setup
Mime::Type.register_alias('text/html', :iphone)
Mime::Type.register_alias('text/html', :touch)
Mime::Type.register('text/x-mobile', :mobile)
Customer.send(:undef_method, :to_json) if Customer.method_defined?(:to_json)
end
def teardown
......
......@@ -92,7 +92,7 @@ class StreamingTest < Rack::TestCase
io.rewind
assert_match "(undefined method `invalid!' for nil:NilClass)", io.read
ensure
ActionController::Base.logger = _old
ActionView::Base.logger = _old
end
end
......
......@@ -775,6 +775,10 @@ def setup
@request.host = "www.nextangle.com"
end
def teardown
ActionView::Base.logger = nil
end
# :ported:
def test_simple_show
get :hello_world
......
= Action View
== Download and installation
The latest version of Action View can be installed with RubyGems:
......
......@@ -5,7 +5,7 @@
s.name = 'actionview'
s.version = version
s.summary = 'Rendering framework putting the V in MVC (part of Rails).'
s.description = ''
s.description = 'Simple, battle-tested conventions and helpers for building web pages.'
s.required_ruby_version = '>= 1.9.3'
......
......@@ -32,7 +32,7 @@ def initialize(name)
class PendingMigrationError < ActiveRecordError#:nodoc:
def initialize
super("Migrations are pending; run 'rake db:migrate RAILS_ENV=#{Rails.env}' to resolve this issue.")
super("Migrations are pending; run 'bin/rake db:migrate RAILS_ENV=#{Rails.env}' to resolve this issue.")
end
end
......
......@@ -647,7 +647,7 @@ def test_has_many_association_through_a_has_many_association_to_self
sarah = Person.create!(:first_name => 'Sarah', :primary_contact_id => people(:susan).id, :gender => 'F', :number1_fan_id => 1)
john = Person.create!(:first_name => 'John', :primary_contact_id => sarah.id, :gender => 'M', :number1_fan_id => 1)
assert_equal sarah.agents, [john]
assert_equal people(:susan).agents.map(&:agents).flatten, people(:susan).agents_of_agents
assert_equal people(:susan).agents.flat_map(&:agents), people(:susan).agents_of_agents
end
def test_associate_existing_with_nonstandard_primary_key_on_belongs_to
......
......@@ -453,6 +453,11 @@ def test_sqlite_add_column_in_transaction
raise ActiveRecord::Rollback
end
end
ensure
Topic.reset_column_information # reset the column information to get correct reading
Topic.connection.remove_column('topics', 'stuff') if Topic.column_names.include?('stuff')
Topic.reset_column_information # reset the column information again for other tests
end
def test_transactions_state_from_rollback
......
......@@ -8,9 +8,7 @@ class Author < ActiveRecord::Base
has_many :posts_sorted_by_id_limited, -> { order('posts.id').limit(1) }, :class_name => "Post"
has_many :posts_with_categories, -> { includes(:categories) }, :class_name => "Post"
has_many :posts_with_comments_and_categories, -> { includes(:comments, :categories).order("posts.id") }, :class_name => "Post"
has_many :posts_containing_the_letter_a, :class_name => "Post"
has_many :posts_with_special_categorizations, :class_name => 'PostWithSpecialCategorization'
has_many :posts_with_extension, :class_name => "Post"
has_one :post_about_thinking, -> { where("posts.title like '%thinking%'") }, :class_name => 'Post'
has_one :post_about_thinking_with_last_comment, -> { where("posts.title like '%thinking%'").includes(:last_comment) }, :class_name => 'Post'
has_many :comments, through: :posts do
......@@ -32,7 +30,6 @@ def ratings
has_many :welcome_posts, -> { where(:title => 'Welcome to the weblog') }, :class_name => 'Post'
has_many :comments_desc, -> { order('comments.id DESC') }, :through => :posts, :source => :comments
has_many :limited_comments, -> { limit(1) }, :through => :posts, :source => :comments
has_many :funky_comments, :through => :posts, :source => :comments
has_many :ordered_uniq_comments, -> { distinct.order('comments.id') }, :through => :posts, :source => :comments
has_many :ordered_uniq_comments_desc, -> { distinct.order('comments.id DESC') }, :through => :posts, :source => :comments
......
class AutoId < ActiveRecord::Base
def self.table_name () "auto_id_tests" end
def self.primary_key () "auto_id" end
self.table_name = "auto_id_tests"
self.primary_key = "auto_id"
end
class Car < ActiveRecord::Base
has_many :bulbs
has_many :funky_bulbs, class_name: 'FunkyBulb', dependent: :destroy
has_many :foo_bulbs, -> { where(:name => 'foo') }, :class_name => "Bulb"
has_many :frickinawesome_bulbs, -> { where :frickinawesome => true }, :class_name => "Bulb"
has_one :bulb
has_one :frickinawesome_bulb, -> { where :frickinawesome => true }, :class_name => "Bulb"
has_many :tyres
has_many :engines, :dependent => :destroy
......
class Citation < ActiveRecord::Base
belongs_to :reference_of, :class_name => "Book", :foreign_key => :book2_id
belongs_to :book1, :class_name => "Book", :foreign_key => :book1_id
belongs_to :book2, :class_name => "Book", :foreign_key => :book2_id
end
......@@ -2,7 +2,6 @@ class Club < ActiveRecord::Base
has_one :membership
has_many :memberships, :inverse_of => false
has_many :members, :through => :memberships
has_many :current_memberships
has_one :sponsor
has_one :sponsored_member, :through => :sponsor, :source => :sponsorable, :source_type => "Member"
belongs_to :category
......
......@@ -49,7 +49,6 @@ class Firm < Company
has_many :clients_like_ms, -> { where("name = 'Microsoft'").order("id") }, :class_name => "Client"
has_many :clients_like_ms_with_hash_conditions, -> { where(:name => 'Microsoft').order("id") }, :class_name => "Client"
has_many :plain_clients, :class_name => 'Client'
has_many :readonly_clients, -> { readonly }, :class_name => 'Client'
has_many :clients_using_primary_key, :class_name => 'Client',
:primary_key => 'name', :foreign_key => 'firm_name'
has_many :clients_using_primary_key_with_delete_all, :class_name => 'Client',
......@@ -167,7 +166,6 @@ class ExclusivelyDependentFirm < Company
has_one :account, :foreign_key => "firm_id", :dependent => :delete
has_many :dependent_sanitized_conditional_clients_of_firm, -> { order("id").where("name = 'BigShot Inc.'") }, :foreign_key => "client_of", :class_name => "Client", :dependent => :delete_all
has_many :dependent_conditional_clients_of_firm, -> { order("id").where("name = ?", 'BigShot Inc.') }, :foreign_key => "client_of", :class_name => "Client", :dependent => :delete_all
has_many :dependent_hash_conditional_clients_of_firm, -> { order("id").where(:name => 'BigShot Inc.') }, :foreign_key => "client_of", :class_name => "Client", :dependent => :delete_all
end
class SpecialClient < Client
......
......@@ -2,7 +2,6 @@ class Member < ActiveRecord::Base
has_one :current_membership
has_one :selected_membership
has_one :membership
has_many :fellow_members, :through => :club, :source => :members
has_one :club, :through => :current_membership
has_one :selected_club, :through => :selected_membership, :source => :club
has_one :favourite_club, -> { where "memberships.favourite = ?", true }, :through => :membership, :source => :club
......
class Movie < ActiveRecord::Base
def self.primary_key
"movieid"
end
self.primary_key = "movieid"
end
......@@ -122,7 +122,6 @@ def add_joins_and_select
has_many :secure_readers
has_many :readers_with_person, -> { includes(:person) }, :class_name => "Reader"
has_many :people, :through => :readers
has_many :secure_people, :through => :secure_readers
has_many :single_people, :through => :readers
has_many :people_with_callbacks, :source=>:person, :through => :readers,
:before_add => lambda {|owner, reader| log(:added, :before, reader.first_name) },
......
class Project < ActiveRecord::Base
has_and_belongs_to_many :developers, -> { distinct.order 'developers.name desc, developers.id desc' }
has_and_belongs_to_many :readonly_developers, -> { readonly }, :class_name => "Developer"
has_and_belongs_to_many :selected_developers, -> { distinct.select "developers.*" }, :class_name => "Developer"
has_and_belongs_to_many :non_unique_developers, -> { order 'developers.name desc, developers.id desc' }, :class_name => 'Developer'
has_and_belongs_to_many :limited_developers, -> { limit 1 }, :class_name => "Developer"
has_and_belongs_to_many :developers_named_david, -> { where("name = 'David'").distinct }, :class_name => "Developer"
......
......@@ -34,7 +34,6 @@ def two
has_many :replies, :dependent => :destroy, :foreign_key => "parent_id"
has_many :approved_replies, -> { approved }, class_name: 'Reply', foreign_key: "parent_id", counter_cache: 'replies_count'
has_many :replies_with_primary_key, :class_name => "Reply", :dependent => :destroy, :primary_key => "title", :foreign_key => "parent_title"
has_many :unique_replies, :dependent => :destroy, :foreign_key => "parent_id"
has_many :silly_unique_replies, :dependent => :destroy, :foreign_key => "parent_id"
......
......@@ -119,7 +119,7 @@ def change(options)
options.fetch(:day, day)
)
end
# Allow Date to be compared with Time by converting to DateTime and relying on the <=> from there.
def compare_with_coercion(other)
if other.is_a?(Time)
......
......@@ -235,7 +235,6 @@ def process_array(value)
value.map! { |i| deep_to_h(i) }
value.length > 1 ? value : value.first
end
end
end
......@@ -47,7 +47,7 @@ def try(*a, &b)
end
# Same as #try, but will raise a NoMethodError exception if the receiving is not nil and
# does not implemented the tried method.
# does not implement the tried method.
def try!(*a, &b)
if a.empty? && block_given?
yield self
......
......@@ -3,7 +3,6 @@
require 'active_support/inflector/transliterate'
class TransliterateTest < ActiveSupport::TestCase
def test_transliterate_should_not_change_ascii_chars
(0..127).each do |byte|
char = [byte].pack("U")
......@@ -24,12 +23,13 @@ def test_transliterate_should_approximate_ascii
def test_transliterate_should_work_with_custom_i18n_rules_and_uncomposed_utf8
char = [117, 776].pack("U*") # "ü" as ASCII "u" plus COMBINING DIAERESIS
I18n.backend.store_translations(:de, :i18n => {:transliterate => {:rule => {"ü" => "ue"}}})
I18n.locale = :de
default_locale, I18n.locale = I18n.locale, :de
assert_equal "ue", ActiveSupport::Inflector.transliterate(char)
ensure
I18n.locale = default_locale
end
def test_transliterate_should_allow_a_custom_replacement_char
assert_equal "a*b", ActiveSupport::Inflector.transliterate("a索b", "*")
end
end
......@@ -106,7 +106,11 @@ module LibXML end
module Nokogiri end
setup do
@xml = ActiveSupport::XmlMini
@xml, @default_backend = ActiveSupport::XmlMini, ActiveSupport::XmlMini.backend
end
teardown do
ActiveSupport::XmlMini.backend = @default_backend
end
test "#with_backend should switch backend and then switch back" do
......@@ -135,7 +139,11 @@ module REXML end
module LibXML end
setup do
@xml = ActiveSupport::XmlMini
@xml, @default_backend = ActiveSupport::XmlMini, ActiveSupport::XmlMini.backend
end
teardown do
ActiveSupport::XmlMini.backend = @default_backend
end
test "#with_backend should be thread-safe" do
......
......@@ -15,7 +15,7 @@
</p>
<% end %>
<p>
The guides for Rails 3.2.x are available at <a href="http://guides.rubyonrails.org/v3.2.13/">http://guides.rubyonrails.org/v3.2.13/</a>.
The guides for Rails 3.2.x are available at <a href="http://guides.rubyonrails.org/v3.2.14/">http://guides.rubyonrails.org/v3.2.14/</a>.
</p>
<p>
The guides for Rails 2.3.x are available at <a href="http://guides.rubyonrails.org/v2.3.11/">http://guides.rubyonrails.org/v2.3.11/</a>.
......
......@@ -105,7 +105,7 @@ will be the template used for the email, formatted in HTML:
<h1>Welcome to example.com, <%= @user.name %></h1>
<p>
You have successfully signed up to example.com,
your username is: <%= @user.login %>.<br/>
your username is: <%= @user.login %>.<br>
</p>
<p>
To login to the site, just follow this link: <%= @url %>.
......
......@@ -68,7 +68,7 @@ Consider the following loop for names:
```html+erb
<h1>Names of all the people</h1>
<% @people.each do |person| %>
Name: <%= person.name %><br/>
Name: <%= person.name %><br>
<% end %>
```
......
......@@ -514,7 +514,13 @@ SELECT * FROM clients WHERE (clients.orders_count IN (1,3,5))
Post.where.not(author: author)
```
In other words, this query can be generated by calling `where` with no argument, then immediately chain with `not` passing `where` conditions.
In other words, this query can be generated by calling `where` with no argument,
then immediately chain with `not` passing `where` conditions. This will generate
SQL code like this:
```sql
SELECT * FROM posts WHERE (author_id != 1)
```
Ordering
--------
......
......@@ -96,12 +96,13 @@ INFO: The predicate for strings uses the Unicode-aware character class `[:space:
WARNING: Note that numbers are not mentioned. In particular, 0 and 0.0 are **not** blank.
For example, this method from `ActionDispatch::Session::AbstractStore` uses `blank?` for checking whether a session key is present:
For example, this method from `ActionController::HttpAuthentication::Token::ControllerMethods` uses `blank?` for checking whether a token is present:
```ruby
def ensure_session_key!
if @key.blank?
raise ArgumentError, 'A key is required...'
def authenticate(controller, &login_procedure)
token, options = token_and_options(controller.request)
unless token.blank?
login_procedure.call(token, options)
end
end
```
......@@ -420,9 +421,9 @@ NOTE: Defined in `active_support/core_ext/object/with_options.rb`.
### JSON support
Active Support provides a better implemention of `to_json` than the +json+ gem ordinarily provides for Ruby objects. This is because some classes, like +Hash+ and +OrderedHash+ needs special handling in order to provide a proper JSON representation.
Active Support provides a better implemention of `to_json` than the `json` gem ordinarily provides for Ruby objects. This is because some classes, like `Hash` and `OrderedHash` needs special handling in order to provide a proper JSON representation.
Active Support also provides an implementation of `as_json` for the <tt>Process::Status</tt> class.
Active Support also provides an implementation of `as_json` for the `Process::Status` class.
NOTE: Defined in `active_support/core_ext/object/to_json.rb`.
......@@ -1987,7 +1988,7 @@ Produce a string representation of a number in human-readable words:
1234567890123456.to_s(:human) # => "1.23 Quadrillion"
```
NOTE: Defined in `active_support/core_ext/numeric/formatting.rb`.
NOTE: Defined in `active_support/core_ext/numeric/conversions.rb`.
Extensions to `Integer`
-----------------------
......@@ -2045,7 +2046,7 @@ BigDecimal.new(5.00, 6).to_s # => "5.0"
### `to_formatted_s`
Te method `to_formatted_s` provides a default specifier of "F". This means that a simple call to `to_formatted_s` or `to_s` will result in floating point representation instead of engineering notation:
The method `to_formatted_s` provides a default specifier of "F". This means that a simple call to `to_formatted_s` or `to_s` will result in floating point representation instead of engineering notation:
```ruby
BigDecimal.new(5.00, 6).to_formatted_s # => "5.0"
......@@ -2432,7 +2433,7 @@ dup[1][2] = 4
array[1][2] == nil # => true
```
NOTE: Defined in `active_support/core_ext/array/deep_dup.rb`.
NOTE: Defined in `active_support/core_ext/object/deep_dup.rb`.
### Grouping
......@@ -2658,45 +2659,7 @@ hash[:b][:e] == nil # => true
hash[:b][:d] == [3, 4] # => true
```
NOTE: Defined in `active_support/core_ext/hash/deep_dup.rb`.
### Diffing
The method `diff` returns a hash that represents a diff of the receiver and the argument with the following logic:
* Pairs `key`, `value` that exist in both hashes do not belong to the diff hash.
* If both hashes have `key`, but with different values, the pair in the receiver wins.
* The rest is just merged.
```ruby
{a: 1}.diff(a: 1)
# => {}, first rule
{a: 1}.diff(a: 2)
# => {:a=>1}, second rule
{a: 1}.diff(b: 2)
# => {:a=>1, :b=>2}, third rule
{a: 1, b: 2, c: 3}.diff(b: 1, c: 3, d: 4)
# => {:a=>1, :b=>2, :d=>4}, all rules
{}.diff({}) # => {}
{a: 1}.diff({}) # => {:a=>1}
{}.diff(a: 1) # => {:a=>1}
```
An important property of this diff hash is that you can retrieve the original hash by applying `diff` twice:
```ruby
hash.diff(hash2).diff(hash2) == hash
```
Diffing hashes may be useful for error messages related to expected option hashes for example.
NOTE: Defined in `active_support/core_ext/hash/diff.rb`.
NOTE: Defined in `active_support/core_ext/object/deep_dup.rb`.
### Working with Keys
......@@ -3831,13 +3794,13 @@ def default_helper_module!
module_path = module_name.underscore
helper module_path
rescue MissingSourceFile => e
raise e unless e.is_missing? "#{module_path}_helper"
raise e unless e.is_missing? "helpers/#{module_path}_helper"
rescue NameError => e
raise e unless e.missing_name? "#{module_name}Helper"
end
```
NOTE: Defined in `active_support/core_ext/name_error.rb`.
NOTE: Defined in `actionpack/lib/abstract_controller/helpers.rb`.
Extensions to `LoadError`
-------------------------
......@@ -3860,4 +3823,4 @@ rescue NameError => e
end
```
NOTE: Defined in `active_support/core_ext/load_error.rb`.
NOTE: Defined in `actionpack/lib/abstract_controller/helpers.rb`.
......@@ -381,12 +381,13 @@ About your application's environment
Ruby version 1.9.3 (x86_64-linux)
RubyGems version 1.3.6
Rack version 1.3
Rails version 4.0.0
Rails version 4.1.0
JavaScript Runtime Node.js (V8)
Active Record version 4.0.0
Action Pack version 4.0.0
Action Mailer version 4.0.0
Active Support version 4.0.0
Active Record version 4.1.0
Action Pack version 4.1.0
Action View version 4.1.0
Action Mailer version 4.1.0
Active Support version 4.1.0
Middleware Rack::Sendfile, ActionDispatch::Static, Rack::Lock, #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x007ffd131a7c88>, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::DebugExceptions, ActionDispatch::RemoteIp, ActionDispatch::Reloader, ActionDispatch::Callbacks, ActiveRecord::Migration::CheckPending, ActiveRecord::ConnectionAdapters::ConnectionManagement, ActiveRecord::QueryCache, ActionDispatch::Cookies, ActionDispatch::Session::EncryptedCookieStore, ActionDispatch::Flash, ActionDispatch::ParamsParser, Rack::Head, Rack::ConditionalGet, Rack::ETag
Application root /home/foobar/commandsapp
Environment development
......
......@@ -57,9 +57,15 @@ If you are on Fedora or CentOS, you can run
$ sudo yum install libxml2 libxml2-devel libxslt libxslt-devel
```
If you are running Arch Linux, you're done with:
```bash
$ sudo pacman -S libxml2 libxslt
```
If you have any problems with these libraries, you can install them manually by compiling the source code. Just follow the instructions at the [Red Hat/CentOS section of the Nokogiri tutorials](http://nokogiri.org/tutorials/installing_nokogiri.html#red_hat__centos) .
Also, SQLite3 and its development files for the `sqlite3-ruby` gem — in Ubuntu you're done with just
Also, SQLite3 and its development files for the `sqlite3` gem — in Ubuntu you're done with just
```bash
$ sudo apt-get install sqlite3 libsqlite3-dev
......@@ -71,6 +77,12 @@ And if you are on Fedora or CentOS, you're done with
$ sudo yum install sqlite3 sqlite3-devel
```
If you are on Arch Linux, you will need to run:
```bash
$ sudo pacman -S sqlite
```
Get a recent version of [Bundler](http://gembundler.com/)
```bash
......@@ -137,6 +149,14 @@ $ sudo yum install mysql-server mysql-devel
$ sudo yum install postgresql-server postgresql-devel
```
If you are running Arch Linux, MySQL isn't supported anymore so you will need to
use MariaDB instead (see [this announcement](https://www.archlinux.org/news/mariadb-replaces-mysql-in-repositories/)):
```bash
$ sudo pacman -S mariadb libmariadbclient mariadb-clients
$ sudo pacman -S postgresql postgresql-libs
```
After that, run:
```bash
......
......@@ -322,7 +322,7 @@ config.assets.js_compressor = :uglifier
### sass-rails
* `asset_url` with two arguments is deprecated. For example: `asset-url("rails.png", image)` becomes `asset-url("rails.png")`
* `asset-url` with two arguments is deprecated. For example: `asset-url("rails.png", image)` becomes `asset-url("rails.png")`
Upgrading from Rails 3.1 to Rails 3.2
-------------------------------------
......
......@@ -16,8 +16,7 @@ class Task < RDoc::Task
:include => %w(
README.rdoc
lib/active_record/**/*.rb
),
:exclude => 'lib/active_record/vendor/*'
)
},
'activemodel' => {
......@@ -33,23 +32,22 @@ class Task < RDoc::Task
lib/abstract_controller/**/*.rb
lib/action_controller/**/*.rb
lib/action_dispatch/**/*.rb
),
:exclude => 'lib/action_controller/vendor/*'
)
},
'actionview' => {
:include => %w(
README.rdoc
lib/action_view/**/*.rb
)
),
:exclude => 'lib/action_view/vendor/*'
},
'actionmailer' => {
:include => %w(
README.rdoc
lib/action_mailer/**/*.rb
),
:exclude => 'lib/action_mailer/vendor/*'
)
},
'railties' => {
......
......@@ -2,7 +2,7 @@
module Rails
module AppRailsLoader
RUBY = File.join(*RbConfig::CONFIG.values_at("bindir", "ruby_install_name")) + RbConfig::CONFIG["EXEEXT"]
RUBY = Gem.ruby
EXECUTABLES = ['bin/rails', 'script/rails']
BUNDLER_WARNING = <<EOS
Looks like your app's ./bin/rails is a stub that was generated by Bundler.
......
......@@ -351,8 +351,13 @@ def inherited(base)
Rails::Railtie::Configuration.eager_load_namespaces << base
base.called_from = begin
# Remove the line number from backtraces making sure we don't leave anything behind
call_stack = caller.map { |p| p.sub(/:\d+.*/, '') }
call_stack = if Kernel.respond_to?(:caller_locations)
caller_locations.map(&:path)
else
# Remove the line number from backtraces making sure we don't leave anything behind
caller.map { |p| p.sub(/:\d+.*/, '') }
end
File.dirname(call_stack.detect { |p| p !~ %r[railties[\w.-]*/lib/rails|rack[\w.-]*/lib/rack] })
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册