On Tuesday, September 17, 2013 9:40:42 AM UTC-7, Rodrigo Rosenfeld Rosas wrote: > > 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) >> ), ', ') 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. >
If you are looking to expose an interface to users other than yourself, scaffolding extensions is probably a bad choice unless you have very simple needs. > 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... > Agreed, the demo could be better in this regard. There are a whole bunch of features that are only mentioned in the RDoc. scaffolding extensions in general is not nearly up to Sequel's quality standards. It grew organically over the last 8 years out of a set of hacks/monkey patches for Rails' default scaffolding. > 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! > Thanks, Jeremy -- 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.
