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

Unscoping default scope #731

Closed
pmichna opened this issue Jan 13, 2017 · 5 comments
Closed

Unscoping default scope #731

pmichna opened this issue Jan 13, 2017 · 5 comments

Comments

@pmichna
Copy link

pmichna commented Jan 13, 2017

I have a model with a default scope:
default_scope -> { where(active: true) }
Can I unscope the model in Administrate, so the I can see all the records in the admin panel?

@nickcharlton
Copy link
Member

I had a look at this yesterday and it doesn't seem possible (yet).

The list of resources is provided by Administrate::Search that isn't too easy to expose. I had a look at a solution I'm not yet happy with on this branch, so I'm going to continue to look into it.

@bobf
Copy link
Contributor

bobf commented Mar 12, 2017

@nickcharlton The solution looks good to me. What about it are you unhappy with ? Seems the simplest way to give complete control.

My use case is that I only want to display a specific scope.

Curiously, the controller generator suggests that it's possible, but it's clear from looking at the code that this can't work:

    # To customize the behavior of this controller,
    # simply overwrite any of the RESTful actions. For example:
    #
    # def index
    #   super
    #   @resources = Role.
    #     page(params[:page]).
    #     per(10)
    # end

@bobf
Copy link
Contributor

bobf commented Mar 12, 2017

@nickcharlton Your patch seems to work fine for me - just tested my code against it with no issues at all. +1 for merging. :)

nickcharlton referenced this issue Mar 15, 2017
This allows you to add custom filtering (or disable default filtering)
such as used with default scopes.
@bobf
Copy link
Contributor

bobf commented Jun 14, 2017

I've added this PR which resolves the issue for me and (I think) resolves the issue that @nickcharlton found with his WIP implementation: #910

I'm using it for the time being so I can at least rebase against the latest thoughtbot master and stay up-to-date on features but would love to see it merged so I'm happy to make any changes that would help make that happen.

@nickcharlton
Copy link
Member

Closing as we merged #910 then #914.

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

3 participants