Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Rails dynamic list grid?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
schmii  
View profile  
 More options Dec 20 2008, 8:53 pm
From: schmii <schmi...@gmail.com>
Date: Sat, 20 Dec 2008 17:53:39 -0800 (PST)
Local: Sat, Dec 20 2008 8:53 pm
Subject: Rails dynamic list grid?
I’ve found many of my tables are structured in pairs consisting of a
primary_table whose entries are classified against a corresponding
table of table_types.
I have structured table_type to be hierarchically with a self-
referential parent_id so that the top is ALL (0), whose children form
the second level are GROUPS under which all categories are referenced.
For example if I have a table of contacts who are grouped as, TRADES,
SERVICES, APARTMENT, etc..
Then the children under APARTMENT may be ‘tenants’, ‘owners’,
‘managers’, ‘operators’ etc..

Is there a dynamic way to list the entries of the primary_table with
respect to ‘ALL’ or any of their associated ‘GROUPs’?

Thanks inadvance
schmii


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gerald Bauer  
View profile  
 More options Dec 20 2008, 10:32 pm
From: "Gerald Bauer" <ger...@vanbeta.com>
Date: Sat, 20 Dec 2008 19:32:15 -0800
Local: Sat, Dec 20 2008 10:32 pm
Subject: Re: [vanrb] Rails dynamic list grid?
Hello Gerhard,

> I've found many of my tables are structured in pairs consisting of a
> primary_table whose entries are classified against a corresponding
> table of table_types.
> I have structured table_type to be hierarchically with a self-
> referential parent_id so that the top is ALL (0), whose children form
> the second level are GROUPS under which all categories are referenced.
> For example if I have a table of contacts who are grouped as, TRADES,
> SERVICES, APARTMENT, etc..
> Then the children under APARTMENT may be 'tenants', 'owners',
> 'managers', 'operators' etc..

> Is there a dynamic way to list the entries of the primary_table with
> respect to 'ALL' or any of their associated 'GROUPs'?

  I'd say your best bet might be ActiveScaffold. It's a grid/table on
steroids. Find out more @ http://activescaffold.com  Up-to-date docu
moved to GitHub wiki @
http://github.com/activescaffold/active_scaffold/wikis

  Cheers.

--
Gerald Bauer - Internet Professional - http://geraldbauer.ca


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
schmii  
View profile  
 More options Dec 22 2008, 1:51 pm
From: schmii <schmi...@gmail.com>
Date: Mon, 22 Dec 2008 10:51:39 -0800 (PST)
Local: Mon, Dec 22 2008 1:51 pm
Subject: Re: Rails dynamic list grid?
Thanks Gerald for the pointers. I’ve never been a great fan of these
frameworks. I’ve tried a few, hobo, streamlined, etc.. in the past but
have always been frustrated with the code bloat and there’s always
variations that seem impossible to implement. I would prefer to code
these filters manually.

If I broke the problem into 2 stages,
1. if I created a constant array of link_to fields, ‘ALL, TRADES,
SERVICES, APARTMENT, etc..’, which would be used in a:
contacts = Contact.find (:all, conditions => [“contact_type, LIKE ?”
@contact+’%’])

Then I need filter only those contacts whose contact_types are
children of the selected link_to field?
Haven’t worked out all the details, copied this from a RailsSpace
example.

Thanks in advance
Gerhard

On Dec 20, 7:32 pm, "Gerald Bauer" <ger...@vanbeta.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gerald Bauer  
View profile  
 More options Dec 22 2008, 5:41 pm
From: "Gerald Bauer" <ger...@vanbeta.com>
Date: Mon, 22 Dec 2008 14:41:58 -0800
Local: Mon, Dec 22 2008 5:41 pm
Subject: Re: [vanrb] Re: Rails dynamic list grid?
Hello Gerhard,

   I see your point about ActiveScaffold.  I'd say creating a filter
is pretty much like adding search just w/ pre-defined search terms. To
get started or inspired you might follow along the free Railscasts by
Ryan Bates on search @ http://railscasts.com/episodes/111 or
http://railscasts.com/episodes/37

  Otherwise if you search (google) for Rails search you should find
plenty of examples.

   Cheers.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Adam Palmblad  
View profile  
 More options Dec 22 2008, 6:30 pm
From: "Adam Palmblad" <apalmb...@gmail.com>
Date: Mon, 22 Dec 2008 15:30:17 -0800
Local: Mon, Dec 22 2008 6:30 pm
Subject: Re: [vanrb] Rails dynamic list grid?

I'd suggest trying to simplify your type tables.  If you know that you
aren't going to exceed a certain depth of categorization - and in your case,
I'm seeing a depth of two, my experience with SQL suggests you'll have an
easier time writing DB queries with something like the following:

*contact_types
*group_name string
category string
id

and

*contacts*
contact_type_id integer
contact_name string
other contact data

(one might even normalize further and add a table for groups, altering
contact_types to use a group_id instead.)

You would lose the ability to nicely assign someone to a ALL group - but
perhaps you can get around the constraint with naming of the contact_types
and groups.

Then, your list of contacts would either be:
Contact.find( :all )

Contact.find( :all, :conditions => ["contact_type_id = ?",
params[:contact_id] )

Contact.find( :all, :joins => "JOIN contact_types ON contact_types.id =
contacts.contact_type_id",
  :conditions => ["contact_types.group_name = ?", params[:group_name] )

If I've misunderstood, and you just need to alter the contacts shown
in-page, I've used css selectors in the past with success.  For example,
each contact would be tr, and I'd give the row a css class for the groups
and contact-types the row is part of, like:
 '<tr class='manager apartment'></tr>
<tr class='apartment electrician'></tr>

Then, a script to show or hide the data would be:
<script>
function hideByClassName( className )
{
  $$('#containg-table-id tr.' + className).each( function(row){ row.hide();

} );
}

</script>
<a href='#' onclick='hideByClassName("manager")'>Hide Managers</a>

-Adam


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
schmii  
View profile  
 More options Dec 23 2008, 2:14 pm
From: schmii <schmi...@gmail.com>
Date: Tue, 23 Dec 2008 11:14:26 -0800 (PST)
Local: Tues, Dec 23 2008 2:14 pm
Subject: Re: Rails dynamic list grid?
Thanks Adam and Gerald for your suggestions.
Breaking it into separate tables would certainly make the SQL al lot
simpler.
I stole the original category hierarchy idea from the ‘photo album’
example in ‘Ruby on Rails: Up and Running’
I will have a look at the railscast and experiment with the code.

Thanks and a merry Christmas
Schmii

On Dec 22, 3:30 pm, "Adam Palmblad" <apalmb...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google