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 helper methods not found inside the pack on rails 8 #96

Open
matmorel opened this issue Oct 17, 2024 · 1 comment
Open

Path helper methods not found inside the pack on rails 8 #96

matmorel opened this issue Oct 17, 2024 · 1 comment
Labels
question Further information is requested

Comments

@matmorel
Copy link

Hello, thank you for creating this gem!

I'm trying it with rails 8.0.0.beta1 and it seems that routes defined in the packs aren't available inside it while they are in the main app:

# packs/my_pack/config/routes
scope module: :my_pack do
  resource :book
end
<%# packs/my_pack/app/views/my_pack/books/new.html.erb %>
<%= form_with url: book_path do |form| %> <%# undefined local variable or method `book_path' %>
  <%= form.text_field :title %>
<% end %>
# config/routes.rb
Rails.application.routes.draw do
  draw(:my_pack)
end
<%# app/views/home/show.html.erb %>
<%= link_to "new book", new_book_path %> <%# works %>
@github-actions github-actions bot added the triage A new issue that needs review by the core team label Oct 17, 2024
@ashleywillard
Copy link
Contributor

Hi @matmorel! I'm assuming that your example is more of a generalization rather than your actual code. We noticed that there was this change in Rails 8:

Deprecate drawing routes with multiple paths to make routing faster.
You may use with_options or a loop to make drawing multiple paths easier.

# Before
get "/users", "/other_path", to: "users#index"

# After
get "/users", to: "users#index"
get "/other_path", to: "users#index"

That may or may not relate to what you're seeing. Have you been able to get packs-rails working on this app with a stable version of rails?

@ashleywillard ashleywillard added question Further information is requested and removed triage A new issue that needs review by the core team labels Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants