Log in

No account? Create an account
entries friends calendar profile adric.net Previous Previous Next Next
Another day in #rubyonrails ... - nil.enroll(aetheric_username, quantum_class_id)
yljatlhQo'! QIch lo'laltbebej!
Another day in #rubyonrails ...
After being in the channel since this:
[1:28pm] adricnet: If Order has many Customer, Customer belongs to Order, and that works .. how do I model zc_orders_products in AR ?
[1:29pm] litage: adricnet: i would've thought that customer have many orders
[1:29pm] litage: s/customer/customers/
[1:30pm] adricnet: litage: Mornin' :) I only said it works, not that it's right :D Dont' make me quote Knuth backwards at you !
[1:30pm] litage: adricnet: what's your point..?
[1:31pm] litage: adricnet: are you saying that you don't want to do it "the right way"?
[1:31pm] adricnet: litage: Nah, sorry, I'm open to enlightenment, please. That was just the only useful preface I had.
[1:33pm] litage: adricnet: everyone's circumstances are different, but i would imagine that most of the time, customers have many orders
[1:35pm] adricnet: litage: Okay, working with that now. I'm moe puzzled by how to do the order_products relationship. This is Zencart, I can link you the schema if you'd like :)
[1:36pm] litage: adricnet: well, wouldn't an order have many products, or maybe "line items"?

and another couple instances of non-help, until I finally annoy and offend enough people that they become more helpful? Fiik:

[3:26pm] adricnet: "ActiveRecord::StatementInvalid: Mysql::Error: Table 'noodles.orders_products' doesn't exist" So I need to explictly tell DHH^W Rails the name of the join table somehow ..
[3:26pm] harryjr: i've checked out 2-2-stable in vendor/rails and now it's complaining about sqlite gem missing, i suspect it's expecting everything to be vendored, am i right?
[3:27pm] Dreamer3: adricnet: yes
[3:27pm] railsn00b: adricnet has_many :through!!!
[3:27pm] djones_|away: adricnet: :joins =>
[3:27pm] Dreamer3: or name your table the rails way
[3:27pm] adricnet: Wow, thanks channel. That's a nice pile of incomplete answers :D
[3:28pm] djones_: adricnet: there are roughly 8 open questions active right now. best take what you can get. ;)
[3:28pm] railsn00b: adricnet: I use the rails standards so I don't have to expressly tell rails the name of my join table
[3:28pm] fowlduck: this shall become a fixture in this channel
[3:28pm] fowlduck: i decree it
[3:28pm] fowlduck: http://tinyurl.com/5jt6b5 Links to google
[3:29pm] adricnet: railsn00b: Sadly, this is real world code. Blame the Zencart devs for not following the One True Way.
[3:29pm] djones_: fowlduck: roflmao!!
[3:29pm] fowlduck: djones_: srsly
[3:29pm] djones_: fowlduck: bookmarking....
[3:29pm] fowlduck: djones_: so...awesome...wow...
[3:29pm] • adricnet derives humour from english speakers shouting verbs without subjects or objects. In Japanese that might work...
[3:29pm] sweetchili: fowlduck: ^^
[3:30pm] djones_: adricnet: yaknow, insulting the ppl trying to help you is not a really great way to get further help. g'luck w/that join table.
[3:30pm] adricnet: djones_: Indeed. A couple at least are mine.. I think
[3:31pm] adricnet: djones_: It's true, I'm just blowing off some steam. Sorry if I wounded anyone by accident.
[3:31pm] railsn00b: adricnet foo has_many: bars :through => :stupid_join_table_name
[3:31pm] railsn00b: now stupid_join_tabel_name better have a foo_id int and a bar_id int
[3:31pm] djones_: pgpkeys: hey, good to see you again! :D
[3:32pm] Dreamer3: adricnet: you also often get better help if you pay for it
[3:32pm] pgpkeys: hehe. yeah i had to disappear for a bit. was getting frustrated as all hell. gotta leave in about 10 minutes to get the kid but I shalt return
[3:32pm] Dreamer3: you are one of 508 people here
[3:32pm] Dreamer3: adricnet: if you had a contractor you'd be 1 of 1
[3:32pm] adricnet: Dreamer3: It's true. I'm willing to Paypal euros , just need it to work first :)
djones_: pgpkeys: bus again? yeah, stepping away is often the fix you hadn't thought of. at least, it works that way for me. :)
[3:33pm] railsn00b: Dreamer3: can't agree with you on that one - my company hired a linux contractor once, he was onsite for a week, I found the answer in an hour on #linux
[3:33pm] adricnet: Dreamer3: Also true, and I am contractor here, but this is not my field ... lol .
[3:33pm] Dreamer3: railsn00b: well i think it's somewhat obvious you need to hire GOOD help
[3:33pm] railsn00b: Dreamer3: trouble is, all the GOOD help forgt to wear their "I'm GOOD help" name badges
[3:34pm] Dreamer3: railsn00b: http://www.workingwithrails.com/browse/popular/people
[3:34pm] Dreamer3: railsn00b: github
[3:34pm] railsn00b: ok ok so you know of GOOD help.  I stand corrected
[3:35pm] djones_: Killaklown: you're looking for something like :conditions => 'foo.field_name > 0' but you'll probably also have to throw in a :joins => 'inner join foo_bar on foo.id = bar.id' for good measure.
[3:35pm] Dreamer3: railsn00b: i think if someone has public code and has done a lot of rails stuff that increases the odds in their favor :)

took a break to make this post and laugh ...

[4:04pm] adricnet: railsn00b: has_many :foos, through => :bars does not seem to take a table name. Want me to create a Model for the join table?
[4:05pm] universa1: adricnet: there's habtm too
[4:05pm] universa1: if the table is just to fk
[4:05pm] universa1: *two
[4:05pm] adricnet: universa1: True, let me scan the doc for that again
[4:07pm] adricnet: universa1: It's pretty much just that. Should I generate Model for the join table in that case?
[4:08pm] universa1: adricnet: if there are really only the two foreign keys and nothing else then habtm is fine and doesn't need a join model. if there's more you want a join model, and has many through

Currently fighting the syntax on that/those suggestions ... Gods but I hate this crap (joins). It never makes a lick of sense to me (ER) and hardly every works right. Blech.

Tags: ,
Current Music: Emiliana Torrini - Baby Blue | Powered by Last.fm

Leave a comment