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?
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.
@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
@nickcharlton Your patch seems to work fine for me - just tested my code against it with no issues at all. +1 for merging. :)
I've added this PR which resolves the issue for me and (I think) resolves the issue that @nickcharlton found with his WIP implementation: https://github.com/thoughtbot/administrate/pull/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.
Closing as we merged #910 then #914.
Most helpful comment
@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: