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

Unable to have two controllers manage the same resource #173

Open
ryanb opened this issue Mar 11, 2020 · 0 comments
Open

Unable to have two controllers manage the same resource #173

ryanb opened this issue Mar 11, 2020 · 0 comments
Labels

Comments

@ryanb
Copy link

ryanb commented Mar 11, 2020

In our app we have an Account model with two controllers: AccountsController and ExtendTrialsController. Both of these controllers use the account model. The ExtendTrialsController manages extending the account trial period:

class Admin::ExtendTrialsController < Admin::ApplicationController
  self.model_class = Account

  def update
    # extend the trial
  end

  private

  def resource
    @resource ||= Account.find_by(token: params[:id])
  end
end

The problem is the main menu navigation thinks this controller is the main controller for managing accounts and links instead of the AccountsController.

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

No branches or pull requests

2 participants