What do you guys think of "borrowing" the idea of callbacks and filters from activeadmin? You can see the comments in their code
For starters, this will definitely clean up the hack I'm using for assigning the user via a default. (It's kind of a security nightmare since I use that for my authorization and have to enable user_id in my mass assignment)
Any ideas on how we could accomplish this via rails_admin's DSL? We don't really have the concept of the "controllers" that AA has. So maybe use Proc?
So I guess my proposal would be:
config.model Post do
before_build do
Proc.new do
@object.user_id = bindings[:view]._current_user.id
end
end
end
It's not the most graceful thing, but seems like it might be the most doable given our current DSL? Thoughts? We could easily then replicate the various active record ones...
What do you guys think of "borrowing" the idea of callbacks and filters from activeadmin? You can see the comments in their code
For starters, this will definitely clean up the hack I'm using for assigning the user via a default. (It's kind of a security nightmare since I use that for my authorization and have to enable user_id in my mass assignment)
Any ideas on how we could accomplish this via rails_admin's DSL? We don't really have the concept of the "controllers" that AA has. So maybe use Proc?
So I guess my proposal would be:
It's not the most graceful thing, but seems like it might be the most doable given our current DSL? Thoughts? We could easily then replicate the various active record ones...
Then a similar-ish thing for filters?