It seems that when using the HttpHelpers in an Engine's routes file, I keep getting "uninitialized constant Controller". But, if I use a URL matcher in the Engine's routes file, it routes correctly.
For instance in the dummy application I have config/routes.rb:
Dummy app config/routes.rb
Rails.application.routes.draw do
mount MyEngine::Engine => "/myengine"end
In the engine, if the config/routes.rb look like:
Engine config/routes.rb
MyEngine::Engine.routes.draw do
get "things/index"end
... then, rake routes in the dummy application looks like:
rake routes
$ rake routes
Routes for MyEngine::Engine:
things_index GET /things/index(.:format) things#index
... and when I try to access http://<host>/myengine/things/index, I'll get an uninitialized constant ThingsController.
However, if I change my Engine routes to:
Revised Engine config/routes.rb
MyEngine::Engine.routes.draw do
match "things/index" => "things#index", :as => "things_index"end
... then, rake routes in the dummy application looks like:
rake routes
$ rake routes
Routes for MyEngine::Engine:
things_index GET /things/index(.:format) my_engine/things#index
... and when I try to access http://<host>/myengine/things/index, I get the expected view.
Btw, rails g controller things index will generate a route using the HttpHelper method (not the matcher).
I googled for any corroborating accounts, but didn't see any. So, I'm not sure if this is just something I'm doing wrong. Or, if maybe this is because engines are fairly new.
I'll also post this to stack overflow to see if there's any help there.
If you're using an html5 compatible browser, you might encounter a javascript validation saying "Please enter an email address" for the username field around 8:33.
HTML5 compatible browsers will interpret the type="email" attribute of the username input field and perform the associated email validation:
It seems that when using the HttpHelpers in an Engine's routes file, I keep getting "uninitialized constant Controller". But, if I use a URL matcher in the Engine's routes file, it routes correctly.
For instance in the dummy application I have config/routes.rb:
In the engine, if the config/routes.rb look like:
... then,
rake routes
in the dummy application looks like:... and when I try to access
http://<host>/myengine/things/index
, I'll get anuninitialized constant ThingsController
.However, if I change my Engine routes to:
... then,
rake routes
in the dummy application looks like:... and when I try to access
http://<host>/myengine/things/index
, I get the expected view.Btw,
rails g controller things index
will generate a route using the HttpHelper method (not the matcher).I googled for any corroborating accounts, but didn't see any. So, I'm not sure if this is just something I'm doing wrong. Or, if maybe this is because engines are fairly new.
I'll also post this to stack overflow to see if there's any help there.
If you're using an html5 compatible browser, you might encounter a javascript validation saying "Please enter an email address" for the username field around 8:33.
HTML5 compatible browsers will interpret the type="email" attribute of the username input field and perform the associated email validation:
You can update the username input field to remove this validation. Change the username field to:
You can do the same thing in the
views/devise/registrations/edit.html.erb
file.