I am in the process of writing a Rails engine
but i am not sure how to extend my the config/application.rb
I guess i have to get to the application name somehow any ideas?
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env)
module application_name
class Application < Rails::Application
end
end
The configuration file config/application. rb and environment-specific configuration files (such as config/environments/production. rb ) allow you to specify the various settings that you want to pass down to all of the components. For example, you could add this setting to config/application.rb file: config.
In the environment. rb file you configure these run-levels. For example, you could use it to have some special settings for your development stage, which are usefull for debugging. The purpose of this file is to configure things for the whole application like encoding.
In general, the work of configuring Rails means configuring the components of Rails, as well as configuring Rails itself. The configuration file config/application. rb and environment-specific configuration files (such as config/environments/production.
1 What are Engines? Engines can be considered miniature applications that provide functionality to their host applications. A Rails application is actually just a "supercharged" engine, with the Rails::Application class inheriting a lot of its behavior from Rails::Engine .
For a --full and --mountable engine
This will be generated for you.
module engine_name
class Engine < ::Rails::Engine
end
end
In you main applications gemfile add
gem 'engine_name', path: "/path/to/engine_name"
And in your applications config/routes.rb file
mount engine_name::Engine, at: "/<mount_point_you_choose>"
http://guides.rubyonrails.org/engines.html
Taken from the link above...
The --mountable option tells the generator that you want to create a "mountable" and namespace-isolated engine. This generator will provide the same skeleton structure as would the --full option, and will add:
Asset manifest files (application.js and application.css) A namespaced ApplicationController stub A namespaced ApplicationHelper stub A layout view template for the engine Namespace isolation to config/routes.rb:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With