Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Routes paths breaking on ruby 2.2.2 #61

Open
maurodias opened this issue Mar 28, 2016 · 12 comments
Open

Routes paths breaking on ruby 2.2.2 #61

maurodias opened this issue Mar 28, 2016 · 12 comments
Labels

Comments

@maurodias
Copy link
Contributor

Requests are being sent to /notifications when the path expected is /notifly/notifications.

On 2.2.1 and earlier versions works fine.

@maurodias maurodias added the bug label Mar 28, 2016
@maurodias
Copy link
Contributor Author

fork https://github.com/maurodias/notifly worked fine on ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]

@douglascamata
Copy link

@maurodias you modifications with regards to the Notifly::Engine aren't recommended by Ruby on Rails Guides. Without the isolated namespace Notifly's models, controllers, routes and other things can "leak" into the application and cause undefined behaviour if the application has anything with the same name as the engine.

@maurodias
Copy link
Contributor Author

@douglascamata, its already isolated =)
Remove that line was just a test which failed, thats why I forked...
I'm testing the engine class inheriting from Rails::Engine instead from ::Rails::Engine...
It seems to be fine, just gonna check how gonna integrate now.

@douglascamata
Copy link

@maurodias according to what is said in the documentation, it's not isolated unless isolate_namespace is called inside the Engine class. One of the parts of the documentation that mention this:

6.3 Routes

Routes inside an engine are isolated from the application by default. 
This is done by the isolate_namespace call inside the Engine class. 
This essentially means that the application and its engines can have identically 
named routes and they will not clash.

@maurodias
Copy link
Contributor Author

@douglascamata, maurodias@f5e481a :D check it out

@douglascamata
Copy link

@maurodias oh, I see. Are all specs ok? If yes, then it deserves a pull request 👍

@maurodias
Copy link
Contributor Author

=\ not yet

@douglascamata
Copy link

@maurodias did you try putting back ::Rails::Engine instead of Rails::Engine?

@maurodias
Copy link
Contributor Author

The way it was? the way errors were heppening for me...

the gem generators and every rails generator(after notifly install) was executing the tasks in the gem path...

Example: when you do rails g devise user inside a project was generating a namespaced notifly user at rbenv gem folder.

Not sure about removing :: as the solution, just testing, although earlier specs haven't caught anything wrong.

@douglascamata
Copy link

@maurodias that's not an unknown issue, I know it happened more times, but I still don't know why.

@douglascamata
Copy link

It starts to happen out of nowhere too, which is very awkward.

@maurodias
Copy link
Contributor Author

I don't know if used to run, but routes helpers on Notifly generated template is allowing only to call Notifly routes helpers

It runs now if you turn it explict, example:
´Rails.application.routes.url_helpers.model_path(notification.target)´

In case it has never worked, I think it would be a nice feature to do.
If somehow the natural use of the application helpers become impossible or expensive, I saw this implementation ´https://github.com/fnando/burgundy/blob/master/lib/burgundy/rails.rb´ that allows routes being accessed by a helper. ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants