Em 17-09-2013 12:17, Jeremy Evans escreveu:
On Tuesday, September 17, 2013 7:58:42 AM UTC-7, Rodrigo Rosenfeld
Rosas wrote:
I was thinking about something like this in Pg:
select username,
array_to_string(array(
select name from roles where id in (select role_id
from user_roles where user_id=users.id <http://users.id>)
), ', ') as user_roles
from users limit 10;
Is it possible to add such a column description somehow using your
gem?
Well, you might be able to do:
@scaffold_browse_fields = [:username, :user_roles]
def user_roles
# do query, return string
end
That's going to do a separate query per row though. I don't believe
scaffolding extensions offers the ability to customize the query used
in a manner similar to what you want.
That should be fast enough for 10 records per page and helps a lot, but
I'm afraid I'll have to come up with a custom interface, since the
editors would like to be able to filter and sort/group by role as well
as the username.
Anyway, I believe you're correct that this is outside of the scope of a
generic admin tool after taking a look at demos for rails admin and
activeadmin.
As a side note/suggestion I don't think your demo demonstrates your tool
very well by limiting to a single record per page. It took me a while
searching the source before trying it just to figure it out if it was
possible to define the pagination params... The README also doesn't
mention pagination explicitly...
Anyway, it's great to know that we already have such tool available for
Sequel users and that another one is on the way :)
Keep up with the great work!
Cheers,
Rodrigo.
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/groups/opt_out.