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

Path issues #146

Open
rohangrg opened this issue Jan 8, 2020 · 4 comments
Open

Path issues #146

rohangrg opened this issue Jan 8, 2020 · 4 comments

Comments

@rohangrg
Copy link

rohangrg commented Jan 8, 2020

Hey,

For devise gem, we are using an employee model rather the user model,
So when I use your gem, it is causing issues with our routes.

Screenshot 2020-01-08 at 1 43 58 PM

in the application controller, I am using

`def current_user
current_employee
end

def can_administer?
true
end`

@designium
Copy link

I have similar issue. Rapidfire cannot find any of other controller's routes and it keeps giving error that a route path is an undefined local variable or method not found.

@ZacharyWeiner
Copy link

I have a similar issue and it was solved by adding the initializer. But, after adding the initializer, and loading up the rapidfire root, clicking on "New Survey" leads me to a new error.


ActionView::Template::Error (undefined method `surveys_path' for #
<ActionDispatch::Routing::RoutesProxy:0x00007fa78701b1a8>):
    1: <h3><%= survey.new_record? ? "New Survey" : "Edit Survey" %></h3>
    2:
    3: <%= form_for survey do |f| %>
    4:   <%- if survey.errors.any? %>
    5:     <ul>
    6:       <%- survey.errors.full_messages.each do |message| %>

In this error, RapidFire cant find its own surveys path and the problem is surfaced from the Rapid Fire Initializer:

 main_app_route_methods.each do |m|
      define_method m do |*args|
        main_app.public_send(m, *args)
      end
      helper_method m
end

So, I was thinking that it's telling me that Im supposed to use the url_for helper in all the forms...
So I went into the views and updated the form to use the url_for

<%= form_for url_for(survey) do |f| %>

which worked to load the new survey page, but then on submission of the survey info I get:
No route matches [POST] "/rapidfire/surveys/new"

Which is true. In the rake routes list the :post route for new_survey_path is 'surveys/new' not rapidfire/surveys/new

Any help is appreciated.

@stale
Copy link

stale bot commented Apr 18, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs for another 14 days. Thank you for your contributions.

@stale stale bot added the stale/wontfix label Apr 18, 2020
@stale stale bot closed this as completed May 2, 2020
@iffyuva iffyuva reopened this May 3, 2020
@stale stale bot removed the stale/wontfix label May 3, 2020
@mihaic195
Copy link

mihaic195 commented Sep 23, 2020

To reference routes inside the rapidfire engine from outside the engine you need to prepend the path with rapidfire. E.g. rapidfire.surveys_path

To reference routes outside the engine, from within the engine, you need to prepend your routes with main_app. E.g. main_app.some_other_path. (Or some other engine)

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

No branches or pull requests

5 participants