`self.` is not needed when calling its own instance method
Actually, private methods cannot be called with `self.`, so it's not just redundant, it's a bad habit in Ruby
This commit is contained in:
parent
6197a38bca
commit
5473e390d3
|
@ -31,7 +31,7 @@ module ActionCable
|
|||
self.cable = Rails.application.config_for(config_path).with_indifferent_access
|
||||
end
|
||||
|
||||
previous_connection_class = self.connection_class
|
||||
previous_connection_class = connection_class
|
||||
self.connection_class = -> { "ApplicationCable::Connection".safe_constantize || previous_connection_class.call }
|
||||
|
||||
options.each { |k, v| send("#{k}=", v) }
|
||||
|
|
|
@ -13,7 +13,7 @@ module Rails
|
|||
template "channel.rb", File.join("app/channels", class_path, "#{file_name}_channel.rb")
|
||||
|
||||
if options[:assets]
|
||||
if self.behavior == :invoke
|
||||
if behavior == :invoke
|
||||
template "assets/cable.js", "app/assets/javascripts/cable.js"
|
||||
end
|
||||
|
||||
|
@ -30,7 +30,7 @@ module Rails
|
|||
|
||||
# FIXME: Change these files to symlinks once RubyGems 2.5.0 is required.
|
||||
def generate_application_cable_files
|
||||
return if self.behavior != :invoke
|
||||
return if behavior != :invoke
|
||||
|
||||
files = [
|
||||
"application_cable/channel.rb",
|
||||
|
|
|
@ -59,7 +59,7 @@ module ActionMailer
|
|||
end
|
||||
|
||||
def wrap_delivery_behavior(mail, method = nil, options = nil) # :nodoc:
|
||||
method ||= self.delivery_method
|
||||
method ||= delivery_method
|
||||
mail.delivery_handler = self
|
||||
|
||||
case method
|
||||
|
|
|
@ -63,7 +63,7 @@ module ActionMailer
|
|||
# interceptors will be informed so that they can transform the message
|
||||
# as they would if the mail was actually being delivered.
|
||||
def call(email)
|
||||
preview = self.new
|
||||
preview = new
|
||||
message = preview.public_send(email)
|
||||
inform_preview_interceptors(message)
|
||||
message
|
||||
|
|
|
@ -57,7 +57,7 @@ module ActionMailer
|
|||
end
|
||||
|
||||
def mailer_class
|
||||
if mailer = self._mailer_class
|
||||
if mailer = _mailer_class
|
||||
mailer
|
||||
else
|
||||
tests determine_default_mailer(name)
|
||||
|
|
|
@ -11,7 +11,7 @@ module Rails
|
|||
template "mailer.rb", File.join("app/mailers", class_path, "#{file_name}_mailer.rb")
|
||||
|
||||
in_root do
|
||||
if self.behavior == :invoke && !File.exist?(application_mailer_file_name)
|
||||
if behavior == :invoke && !File.exist?(application_mailer_file_name)
|
||||
template "application_mailer.rb", application_mailer_file_name
|
||||
end
|
||||
end
|
||||
|
|
|
@ -37,7 +37,7 @@ module ActionController
|
|||
|
||||
if include_content?(response_code)
|
||||
self.content_type = content_type || (Mime[formats.first] if formats)
|
||||
self.response.charset = false
|
||||
response.charset = false
|
||||
end
|
||||
|
||||
true
|
||||
|
|
|
@ -114,7 +114,7 @@ module ActionController
|
|||
|
||||
self.status = status if status
|
||||
self.content_type = content_type if content_type
|
||||
self.headers["Location"] = url_for(location) if location
|
||||
headers["Location"] = url_for(location) if location
|
||||
|
||||
super
|
||||
end
|
||||
|
|
|
@ -150,7 +150,7 @@ module ActionController
|
|||
# permitted flag.
|
||||
def ==(other)
|
||||
if other.respond_to?(:permitted?)
|
||||
self.permitted? == other.permitted? && self.parameters == other.parameters
|
||||
permitted? == other.permitted? && parameters == other.parameters
|
||||
else
|
||||
@parameters == other
|
||||
end
|
||||
|
|
|
@ -354,7 +354,7 @@ module ActionController
|
|||
end
|
||||
|
||||
def controller_class
|
||||
if current_controller_class = self._controller_class
|
||||
if current_controller_class = _controller_class
|
||||
current_controller_class
|
||||
else
|
||||
self.controller_class = determine_default_controller_class(name)
|
||||
|
|
|
@ -269,8 +269,8 @@ class IntegrationProcessTest < ActionDispatch::IntegrationTest
|
|||
|
||||
test "response cookies are added to the cookie jar for the next request" do
|
||||
with_test_route_set do
|
||||
self.cookies["cookie_1"] = "sugar"
|
||||
self.cookies["cookie_2"] = "oatmeal"
|
||||
cookies["cookie_1"] = "sugar"
|
||||
cookies["cookie_2"] = "oatmeal"
|
||||
get "/cookie_monster"
|
||||
assert_equal "cookie_1=; path=/\ncookie_3=chocolate; path=/", headers["Set-Cookie"]
|
||||
assert_equal({ "cookie_1" => "", "cookie_2" => "oatmeal", "cookie_3" => "chocolate" }, cookies.to_hash)
|
||||
|
|
|
@ -26,7 +26,7 @@ module AbstractController
|
|||
action: :index
|
||||
}
|
||||
}.url_helpers
|
||||
self.default_url_options[:host] = "example.com"
|
||||
default_url_options[:host] = "example.com"
|
||||
}
|
||||
|
||||
path = klass.new.fun_path(controller: :articles,
|
||||
|
|
|
@ -1603,7 +1603,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
|
|||
get "account/login", to: redirect("/login")
|
||||
end
|
||||
|
||||
previous_host, self.host = self.host, "www.example.com:3000"
|
||||
previous_host, self.host = host, "www.example.com:3000"
|
||||
|
||||
get "/account/login"
|
||||
verify_redirect "http://www.example.com:3000/login"
|
||||
|
|
|
@ -16,7 +16,7 @@ module ActionView
|
|||
|
||||
class << self
|
||||
def select_type
|
||||
@select_type ||= self.name.split("::").last.sub("Select", "").downcase
|
||||
@select_type ||= name.split("::").last.sub("Select", "").downcase
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ module ActionView
|
|||
|
||||
class << self
|
||||
def field_type
|
||||
@field_type ||= self.name.split("::").last.sub("Field", "").downcase
|
||||
@field_type ||= name.split("::").last.sub("Field", "").downcase
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -319,7 +319,7 @@ module ActionView
|
|||
name_clause
|
||||
end
|
||||
|
||||
self.class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
||||
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
||||
def _layout(formats)
|
||||
if _conditional_layout?
|
||||
#{layout_definition}
|
||||
|
|
|
@ -206,8 +206,8 @@ module ActionView
|
|||
view = @controller.view_context
|
||||
view.singleton_class.include(_helpers)
|
||||
view.extend(Locals)
|
||||
view.rendered_views = self.rendered_views
|
||||
view.output_buffer = self.output_buffer
|
||||
view.rendered_views = rendered_views
|
||||
view.output_buffer = output_buffer
|
||||
view
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ module ActionView
|
|||
included do
|
||||
class_attribute :_view_paths
|
||||
self._view_paths = ActionView::PathSet.new
|
||||
self._view_paths.freeze
|
||||
_view_paths.freeze
|
||||
end
|
||||
|
||||
delegate :template_exists?, :any_templates?, :view_paths, :formats, :formats=,
|
||||
|
|
|
@ -61,7 +61,7 @@ end
|
|||
|
||||
class PolymorphicRoutesTest < ActionController::TestCase
|
||||
include SharedTestRoutes.url_helpers
|
||||
self.default_url_options[:host] = "example.com"
|
||||
default_url_options[:host] = "example.com"
|
||||
|
||||
def setup
|
||||
@project = Project.new
|
||||
|
|
|
@ -19,7 +19,7 @@ module Rails # :nodoc:
|
|||
template "job.rb", File.join("app/jobs", class_path, "#{file_name}_job.rb")
|
||||
|
||||
in_root do
|
||||
if self.behavior == :invoke && !File.exist?(application_job_file_name)
|
||||
if behavior == :invoke && !File.exist?(application_job_file_name)
|
||||
template "application_job.rb", application_job_file_name
|
||||
end
|
||||
end
|
||||
|
|
|
@ -56,7 +56,7 @@ class QueueNamingTest < ActiveSupport::TestCase
|
|||
original_queue_name = HelloJob.queue_name
|
||||
|
||||
begin
|
||||
HelloJob.queue_as { self.arguments.first == "1" ? :one : :two }
|
||||
HelloJob.queue_as { arguments.first == "1" ? :one : :two }
|
||||
assert_equal "one", HelloJob.new("1").queue_name
|
||||
assert_equal "two", HelloJob.new("3").queue_name
|
||||
ensure
|
||||
|
|
|
@ -32,7 +32,7 @@ class QueuePriorityTest < ActiveSupport::TestCase
|
|||
original_priority = HelloJob.priority
|
||||
|
||||
begin
|
||||
HelloJob.queue_with_priority { self.arguments.first == "1" ? 99 : 11 }
|
||||
HelloJob.queue_with_priority { arguments.first == "1" ? 99 : 11 }
|
||||
assert_equal 99, HelloJob.new("1").priority
|
||||
assert_equal 11, HelloJob.new("3").priority
|
||||
ensure
|
||||
|
|
|
@ -4,7 +4,7 @@ module Sneakers
|
|||
module Worker
|
||||
module ClassMethods
|
||||
def enqueue(msg)
|
||||
worker = self.new(nil, nil, {})
|
||||
worker = new(nil, nil, {})
|
||||
worker.work(*msg)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -234,7 +234,7 @@ module ActiveModel
|
|||
# Person.model_name.plural # => "people"
|
||||
def model_name
|
||||
@_model_name ||= begin
|
||||
namespace = self.parents.detect do |n|
|
||||
namespace = parents.detect do |n|
|
||||
n.respond_to?(:use_relative_model_naming?) && n.use_relative_model_naming?
|
||||
end
|
||||
ActiveModel::Name.new(self, namespace)
|
||||
|
|
|
@ -44,7 +44,7 @@ module ActiveModel
|
|||
parts = attribute.to_s.split(".")
|
||||
attribute = parts.pop
|
||||
namespace = parts.join("/") unless parts.empty?
|
||||
attributes_scope = "#{self.i18n_scope}.attributes"
|
||||
attributes_scope = "#{i18n_scope}.attributes"
|
||||
|
||||
if namespace
|
||||
defaults = lookup_ancestors.map do |klass|
|
||||
|
|
|
@ -1857,7 +1857,7 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
has_many name, scope, hm_options, &extension
|
||||
self._reflections[name.to_s].parent_reflection = habtm_reflection
|
||||
_reflections[name.to_s].parent_reflection = habtm_reflection
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -100,7 +100,7 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
def delete_or_nullify_all_records(method)
|
||||
count = delete_count(method, self.scope)
|
||||
count = delete_count(method, scope)
|
||||
update_counter(-count)
|
||||
end
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ module ActiveRecord
|
|||
# available.
|
||||
def to_key
|
||||
sync_with_transaction_state
|
||||
key = self.id
|
||||
key = id
|
||||
[key] if key
|
||||
end
|
||||
|
||||
|
|
|
@ -328,9 +328,9 @@ module ActiveRecord
|
|||
def association_valid?(reflection, record, index = nil)
|
||||
return true if record.destroyed? || (reflection.options[:autosave] && record.marked_for_destruction?)
|
||||
|
||||
validation_context = self.validation_context unless [:create, :update].include?(self.validation_context)
|
||||
context = validation_context unless [:create, :update].include?(validation_context)
|
||||
|
||||
unless valid = record.valid?(validation_context)
|
||||
unless valid = record.valid?(context)
|
||||
if reflection.options[:autosave]
|
||||
indexed_attribute = !index.nil? && (reflection.options[:index_errors] || ActiveRecord::Base.index_nested_attribute_errors)
|
||||
|
||||
|
|
|
@ -450,7 +450,7 @@ module ActiveRecord
|
|||
# [ Person.find(1), Person.find(2), Person.find(3) ] & [ Person.find(1), Person.find(4) ] # => [ Person.find(1) ]
|
||||
def hash
|
||||
if id
|
||||
self.class.hash ^ self.id.hash
|
||||
self.class.hash ^ id.hash
|
||||
else
|
||||
super
|
||||
end
|
||||
|
@ -472,7 +472,7 @@ module ActiveRecord
|
|||
# Allows sort on objects
|
||||
def <=>(other_object)
|
||||
if other_object.is_a?(self.class)
|
||||
self.to_key <=> other_object.to_key
|
||||
to_key <=> other_object.to_key
|
||||
else
|
||||
super
|
||||
end
|
||||
|
|
|
@ -885,7 +885,7 @@ module ActiveRecord
|
|||
#
|
||||
# The keys must be the fixture names, that coincide with the short paths to the fixture files.
|
||||
def set_fixture_class(class_names = {})
|
||||
self.fixture_class_names = self.fixture_class_names.merge(class_names.stringify_keys)
|
||||
self.fixture_class_names = fixture_class_names.merge(class_names.stringify_keys)
|
||||
end
|
||||
|
||||
def fixtures(*fixture_set_names)
|
||||
|
|
|
@ -393,7 +393,7 @@ module ActiveRecord
|
|||
# update_only is true, and a <tt>:_destroy</tt> key set to a truthy value,
|
||||
# then the existing record will be marked for destruction.
|
||||
def assign_nested_attributes_for_one_to_one_association(association_name, attributes)
|
||||
options = self.nested_attributes_options[association_name]
|
||||
options = nested_attributes_options[association_name]
|
||||
if attributes.respond_to?(:permitted?)
|
||||
attributes = attributes.to_h
|
||||
end
|
||||
|
@ -452,7 +452,7 @@ module ActiveRecord
|
|||
# { id: '2', _destroy: true }
|
||||
# ])
|
||||
def assign_nested_attributes_for_collection_association(association_name, attributes_collection)
|
||||
options = self.nested_attributes_options[association_name]
|
||||
options = nested_attributes_options[association_name]
|
||||
if attributes_collection.respond_to?(:permitted?)
|
||||
attributes_collection = attributes_collection.to_h
|
||||
end
|
||||
|
@ -562,7 +562,7 @@ module ActiveRecord
|
|||
def call_reject_if(association_name, attributes)
|
||||
return false if will_be_destroyed?(association_name, attributes)
|
||||
|
||||
case callback = self.nested_attributes_options[association_name][:reject_if]
|
||||
case callback = nested_attributes_options[association_name][:reject_if]
|
||||
when Symbol
|
||||
method(callback).arity == 0 ? send(callback) : send(callback, attributes)
|
||||
when Proc
|
||||
|
|
|
@ -87,8 +87,8 @@ module ActiveRecord
|
|||
if File.file?(filename)
|
||||
cache = YAML.load(File.read(filename))
|
||||
if cache.version == ActiveRecord::Migrator.current_version
|
||||
self.connection.schema_cache = cache
|
||||
self.connection_pool.schema_cache = cache.dup
|
||||
connection.schema_cache = cache
|
||||
connection_pool.schema_cache = cache.dup
|
||||
else
|
||||
warn "Ignoring db/schema_cache.yml because it has expired. The current schema version is #{ActiveRecord::Migrator.current_version}, but the one in the cache is #{cache.version}."
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ module ActiveRecord
|
|||
# Attributes listed as readonly will be used to create a new record but update operations will
|
||||
# ignore these fields.
|
||||
def attr_readonly(*attributes)
|
||||
self._attr_readonly = Set.new(attributes.map(&:to_s)) + (self._attr_readonly || [])
|
||||
self._attr_readonly = Set.new(attributes.map(&:to_s)) + (_attr_readonly || [])
|
||||
end
|
||||
|
||||
# Returns an array of all the attributes that have been specified as readonly.
|
||||
|
|
|
@ -260,7 +260,7 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
def act_on_ignored_order(error_on_ignore)
|
||||
raise_error = (error_on_ignore.nil? ? self.klass.error_on_ignored_order : error_on_ignore)
|
||||
raise_error = (error_on_ignore.nil? ? klass.error_on_ignored_order : error_on_ignore)
|
||||
|
||||
if raise_error
|
||||
raise ArgumentError.new(ORDER_IGNORE_MESSAGE)
|
||||
|
|
|
@ -193,7 +193,7 @@ module ActiveRecord
|
|||
|
||||
# If #count is used with #distinct (i.e. `relation.distinct.count`) it is
|
||||
# considered distinct.
|
||||
distinct = self.distinct_value
|
||||
distinct = distinct_value
|
||||
|
||||
if operation == "count"
|
||||
column_name ||= select_for_count
|
||||
|
|
|
@ -656,7 +656,7 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
self.where_clause = self.where_clause.or(other.where_clause)
|
||||
self.having_clause = self.having_clause.or(other.having_clause)
|
||||
self.having_clause = having_clause.or(other.having_clause)
|
||||
|
||||
self
|
||||
end
|
||||
|
|
|
@ -46,7 +46,7 @@ module ActiveRecord
|
|||
#
|
||||
# sanitize_sql_for_assignment("name=NULL and group_id='4'")
|
||||
# # => "name=NULL and group_id='4'"
|
||||
def sanitize_sql_for_assignment(assignments, default_table_name = self.table_name) # :doc:
|
||||
def sanitize_sql_for_assignment(assignments, default_table_name = table_name) # :doc:
|
||||
case assignments
|
||||
when Array; sanitize_sql_array(assignments)
|
||||
when Hash; sanitize_sql_hash_for_assignment(assignments, default_table_name)
|
||||
|
|
|
@ -27,7 +27,7 @@ module ActiveRecord
|
|||
# Load securerandom only when has_secure_token is used.
|
||||
require "active_support/core_ext/securerandom"
|
||||
define_method("regenerate_#{attribute}") { update! attribute => self.class.generate_unique_secure_token }
|
||||
before_create { self.send("#{attribute}=", self.class.generate_unique_secure_token) unless self.send("#{attribute}?") }
|
||||
before_create { send("#{attribute}=", self.class.generate_unique_secure_token) unless send("#{attribute}?") }
|
||||
end
|
||||
|
||||
def generate_unique_secure_token
|
||||
|
|
|
@ -41,7 +41,7 @@ module ActiveRecord
|
|||
|
||||
# FIXME: Change this file to a symlink once RubyGems 2.5.0 is required.
|
||||
def generate_application_record
|
||||
if self.behavior == :invoke && !application_record_exist?
|
||||
if behavior == :invoke && !application_record_exist?
|
||||
template "application_record.rb", application_record_file_name
|
||||
end
|
||||
end
|
||||
|
|
|
@ -37,7 +37,7 @@ class TestAutosaveAssociationsInGeneral < ActiveRecord::TestCase
|
|||
private
|
||||
|
||||
def should_be_cool
|
||||
unless self.first_name == "cool"
|
||||
unless first_name == "cool"
|
||||
errors.add :first_name, "not cool"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -125,11 +125,11 @@ class ContextualCallbacksDeveloper < ActiveRecord::Base
|
|||
after_validation :after_validation_on_create_and_update, on: [ :create, :update ]
|
||||
|
||||
def before_validation_on_create_and_update
|
||||
history << "before_validation_on_#{self.validation_context}".to_sym
|
||||
history << "before_validation_on_#{validation_context}".to_sym
|
||||
end
|
||||
|
||||
def after_validation_on_create_and_update
|
||||
history << "after_validation_on_#{self.validation_context}".to_sym
|
||||
history << "after_validation_on_#{validation_context}".to_sym
|
||||
end
|
||||
|
||||
def history
|
||||
|
|
|
@ -1012,7 +1012,7 @@ end
|
|||
|
||||
class FixtureClassNamesTest < ActiveRecord::TestCase
|
||||
def setup
|
||||
@saved_cache = self.fixture_class_names.dup
|
||||
@saved_cache = fixture_class_names.dup
|
||||
end
|
||||
|
||||
def teardown
|
||||
|
|
|
@ -18,7 +18,7 @@ class LockWithoutDefault < ActiveRecord::Base; end
|
|||
|
||||
class LockWithCustomColumnWithoutDefault < ActiveRecord::Base
|
||||
self.table_name = :lock_without_defaults_cust
|
||||
self.column_defaults # to test @column_defaults caching.
|
||||
column_defaults # to test @column_defaults caching.
|
||||
self.locking_column = :custom_lock_version
|
||||
end
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
test "#reorder!" do
|
||||
@relation = self.relation.order("foo")
|
||||
@relation = relation.order("foo")
|
||||
|
||||
assert relation.reorder!("bar").equal?(relation)
|
||||
assert_equal ["bar"], relation.order_values
|
||||
|
|
|
@ -422,7 +422,7 @@ class TimestampTest < ActiveRecord::TestCase
|
|||
self.table_name = "people"
|
||||
|
||||
before_create do
|
||||
self.born_at = self.created_at
|
||||
self.born_at = created_at
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ class GpsLocation
|
|||
end
|
||||
|
||||
def ==(other)
|
||||
self.latitude == other.latitude && self.longitude == other.longitude
|
||||
latitude == other.latitude && longitude == other.longitude
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ class Array
|
|||
# [1, 2, 3, 4, 5].split(3) # => [[1, 2], [4, 5]]
|
||||
# (1..10).to_a.split { |i| i % 3 == 0 } # => [[1, 2], [4, 5], [7, 8], [10]]
|
||||
def split(value = nil)
|
||||
arr = self.dup
|
||||
arr = dup
|
||||
result = []
|
||||
if block_given?
|
||||
while (idx = arr.index { |i| yield i })
|
||||
|
|
|
@ -133,7 +133,7 @@ class Date
|
|||
# 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)
|
||||
self.to_datetime <=> other
|
||||
to_datetime <=> other
|
||||
else
|
||||
compare_without_coercion(other)
|
||||
end
|
||||
|
|
|
@ -43,7 +43,7 @@ module ActiveSupport
|
|||
end
|
||||
}
|
||||
end
|
||||
result = Marshal.dump(self.dup)
|
||||
result = Marshal.dump(dup)
|
||||
end
|
||||
|
||||
write.puts [result].pack("m")
|
||||
|
@ -78,7 +78,7 @@ module ActiveSupport
|
|||
"ISOLATION_OUTPUT" => tmpfile.path
|
||||
}
|
||||
|
||||
test_opts = "-n#{self.class.name}##{self.name}"
|
||||
test_opts = "-n#{self.class.name}##{name}"
|
||||
|
||||
load_path_args = []
|
||||
$-I.each do |p|
|
||||
|
|
|
@ -73,7 +73,7 @@ module ActiveSupport
|
|||
|
||||
LibXML::XML::Error.set_handler(&LibXML::XML::Error::QUIET_HANDLER)
|
||||
parser = LibXML::XML::SaxParser.io(data)
|
||||
document = self.document_class.new
|
||||
document = document_class.new
|
||||
|
||||
parser.callbacks = document
|
||||
parser.parse
|
||||
|
|
|
@ -76,7 +76,7 @@ module ActiveSupport
|
|||
{}
|
||||
else
|
||||
data.ungetc(char)
|
||||
document = self.document_class.new
|
||||
document = document_class.new
|
||||
parser = Nokogiri::XML::SAX::Parser.new(document)
|
||||
parser.parse(data)
|
||||
document.hash
|
||||
|
|
|
@ -131,7 +131,7 @@ module Rails
|
|||
|
||||
def colorize_logging=(val)
|
||||
ActiveSupport::LogSubscriber.colorize_logging = val
|
||||
self.generators.colorize_logging = val
|
||||
generators.colorize_logging = val
|
||||
end
|
||||
|
||||
def session_store(new_session_store = nil, **options)
|
||||
|
|
|
@ -380,7 +380,7 @@ module Rails
|
|||
def isolate_namespace(mod)
|
||||
engine_name(generate_railtie_name(mod.name))
|
||||
|
||||
self.routes.default_scope = { module: ActiveSupport::Inflector.underscore(mod.name) }
|
||||
routes.default_scope = { module: ActiveSupport::Inflector.underscore(mod.name) }
|
||||
self.isolated = true
|
||||
|
||||
unless mod.respond_to?(:railtie_namespace)
|
||||
|
@ -573,7 +573,7 @@ module Rails
|
|||
end
|
||||
|
||||
initializer :add_routing_paths do |app|
|
||||
routing_paths = self.paths["config/routes.rb"].existent
|
||||
routing_paths = paths["config/routes.rb"].existent
|
||||
|
||||
if routes? || routing_paths.any?
|
||||
app.routes_reloader.paths.unshift(*routing_paths)
|
||||
|
|
|
@ -269,7 +269,7 @@ module Rails
|
|||
if args.size == 1
|
||||
say args.first.to_s unless options.quiet?
|
||||
else
|
||||
args << (self.behavior == :invoke ? :green : :red)
|
||||
args << (behavior == :invoke ? :green : :red)
|
||||
say_status(*args)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -331,7 +331,7 @@ module Rails
|
|||
def self.prepare_for_invocation(name, value) #:nodoc:
|
||||
return super unless value.is_a?(String) || value.is_a?(Symbol)
|
||||
|
||||
if value && constants = self.hooks[name]
|
||||
if value && constants = hooks[name]
|
||||
value = name if TrueClass === value
|
||||
Rails::Generators.find_by_namespace(value, *constants)
|
||||
elsif klass = Rails::Generators.find_by_namespace(value)
|
||||
|
|
|
@ -9,7 +9,7 @@ module Erb # :nodoc:
|
|||
view_base_path = File.join("app/views", class_path, file_name + "_mailer")
|
||||
empty_directory view_base_path
|
||||
|
||||
if self.behavior == :invoke
|
||||
if behavior == :invoke
|
||||
formats.each do |format|
|
||||
layout_path = File.join("app/views/layouts", class_path, filename_with_extensions("mailer", format))
|
||||
template filename_with_extensions(:layout, format), layout_path
|
||||
|
|
|
@ -35,7 +35,7 @@ module Rails
|
|||
end
|
||||
|
||||
def set_migration_assigns!(destination)
|
||||
destination = File.expand_path(destination, self.destination_root)
|
||||
destination = File.expand_path(destination, destination_root)
|
||||
|
||||
migration_dir = File.dirname(destination)
|
||||
@migration_number = self.class.next_migration_number(migration_dir)
|
||||
|
|
|
@ -219,7 +219,7 @@ module Rails
|
|||
#
|
||||
def self.check_class_collision(options = {}) # :doc:
|
||||
define_method :check_class_collision do
|
||||
name = if self.respond_to?(:controller_class_name) # for ScaffoldBase
|
||||
name = if respond_to?(:controller_class_name) # for ScaffoldBase
|
||||
controller_class_name
|
||||
else
|
||||
class_name
|
||||
|
|
|
@ -17,7 +17,7 @@ if defined?(ActiveRecord::Base)
|
|||
class ActiveSupport::TestCase
|
||||
include ActiveRecord::TestFixtures
|
||||
self.fixture_path = "#{Rails.root}/test/fixtures/"
|
||||
self.file_fixture_path = self.fixture_path + "files"
|
||||
self.file_fixture_path = fixture_path + "files"
|
||||
end
|
||||
|
||||
ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path
|
||||
|
|
Loading…
Reference in New Issue