Documentation

Installing Rails Designer

Installing Rails Designer can be done with just one command (keep your Rails Designer key ready):

rails app:template LOCATION="https://railsdesigner.com/setup/"

If you want to add Rails Designer manually, just follow the next steps.

1. Add the Rails Designer and rails_icons gem to your Gemfile

source "https://get.railsdesigner.com/private" do
  gem "rails_designer", "~> 1.9.0"
end

gem "rails_icons", "~> 0.4.0"

(rails_icons is optional, but really recommendeded!)

2. Add the API Key you received via email

export BUNDLE_GET__RAILSDESIGNER__COM=<api_key>

This is using Bundler’s configuration keys under the hood. Other ways to store the Rails Designer API key are:

  • bundle config set --global get.railsdesigner.com <api_key>
  • or using basic authentication, like so: source "https://<api_key>@get.railsdesigner.com/private" do

It’s advised against employing the Rails Designer API key for basic authentication, as this method significantly increases the likelihood of it being exposed publicly.

3. Bundle to fetch the Rails Designer gem

bundle

4. Run the Rails Designer install command

rails generate rails_designer:install

This will create the configuration file config/initializer/rails_designer.rb and add the route to the Rails Designer engine. Check out this article about the initializer.

5. Create the rails_icons initializer and sync heroicons library icons

This will create the rails_config initializer and sync the heroicons library’s icons. If you don’t installed the rails_icons gem, you can skip this step.

rails generate rails_icons:initializer
rails generate rails_icons:sync heroicons

Contain Rails Designer to development

Rails Designer’s default set up only allows access in development, but the gem would still be installed/fetched in production. If you want to “lock” it down to only development, take the following steps:

Note: if you use any of the view helpers, make sure you have copied them into your app instead of using from the gem. Check out the generator on how to do it.

1. Move the gem into development group

group :development, :test do
  # …
  source "https://get.railsdesigner.com/private" do
    gem "rails_designer", "~> 1.9.0"
  end
end

2. Wrap the engine route

# config/routes.rb
if Rails.env.development?
  mount RailsDesigner::Engine, at: "/rails_designer"
end

3. Wrap the initializer

# config/initializers/rails_designer.rb
if defined?(RailsDesigner) && Rails.env.development?
  RailsDesigner.configure do |config|
    # Rest of the initializer
  end
end

Help

Use the --help flag to view the command’s help.

rails generate rails_designer:install --help