Fix routing issue with engine mounted to root_path#98
Conversation
There was a problem hiding this comment.
This code is similar to Rails3#recognizes?. Please reuse code as much as possible. In general, the CodeClimate score should not decrease:
https://codeclimate.com/github/appfolio/ae_page_objects/compare/fixRouterEngineRoot
68051c0 to
f8a75e0
Compare
|
The refactoring in f8a75e0 is pretty good. However, the resulting method is still a bit difficult to read. I took a shot at refactoring here: fixRouterEngineRoot...refactorRecognize It's still unclear to me what the |
f8a75e0 to
14da32d
Compare
|
@dtognazzini good refactoring 👍 👍 👍
For example: Also we can ask a rails router to get the resolved hash by passing a If the Above is the idea for the Maybe we should explicitly call them |
|
Ok. I'm not convinced that That said, we can still merge this PR ahead of answering that question. One thing that would make this easier to read by making the above assumption clear as day is to use a value object: RouteTarget = Struct.new(:controller, :action)We could use |
|
@dtognazzini I didn't dive into the rails routing code too much but I agree that it's hard to say if However, the comment for Then I found I think that would be a good hint for adding engine name_path support inside aepos-rails in future. And for now, let's try the |
70fba09 to
2436df8
Compare
2436df8 to
ec785a0
Compare
|
Based on the last 2 commits, I refactored a bit more here: fixRouterEngineRoot...refactorApplicationRouter The commits are focused with descriptive messages. Let me know what you think. |
|
@dtognazzini that looks pretty good for me 😄 😃 😀 I only have two concerns:
def router
@router ||= ::Rails.application.routes
end |
|
I made a few more changes (see the comparison):
Regarding memoizing: Yes, you could do this. However, I'm not sure it buys you much as Rails.application.routes (like the other implementations of |
|
Looks good. |
Fix routing issue with engine mounted to root_path
|
Addresses #63 |
|
yeah ✋ |
No description provided.