Praful Patel
Praful Patel

Reputation: 105

Rails + Alchemy CMS - How to set custom layout for user view

It is easy to set custom layout in admin page by setting admin_page_preview_layout:layout_name in config/alchemy/config.yml file.

But, How do I set custom layout for Alchemy::PagesController#show action,

By default Alchemy::PagesController uses app/views/layouts/application.html.erb . I don’t want to use the app/views/layout/application.html.erb,

instead of application.html.erb I want to use custom layout, as I am integrating Alchemy CMS into existing rails project.

How can I achieve this?

Upvotes: 0

Views: 107

Answers (1)

Min Min Mo
Min Min Mo

Reputation: 1

My workaround solution:
create file app/overrides/pages_controller_decorator.rb

module PagesContollerDecorator
  def self.prepended(base)
    base.layout 'custom_layout'
  end

  Alchemy::PagesController.prepend self
end

Upvotes: 0

Related Questions