<teardown>
in the Server.create model class method, the only thing i can get to work is to pass in IDs in the params, and then set them on 'server' like 'server.domains_id= domain', where all the params i pass to that method are IDs for the FKs
<teardown>
but if i do 'Server.new; Server.associations', i get an empty hash from the #associations method
cappy has quit [Quit: Leaving]
<teardown>
I guess my assumption, which may be incorrect, is that by using an ORM (and going to the trouble to setup models and associations), i would be able to skip finding the FK IDs in my controllers, and just pass model objects into my Server.create method, and have the associtaions propagate the proper FK IDs into the :server table, like Server.create( Domain[3], Environment[2], LifecycleStage[1] )
<teardown>
I used rails a bit a while back and i seem to remember doing things like '@server.domain' to get the whole associated Model from an instance of the Server model class, which is what i want from Sequel. Isn't that what using an ORM gets you?
<teardown>
And i do not think that @server.associations should return {}
<teardown>
Shouldn't it return all the associated models for a given Server instance?
<teardown>
btw this is not a web app, im using ncurses via MRDialog as a frontend for a cli script
jmcgnh has quit [Read error: Connection reset by peer]
jmcgnh has joined #ruby
jmcgnh has quit [Excess Flood]
jmcgnh has joined #ruby
dannyAAM has quit [Ping timeout: 260 seconds]
_whitelogger has quit [Ping timeout: 260 seconds]
_whitelogger has joined #ruby
dannyAAM has joined #ruby
hellstabber has joined #ruby
reset has quit [Quit: reset]
jmjl has quit [Quit: ~nyaa]
trillion_exabyte has quit [Ping timeout: 268 seconds]
trillion_exabyte has joined #ruby
gaussianblue has joined #ruby
jaredce has joined #ruby
hellstabber has quit [Quit: Connection closed for inactivity]
Inline has joined #ruby
xdminsy has quit [Ping timeout: 260 seconds]
Inline has quit [Ping timeout: 260 seconds]
weaksauce has quit [Read error: Connection reset by peer]
weaksauce has joined #ruby
Al2O3 has quit [Read error: Connection reset by peer]
trnzecs has joined #ruby
Inline has joined #ruby
<mooff>
teardown: methods defined at the top level actually get defined as instance methods on Object, the parent class of almost everything
<mooff>
that probably isn't the problem, but something to be aware of. they aren't file scoped...
xdminsy has joined #ruby
<mooff>
@validations at the top level will be an instance variable on the special <main> object, which is the default self for required files (and the main script: ruby entrypoint.rb)
<mooff>
so different model files would overwrite the same @validations if they use the same pattern
<mooff>
do you know about binding.irb ? (or binding.pry, if you've required the 'pry' gem)
<mooff>
that's handy for inspecting what's going on in these cases
otisolsen70 has joined #ruby
<mooff>
i've not used Sequel, but the docs indicate server.domain should work if you have class Server < Sequel::Model; one_to_one :domain; end