#rubyonrails - Sat 31 Mar 2007 between 12:30 and 12:49

NY Lost Funds



JensBUserlanguages contains user_id, language_id, and mothertongue; User and Language only contain id columns
sud0n1mwhat is the command to test if a variable exists?
JensB"if variable"
RubyPantherdefined @foo
JensB:)
RubyPantheroops
don't listen to me
JensBsud0n1m, only "nil" and "false" return false when called as boolean, so "if variable; do_something; end" will do what you need
hedahi, whats the deal with organizing models into modules or atleast subdirectories? I am going to have a huge set of models in one project. last time i looked at doing this it was bit of a no go
sud0n1mJensB: What about if it doesnt exist if !variable?
JensByes
or "if variable.nil?"
RubyPanthersometimes it is useful to distinguish between false and not defined
JensBRubyPanther, how do you generally use a HMT relationship? Maybe I am misunderstanding something
sud0n1mJensB: thanks - I was trying to throw an error if the user goes to the page by submitting nothing in the search form or by going directly to the page.
JensBsud0n1m, for that you HAVE to use validations
they are far too cool to not be used :)
rob5all this talk.. rails is so confusing!!
sud0n1mJensB: validations? Im a newbie on a tight schedule! Going on vaca today and need to get this out
RubyPantherJensB: are you sure you need HMT and not just a simple has_many ?
JensBsud0n1m, if it's a "fire&forget" project, fine, if you need to maintain it, spend 30 minutes and learn about validations
RubyPantherI would do has_many user_languages and then user_languages belongs_to language
JensBRubyPanther, every user can have many languages, and I have a table of available languages that users can choose.
later I want to be able to quickly find all users who have selected a certain language, or combination of languages
and I want to be able to create translator chains
RubyPantherit is still easy to do that
JensBok
how is that different from has many through?
RubyPantherit's about the same, with less magic
JensBhow do I use the table then? If I create a User, how do I add languages to the User instance?
RubyPantheruser.langauges << lang
actionkwolf is away: Estoy ocupado
kwolfis away: Estoy ocupado
JensBhm
that does not seem to work here :(
ChouserHi, everyone. This will probably be an easy question...
RubyPantherif you want to pastie the models, maybe I can spot something
I am just off of a 2 month "vacation," so I am not 100% yet :)
ChouserI've got view where I loop though a has_many, and use fields_for to generate fields for each of the objects in the has_many
That works. But now when the whole form, with potentially changes to multiple objects, how do I save them?
The has_many is "photos", and one of the fields in Photo is "description". But it looks like the field names generated by fields_for and text_field aren't unique.

Page: 1 8 15 22 29 36 43 50 57 64 71 78 

IrcArchive

NY Lost Funds