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

Support using granite in engines #28

Closed
paneq opened this issue Feb 12, 2019 · 2 comments
Closed

Support using granite in engines #28

paneq opened this issue Feb 12, 2019 · 2 comments
Assignees

Comments

@paneq
Copy link

paneq commented Feb 12, 2019

Steps to reproduce

  • Generate mountable, isolated engine
  • add granite action in engines/engine_name/config/routes.rb:
EngineName::Engine.routes.draw do
  resources :somethings, only: [] do
    member do
      granite 'engine_name/somethings/action_name#modal'
    end
  end
end

  • get an exception when linking
Seems like EngineName::Somethings::ActionName::ModalProjector was not mounted. Do you have engine_name/somethings/action_name#modal declared in routes?
granite (0.9.2) lib/granite/projector/helpers.rb:55:in `fetch_corresponding_route'
granite (0.9.2) lib/granite/projector/helpers.rb:43:in `corresponding_route'
granite (0.9.2) lib/granite/projector/helpers.rb:37:in `required_params'
granite (0.9.2) lib/granite/projector/helpers.rb:22:in `action_url'
granite (0.9.2) lib/granite/projector/helpers.rb:31:in `action_path'
granite (0.9.2) lib/granite/projector/controller_actions.rb:30:in `confirm_path'

The answer is: yes, I have it declared but the engine is isolated and the granite cache does not seem to handle it:

      def fetch_corresponding_route
        Rails.application.routes.routes.granite_cache[*route_id] || fail(ActionNotMountedError, self)
      end

Resources

@paneq
Copy link
Author

paneq commented Feb 12, 2019

The workaround is to use:

Rails.application.routes.draw do

in the engine routing file.

@lstrzebinczyk
Copy link
Contributor

Ticket is severely outdated. I'll close.

@paneq paneq self-assigned this May 27, 2024
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

2 participants