Methods
- A
- C
- E
- F
- H
- I
- J
- M
- N
- P
- R
- S
- T
- U
Class Private methods
check_class_collision(options = {}) Link
Add a class collisions name to be checked on class initialization. You can supply a hash with a :prefix
or :suffix
to be tested.
Examples
check_class_collision suffix: "Decorator"
If the generator is invoked with class name Admin, it will check for the presence of “AdminDecorator”.
# File railties/lib/rails/generators/named_base.rb, line 214 def self.check_class_collision(options = {}) # :doc: define_method :check_class_collision do name = if respond_to?(:controller_class_name, true) # for ResourceHelpers controller_class_name else class_name end class_collisions "#{options[:prefix]}#{name}#{options[:suffix]}" end end
Instance Public methods
js_template(source, destination) Link
template(source, *args, &block) Link
Instance Private methods
application_name() Link
Tries to retrieve the application name or simply return application.
attributes_names() Link
# File railties/lib/rails/generators/named_base.rb, line 188 def attributes_names # :doc: @attributes_names ||= attributes.each_with_object([]) do |a, names| names << a.column_name names << "password_confirmation" if a.password_digest? names << "#{a.name}_type" if a.polymorphic? end end
class_name() Link
class_path() Link
edit_helper(...) Link
file_path() Link
fixture_file_name() Link
human_name() Link
i18n_scope() Link
index_helper(type: nil) Link
inside_template() Link
inside_template?() Link
model_resource_name(base_name = singular_table_name, prefix: "") Link
# File railties/lib/rails/generators/named_base.rb, line 150 def model_resource_name(base_name = singular_table_name, prefix: "") # :doc: resource_name = "#{prefix}#{base_name}" if options[:model_name] "[#{controller_class_path.map { |name| ":" + name }.join(", ")}, #{resource_name}]" else resource_name end end
mountable_engine?() Link
namespaced_class_path() Link
new_helper(type: :url) Link
plural_file_name() Link
plural_name() Link
plural_route_name() Link
plural_table_name() Link
pluralize_table_names?() Link
redirect_resource_name() Link
regular_class_path() Link
route_url() Link
show_helper(arg = "@#{singular_table_name}", type: :url) Link
singular_name() Link
FIXME: We are avoiding to use alias because a bug on thor that make this method public and add it to the task list.