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

Putting an engine in a localized block breaks engine routing method #166

Open
rvasquez-flip4new opened this issue May 12, 2017 · 10 comments

Comments

@rvasquez-flip4new
Copy link

Assume you have an engine called Blorgh. And you mount it like this:

Rails.application.routes.draw do
  localized do
    mount Blorgh::Engine,      at: '/blorgh'
  end
end

It is now impossible to call blorgh.unicorns_path in a view. Instead of this you have to append the locale like this:

blorgh_en.unicorns_path

I'm on rails 5.0/5.1 and ruby 2.3.x and 2.4.1 and route translator 5.4.0.

Any clues how to fix this?

Thanks in advance!

Bes tregards
Roberto

@rvasquez-flip4new
Copy link
Author

I worked around this adding a method to the application helper like this, but it does not feel right:

module ApplicationHelper
  def blorgh
    send("blorgh_#{I18n.locale}")
  end
end

@tagliala
Copy link
Collaborator

Refers to #154?

@rvasquez-flip4new
Copy link
Author

I think so. I remember that discussion. It also had to do with #123 (which was openend by me too ;) )

@rvasquez-flip4new
Copy link
Author

rvasquez-flip4new commented May 12, 2017

I'm running into the next problem, even with the "hack" I posted above, the generated urls are missing the locale for the main_app if any engines are mounted at '/'.

Example:

main_app.root_path should generate /de, but instead generates /

force_locale is set to true in that example, but it does not seem to matter.

@tagliala
Copy link
Collaborator

Feel free to submit a PR or start a wiki page explaining the limitation with engines

tagliala added a commit that referenced this issue Nov 12, 2017
tagliala added a commit that referenced this issue Nov 12, 2017
tagliala added a commit that referenced this issue Nov 14, 2017
The current engine implementation is buggy and incomplete.

We are going to drop the whole feature, waiting for a new contributor

Close: #166, #172
@tagliala tagliala added this to the 6.0.0 milestone Nov 14, 2017
tagliala added a commit that referenced this issue Dec 3, 2017
The current engine implementation is buggy and incomplete.

We are going to drop the whole feature, waiting for a new contributor

Close: #166, #172
tagliala added a commit that referenced this issue Dec 3, 2017
The current engine implementation is buggy and incomplete.

We are going to drop the whole feature, waiting for a new contributor

Close: #166

Refers to: #172
tagliala added a commit that referenced this issue Dec 3, 2017
The current engine implementation is buggy and incomplete.

We are going to drop the whole feature, waiting for a new contributor

Fix: #166

Close: #172
tagliala added a commit that referenced this issue Dec 3, 2017
The current engine implementation is buggy and incomplete.

We are going to drop the whole feature, waiting for a new contributor

Fix: #166, #172
tagliala added a commit that referenced this issue Dec 3, 2017
The current engine implementation is buggy and incomplete.

We are going to drop the whole feature, waiting for a new contributor

Fixes #166, fixes #172, fixes #173 and fixes #178
tagliala added a commit that referenced this issue Feb 5, 2018
The current engine implementation is buggy and incomplete.

We are going to drop the whole feature, waiting for a new contributor

Fixes #166, fixes #172, fixes #173 and fixes #178
tagliala added a commit that referenced this issue Apr 9, 2018
The current engine implementation is buggy and incomplete.

We are going to drop the whole feature, waiting for a new contributor

Fixes #166, fixes #172, fixes #173 and fixes #178
tagliala added a commit that referenced this issue Apr 10, 2018
The current engine implementation is buggy and incomplete.

We are going to drop the whole feature, waiting for a new contributor

Fixes #166, fixes #172, fixes #173 and fixes #178
tagliala added a commit that referenced this issue Jun 7, 2018
The current engine implementation is buggy and incomplete.

We are going to drop the whole feature, waiting for a new contributor

Fixes #166, fixes #172, fixes #173 and fixes #178
tagliala added a commit that referenced this issue Oct 3, 2018
The current engine implementation is buggy and incomplete.

We are going to drop the whole feature, waiting for a new contributor

Fixes #166, fixes #172, fixes #173 and fixes #178
tagliala added a commit that referenced this issue Jan 19, 2019
The current engine implementation is buggy and incomplete.

We are going to drop the whole feature, waiting for a new contributor

Fixes #166, fixes #172, fixes #173 and fixes #178
tagliala added a commit that referenced this issue Mar 14, 2019
The current engine implementation is buggy and incomplete.

We are going to drop the whole feature, waiting for a new contributor

Fixes #166, fixes #172, fixes #173 and fixes #178
tagliala added a commit that referenced this issue May 16, 2019
The current engine implementation is buggy and incomplete.

We are going to drop the whole feature, waiting for a new contributor

Fixes #166, fixes #172, fixes #173 and fixes #178
tagliala added a commit that referenced this issue May 16, 2019
The current engine implementation is buggy and incomplete.

We are going to drop the whole feature, waiting for a new contributor

Fixes #166, fixes #172, fixes #173 and fixes #178
@tagliala tagliala removed this from the 7.0.0 milestone Jul 20, 2019
tagliala added a commit that referenced this issue Dec 26, 2019
The current engine implementation is buggy and incomplete.

We are going to drop the whole feature, waiting for a new contributor

Fixes #166, fixes #172, fixes #173 and fixes #178
tagliala added a commit that referenced this issue Dec 26, 2019
The current engine implementation is buggy and incomplete.

We are going to drop the whole feature, waiting for a new contributor

Fixes #166, fixes #172, fixes #173 and fixes #178
tagliala added a commit that referenced this issue Dec 26, 2019
The current engine implementation is buggy and incomplete.

We are going to drop the whole feature, waiting for a new contributor

Fixes #166, fixes #172, fixes #173 and fixes #178
tagliala added a commit that referenced this issue Apr 17, 2020
The current engine implementation is buggy and incomplete.

We are going to drop the whole feature, waiting for a new contributor

Fixes #166, fixes #172, fixes #173 and fixes #178
AsgharRaz pushed a commit to AsgharRaz/route_translator that referenced this issue Nov 3, 2020
The current engine implementation is buggy and incomplete.

We are going to drop the whole feature, waiting for a new contributor

Fixes enriclluelles#166, fixes enriclluelles#172, fixes enriclluelles#173 and fixes enriclluelles#178
@aiomaster
Copy link

I had the same problem, that my engine routing proxy was not available anymore and I think I've found a better solution to just add it in an ApplicationHelper (that worked not good enough for me, cause I found myself hacking this in multiple different classes, just to get this work).
Rails defines these kind of helpers in a module called MountedHelpers in the https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/routing/route_set.rb
So we can just extend this class on the fly, so in my routes.rb after the route definitions I added something like this:

Rails.application.routes.mounted_helpers.class_eval do
  def blorgh
    public_send("blorgh_#{I18n.locale}")
  end
end

so this is really everywhere accessible where blorgh_en is for example.

Maybe route_translator can do this automatically while processing an engine mount?
So this would address at least one of the problems.

tagliala added a commit that referenced this issue Jan 13, 2021
The current engine implementation is buggy and incomplete.

We are going to drop the whole feature, waiting for a new contributor

Fixes #166, fixes #172, fixes #173 and fixes #178
@tagliala
Copy link
Collaborator

Maybe route_translator can do this automatically while processing an engine mount?

I'm not using Route Translator in production in any of my current projects, so a PR with tests and documentation would be very welcomed

PS: because of this issue, I have a development branch where the engine feature has been completely removed

tagliala added a commit that referenced this issue Jan 13, 2021
The current engine implementation is buggy and incomplete.

We are going to drop the whole feature, waiting for a new contributor

Fixes #166, fixes #172, fixes #173 and fixes #178
@tagliala
Copy link
Collaborator

Relevant commit: f70f6f7

Commit message

The current engine implementation is buggy and incomplete.

We are going to drop the whole feature, waiting for a new contributor

tagliala added a commit that referenced this issue Jan 16, 2021
The current engine implementation is buggy and incomplete.

We are going to drop the whole feature, waiting for a new contributor

Fixes #166, fixes #172, fixes #173 and fixes #178
tagliala added a commit that referenced this issue Jan 16, 2021
The current engine implementation is buggy and incomplete.

We are going to drop the whole feature, waiting for a new contributor

Fixes #166, fixes #172, fixes #173 and fixes #178
@tagliala
Copy link
Collaborator

Release 10.0 will still have engine support

@aiomaster
Copy link

I tried, but was not able to write a failing test at the top of the current master.
It seems like there were no issues, at least I can not reproduce them in test.
But I know we had the issue with the missing routing_proxy helper, but we are using rails 5 in production. Maybe it just works with rails 6?

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

No branches or pull requests

3 participants