#rubyonrails - Sun 4 Mar 2007 between 07:54 and 08:07

NY Lost Funds



gma_djsmacedo: euch. many to many is *not* hard
learn it now, save yourself ages later
besides, isn't menu -> menu item a one to many relationship/
?
djsmacedolet me explain
gma_so you just want Menu to have has_many :items (without the :through) and Item to have_one :menu
okay
go for it
djsmacedoit's an menu of items like rice, beans, etc
and the client will select your lunch
ex.: only rice, or rice and beans
using checkboxes
gma_: like this: http://pratofino.com/cardapio (in portuguese)
mnemonicyo
pythonicjesus i love thunderstorms
gma_djsmacedo: right. I still think you should put them in tables, not in strings.
_3DStudiodoes anyone know the Ruby syntax to exit out of this loop early: @orders.each do |order|
djsmacedogma_: :)
_3DStudiolike if I wanted to move along BEFORE I loop through every order.. what would I put?
pythonic_3DStudio: .find perhaps?
gma__3DStudio: next or break maybe?
_3DStudiobreak
yes!
djsmacedogma_: but i think that will use unnecessary resources
_3DStudiobreak will break me out of any loop in ruby?
pythonic_3DStudio: yeah, but look at .find
gma_djsmacedo: sounds like you're trying to do pre-emptive optimisation. evil. don't do it. make it clean.
_3DStudiopythonic: I don't want to find anything though..
pythonic(if that's what you're really after. it'll make your code easier to read.)
_3DStudioI just want to exit the loop early if a certain condition is met
gma__3DStudio: next
pluesch0r_3DStudio: break
gma__3DStudio: or break
_3DStudioawesome thanks :)
pluesch0rnext just advances to the next entry.
gma_djsmacedo: you'll use less space (i.e. resources) if you use a join table
djsmacedo: I don't understand your issue with it though, or what you tried that didn't work
djsmacedogma_: ok
gma_: ok, i'm convinced :)
gma_: menu has many items (food) :)

Page: 3 10 17 24 31 38 45 52 59 66 73 80 87 94 101 108 

IrcArchive

NY Lost Funds