3

I'm creating a mountable engine in ROR 3.1.3 and I have a problem with creating non-restful routes.

My controller:

#sessions_controller.rb
module Loginout
  class SessionsController < ApplicationController
    def abc
      raise 'aaaaaaaa'
    end
.......

routes:

#routes.rb
get '/sessions/abc'
#match '/sessions/abc', :to => 'sessions#abc'

http://localhost:3000/loginout/sessions/abc

gives me an error:

Routing Error

uninitialized constant SessionsController

And while I use match instead it works fine (rises the exception). Why does it fail with get? How to fix this get?

Andrzej Gis
  • 13,706
  • 14
  • 86
  • 130
  • You don't have access to the session in a mountable app. You might want to look into a normal engine. There is a hack to do this but then you basically convert the mountable app into a normal engine – drhenner Jan 30 '12 at 23:56
  • Is there a 'smart' way for doing this? – Andrzej Gis Jan 31 '12 at 00:17
  • link: https://stackoverflow.com/questions/6118905/rails-3-1-engine-vs-mountable-app – cs95 Jul 16 '19 at 03:06
  • Take a look at this link https://stackoverflow.com/questions/6118905/rails-3-1-engine-vs-mountable-app for the difference between mountable engines vs a full engine – drhenner Jan 30 '12 at 23:58
  • Which and why would you choose to create a log in/out module. (Users table, maybe Credentials table, and a log in/out controller) – Andrzej Gis Jan 31 '12 at 01:00

0 Answers0