1

I'm new with forem gem. I want to set the same layout for my application and my forum.

I changed the default config/initializers/forem.rb to set my app/views/layouts/application.html.erb layout :

Rails.application.config.to_prepare do
  Forem::ApplicationController.layout "application"
end

I get this error :

ActionView::Template::Error (undefined local variable or method `start_path' for #<#<Class:0x00000008fb00d8>:0x00000008f5ec10>):

... some more informations of my configuration :

  • This layout contains this line :

    <%= link_to("Start", start_path) %>

  • My config/routes contains this line :

    get 'start' => 'statics#start', :as => :start

  • And a rake routes | grep start returns this :

    start GET /start(.:format) statics#start

  • The layout works perfectly ouf of forem pages.

Do you have any idea of the problem ?

Regards

pierallard
  • 3,326
  • 3
  • 21
  • 48

1 Answers1

3

I auto-answered for next readers.

I must set paths like this :

main_app.start_path

And voilà !

pierallard
  • 3,326
  • 3
  • 21
  • 48
  • 2
    Is there a workaround? If there are many paths in the shared layout, adding `main_app` manually to all of them will be time-consuming and error-prone. – mc9 Nov 16 '14 at 00:10