Question

Working on a project where a CMS will come in handy for FAQs, Help, and all that jazz. The problem that I've encountered is is that I've decided to use Alchemy CMS 3.0.0. I've followed the Guides on how to install with an existing Rails Application.

I added the gem. Gemfile currently appears as so:

source 'https://rubygems.org'
ruby '2.1.1'

gem 'rails', '4.1.0.rc2'
gem 'mysql2'

gem 'sass-rails',   '~> 4.0.1'
gem 'uglifier',     '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'

gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'

gem 'bcrypt', '~> 3.1.5'

gem 'alchemy_cms',    :github => 'magiclabs/alchemy_cms',  :branch => "3.0-stable"
gem 'wistia-api',     :github => "BenMorganIO/wistia-api", :branch => "customizations"
gem 'stripe',         :github => 'stripe/stripe-ruby'
gem 'ahoy_matey'
gem 'newrelic_rpm'
gem 'gravtastic'
gem 'intercom-rails', '~> 0.2.24'

group :doc do
  gem 'sdoc', '~> 0.4.0'
end

group :development do
  gem 'better_errors'
  gem 'binding_of_caller'
  gem 'meta_request'
end

group :development, :test do
  gem 'rspec-rails'
  gem 'cucumber-rails', :require => false
  gem 'database_cleaner'
end

group :production do
  gem 'rails_12factor'
end

And then I ran bundle. Afterwards, I ran bin/rake alchemy:install.

Once that was done, I ran rails server. The output was a 404 on my localhost. I then checked the log files and was presented with this error:

Alchemy is not mounted! Falling back to root path (/).
If you want to change Alchemy's mount point, please mount Alchemy::Engine in your config/routes.rb file.

I go over to config/routes.rb and I see that it does appear to be mounted:

Rails.application.routes.draw do
  mount Alchemy::Engine => '/'

  root 'home#index'

  get 'about' => 'home#about', :as => 'about'

  resources :users
  match "signup"       => "users#new",   :via => "get", :as => 'signup'
  match "account"      => "users#index", :via => "get", :as => 'account'
  match "account/edit" => 'users#edit',  :via => "get", :as => 'edit_account'

  resources :sessions, :only => [:new, :create, :destroy]
  # match "login"  => 'sessions#new',     :via => "get",    :as => 'login'
  match "logout" => 'sessions#destroy', :via => "delete", :as => 'logout'

  resources :channels

  resources :videos
  get '/videos/:id/:title' => 'videos#show', :as => 'video_by_title'

  resources :charges
end

I commented the login match as I believe Alchemy also has the exact same route. I have taken precautions and have commented everything out besides the Alchemy mount and the error still persists.

This is everything I've done.

Key Question: How do I get Alchemy working?

Was it helpful?

Solution

If you mount Alchemy::Engine => '/' first within your config/routes.rb it would take control of all requests, so what you need to do is mount your Alchemy engine after any resources you want to take precedence over your Alchemy application. So move that line to the bottom of your routes.rb allowing those other resources to assume priority over Alchemy, which will then serve as a catch-all for all other undefined routes.

If you're receiving a 404 at localhost:3000 with Alchemy mounted first-- what I believe is happening is that you're hitting the root route for your Alchemy application which would 404 if you haven't created a language site tree yet. In that case, log into Alchemy (localhost:3000/admin) and create your first site tree for whatever your default language and it will generate your root page.

Also maybe try rails generate alchemy:elements in the case you haven't generated the initial elements for Alchemy.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top