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

Define controller method to be called #5

Open
vitoravelino opened this issue Jul 26, 2021 · 1 comment · May be fixed by #8
Open

Define controller method to be called #5

vitoravelino opened this issue Jul 26, 2021 · 1 comment · May be fixed by #8
Labels
enhancement New feature or request

Comments

@vitoravelino
Copy link
Owner

The idea is to pass an option to modular_routes helper that will overwrite the default controller method name call.

An example of that could be:

# routes.rb

modular_routes controller_method: :execute do
  resources :books, only: :index
end

# controllers/books/index.rb

module Books
  class IndexController 
    def execute
      # ...
    end
  end
end
@vitoravelino vitoravelino added the enhancement New feature or request label Jul 26, 2021
@vinibispo vinibispo linked a pull request Apr 21, 2022 that will close this issue
@aglushkov
Copy link

Hey, thanks for this great gem

Current method call is also leaked to action method.

Can we have action method name same as it was in original controllers ? It will be easier to refactor old projects

  class IndexController 
    def index
    end
  end

Or can we change action value to return expected value instead of call

  class IndexController 
    def call
        action # => I expect this will be  'index'
    end
  end

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

Successfully merging a pull request may close this issue.

2 participants