November 18, 2009 Meeting

0 views
Skip to first unread message

JimCifarelli

unread,
Nov 16, 2009, 8:40:46 AM11/16/09
to TechValley Ruby Brigade
Hello Everyone,

With the Thanksgiving Holiday upon us, we are meeting this 3rd
Wednesday of this month, November 18, in downtown Troy at the
headquarters of Celery:

Celery, LLC
212 River Street
Troy, NY 12180
http://www.mycelery.com

We can begin to gather at 5:30PM with presentations/lightning rounds/
discussions at 6:00PM

Please add to this thread any topics you would like to present or
discuss. To start:

1. Discussion of Tech Valley Code Camp 2009 and the Ruby/Rails track
2. Dallas' eager loading discussion and hack session

See everyone there. Please RSVP to this thread so that appropriate
food/drink orders can be made by our hosts. Thank you again Neil for
hosting the group this month!

Thank you,
Jim

Doon

unread,
Nov 16, 2009, 8:58:15 AM11/16/09
to TechValley Ruby Brigade
Baring anything unforeseen, I'll be ther...

-Patrick


On Nov 16, 8:40 am, JimCifarelli <cifare...@gmail.com> wrote:
> Hello Everyone,
>
> With the Thanksgiving Holiday upon us, we are meeting this 3rd
> Wednesday of this month, November 18, in downtown Troy at the
> headquarters of Celery:
>
> Celery, LLC
> 212 River Street
> Troy, NY 12180http://www.mycelery.com

Thomas Porter

unread,
Nov 16, 2009, 10:12:35 AM11/16/09
to techva...@googlegroups.com
Linda and I will be there. I _may_ be able to talk her into making
cookies, as this is the kick off for the Holiday season.

Tom P.

Michael Dippery

unread,
Nov 16, 2009, 10:35:45 AM11/16/09
to techva...@googlegroups.com
Hi,

I'm planning to be there.


-- Michael

Rich

unread,
Nov 16, 2009, 10:48:46 AM11/16/09
to techva...@googlegroups.com
I was planning to come to my first brigade meeting, but just found out I
have a town board meeting that same night. So I will have to make December
my first meeting.

Mark Menard

unread,
Nov 16, 2009, 11:06:38 AM11/16/09
to TechValley Ruby Brigade
I do not know if I'm going to be able to attend yet. (Much house
renovating going on.)

Just in case I'm not there please discuss the scheduling of the
December meeting. The fourth Wednesday is the 23rd, which likely would
be a bad night to have a meeting. I would propose we again meet on the
third Wednesday in December, the 16th. (We might even want to make
this our official schedule January-October 4th Wednesday, November &
December 3rd Wednesday.)

Mark

On Nov 16, 8:40 am, JimCifarelli <cifare...@gmail.com> wrote:
> Hello Everyone,
>
> With the Thanksgiving Holiday upon us, we are meeting this 3rd
> Wednesday of this month, November 18, in downtown Troy at the
> headquarters of Celery:
>
> Celery, LLC
> 212 River Street
> Troy, NY 12180http://www.mycelery.com

Dallas DeVries

unread,
Nov 16, 2009, 2:12:44 PM11/16/09
to techva...@googlegroups.com
I will be there.

I know we talked about doing a coding session this month for some of the time.  The idea I had was to write a plugin that would let you do eager loading when using  find_by_sql.  Basically there is no great way to do your own custom sql and get the associations without  additional code and queries.

Example:
Article object
has_one :author
has_many :tags

sql  = "SELECT articles.*,
               authors.*
          FROM articles,
               authors
         WHERE articles.author_id=authors.id"
articles = Article.find_by_sql(sql, :include  => :author,  :table_map => {:author => 'authors'})
# I don't know what the best api would be for this, just a quick suggestion
# I just found out about this option (its not really documented) but havent tried it yet.  It would still require an additional query, but it looks like you can use it to avoid collecting the ids yourself and running the query then associating
the new objects back with the Article
Article.send(:preload_associations, articles, [:tags])

The idea is that we can specify that the Author object maps to the 'authors' string in our query and can build the association from the results without doing an additional query (or query every time you reference the author attribute on the model).

I haven't really delved into the eager loading code or find_by_sql rails code but figured we could learn something from giving it a try as a group even if we don't end up coming up with a solution. 

Note: Naturally the best thing to do is to avoid using find_by_sql when possible (and in this trivial example you can) but chances are when it comes down to performance tuning your site you will need to use find_by_sql in some spots and if you don't do some sort of eager loading in these examples you will shoot yourself in the foot.

Anyways this is just a suggestion for a coding session, we can do something else entirely or people can tell me if this is a silly thing to pursue :)

Cheers,
-Dallas

Mark Menard

unread,
Nov 16, 2009, 4:25:56 PM11/16/09
to TechValley Ruby Brigade
Update I will be at the meeting.

Mark

Gemma Hentsch

unread,
Nov 16, 2009, 4:26:31 PM11/16/09
to techva...@googlegroups.com
I'll be there also

Mark Menard

unread,
Nov 16, 2009, 4:27:51 PM11/16/09
to TechValley Ruby Brigade
Dallas,

Do you have a preference as to version of Rails you'd want to develop
this against? Is this something you need for Sportspyder? It would be
great if we could do it against 2.3.4 or 2.3.edge, but if you wanted
to do it for an earlier release I'd totally understand.

Mark

Dallas DeVries

unread,
Nov 16, 2009, 4:39:16 PM11/16/09
to techva...@googlegroups.com
The version doesn't matter to me.  Probably makes the most sense to it in 2.3.4 or edge.  I already have a solution on SportSpyder that I did a while back, its just ugly looking ( I can show my hack ) and would be interested in implementing a more elegant solution that the community could use.
--
Dallas DeVries
SportSpyder, LLC
http://sportspyder.com

John

unread,
Nov 18, 2009, 2:59:42 PM11/18/09
to TechValley Ruby Brigade
I will be there.

John

On Nov 16, 8:40 am, JimCifarelli <cifare...@gmail.com> wrote:
> Hello Everyone,
>
> With the Thanksgiving Holiday upon us, we are meeting this 3rd
> Wednesday of this month, November 18, in downtown Troy at the
> headquarters of Celery:
>
> Celery, LLC
> 212 River Street
> Troy, NY 12180http://www.mycelery.com

ladyrassilon

unread,
Nov 18, 2009, 4:08:49 PM11/18/09
to TechValley Ruby Brigade
Also although this is a django problem i do have an interesting
security idea i need to think out for a software as a service project
i'm working on...but i'll go into details in the meeting...maybe
people will see a solution i haven't or even come up with something
that might work.
Reply all
Reply to author
Forward
0 new messages