AlchemyCMS / alchemy_cms

Alchemy is the Open Source Rails CMS framework for the component based web that can be used as classic server side rendered or headless CMS.
https://www.alchemy-cms.com
BSD 3-Clause "New" or "Revised" License
846 stars 315 forks source link

Cannot open alchemy admin dashboard #1949

Closed ck2000 closed 2 years ago

ck2000 commented 4 years ago

Steps to reproduce

Install the lastest version of alchemy and rails. Sign in using your app build in devise authentication.

Expected behavior

After signing in the admin dashboard should load.

Actual behavior

ActionView::Template::Error (undefined local variable or method `alchemy' for #<#:0x00007f8983386ad0>): 1: <%= content_for :toolbar do %> 2: <%= toolbar_button( 3: icon: 'angle-double-left', 4: url: request.referer || alchemy.admin_dashboard_path, 5: label: Alchemy.t(:back), 6: title: Alchemy.t(:back), 7: hotkey: 'alt+z',

System configuration

initializers/alchemy.rb Alchemy.user_class_name = 'Admin' # Defaults to 'User' Alchemy.current_user_method = 'current_admin' # Defaults to 'current_user' Alchemy.login_path = '/admin/sign_in' # Defaults to '/login' Alchemy.logout_path = '/admin/sign_out' # Defaults to '/logout' Alchemy.logout_method = 'delete' # Defaults to 'delete'

tvdeyen commented 4 years ago

Have you mounted Alchemy into your app?

# config/routes.rb
Rails.application.routes.draw do
  ...
  mount Alchemy::Engine => "/"
end
ck2000 commented 4 years ago

Sure, I have tried several mount points. Right now, I am having for testing perposes here:

namespace :admin do ... ... mount Alchemy::Engine => '/cms' end

ck2000 commented 4 years ago

Do you need further information to reproduce this issue?

tvdeyen commented 4 years ago

I think the namespace could be an issue.

Try to mount the engine in the top level route definition.