Jeremy,

Sorry, I totally missed that new method.

Thanks for the explanation of the singular / plural etc.

Scott

On Tue, Jul 14, 2009 at 1:51 PM, Jeremy Evans <[email protected]>wrote:

>
> On Jul 14, 12:55 pm, Scott LaBounty <[email protected]> wrote:
> > OK, I fell like we're getting towards the end here (I'm guessing you're
> > hoping we are).
> >
> > In the purchase method:
> >
> > <<
> >     def purchase(book, copies=1)
> >         bl = book_location(book)
> >         bl ?
> >             bl.update(:copies=>bl.total+copies) :
> >             BookLocation.create(:book=>book, :location=>self,
> > :total=>copies, :checked_out=>0)
> >     end
> >
> >
> >
> > the bl = book_location(book) line says that book_location is undefined,
> but
> > if I use
> > bl = book_locations(book), it works, but as you noted, I do get back an
> > array. Should the book_location() work?
>
> If you add the book_location method I defined in a previous message,
> then yes it will.  Otherwise, no, the method will not be defined.
> Here it is again:
>
>    def book_location(book)
>      book_locations_dataset[:book_id=>book.id]
>    end
>
> > Also, I'm a little unclear of the singular / plural. In my tables, I
> create
> > the book/location join table as book_locations. It looks like that then
> > flowed through the models. Should I have made that books_locations with
> them
> > both plural and then used that in the models?
>
> You can use either naming convention as long as you are consistent.
> If you use book_locations, you need to specify the :join_table
> argument in your many_to_manys.  If you use books_locations, you'll
> have to specify the dataset for the BookLocation model.
> book_locations seems like the best table name to me, though.
>
> Jeremy
> >
>


-- 
Scott
http://steamcode.blogspot.com/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to