T
Tim
Probably a classic case of trying to run before I can crawl, but I'm
trying to build an app with some complexity to demo to Senior
Management to give them a taste of the power of Ruby. The current
spate of demo apps just don't have enough meat on the bones to use as
demos. I work for an investment management house and have years of
experience designing databases so I'm not entirely stupid but I'm
feeling the growing pains.
That being said, I have most of my MySQL database scoped out, have
imported millions of rows of production data into the database so it
looks real-world. I started by installing InstantRails on a WinXP
workstation. I've pulled a number of plugins (acts_as_versioned,
acts_as_dropdown) and the AjaxScaffold (to give everything a more
"professional" feel).
Here are my issues:
1) Whenever I start IRB and issue a require 'xxxxx' command, Ruby
responds with "Can't load file". The only way to get the require
command to work is to issue it with the full path name to the .rb file
as in: require 'C:\Rails\...............\mysql.rb' Is this right? Am I
missing something in my configuration (a path or series of paths) so
that I don't have to search for the file and issue the full path name?
2) I'm totally lost at this point when to use @variables versus
:variables or :symbols.
3) I have a model which has a belongs_to clause. Later on in the model
I have a method which says:
def inception
Model.parent.inception_date
end
If I open a Rails Console and say:
x = Model.find(12000)
puts x.inception
I get an error saying undefined method -- parent. BUT I can say in IRB
x = Model.parent.inception_date
Why is that?
4) Lastly (and I thank anyone brave enough to read all this), I'm
trying to figure out the best approach to performing complex
calculations between several tables. I have to join a series of tables
based on multiple values (which have all been indexed). Some of these
calculations (like cumulative returns) require retrieving data from
multiplel rows in each table at once and performing running totals and
calcs. I'm trying to figure out if it's possible to do this in a model
or if I'm better off trying to create intermediate temp tables and
basing a model on the temp tables.
So my first question would be: can you base a model on a temp table or
on a SQL Select? If so, how would you do it?
My other question is: if I have code outside of the def/end method
construction in a model when/how is it called/executed?
Thanks to anyone in advance for responding.
Tim
trying to build an app with some complexity to demo to Senior
Management to give them a taste of the power of Ruby. The current
spate of demo apps just don't have enough meat on the bones to use as
demos. I work for an investment management house and have years of
experience designing databases so I'm not entirely stupid but I'm
feeling the growing pains.
That being said, I have most of my MySQL database scoped out, have
imported millions of rows of production data into the database so it
looks real-world. I started by installing InstantRails on a WinXP
workstation. I've pulled a number of plugins (acts_as_versioned,
acts_as_dropdown) and the AjaxScaffold (to give everything a more
"professional" feel).
Here are my issues:
1) Whenever I start IRB and issue a require 'xxxxx' command, Ruby
responds with "Can't load file". The only way to get the require
command to work is to issue it with the full path name to the .rb file
as in: require 'C:\Rails\...............\mysql.rb' Is this right? Am I
missing something in my configuration (a path or series of paths) so
that I don't have to search for the file and issue the full path name?
2) I'm totally lost at this point when to use @variables versus
:variables or :symbols.
3) I have a model which has a belongs_to clause. Later on in the model
I have a method which says:
def inception
Model.parent.inception_date
end
If I open a Rails Console and say:
x = Model.find(12000)
puts x.inception
I get an error saying undefined method -- parent. BUT I can say in IRB
x = Model.parent.inception_date
Why is that?
4) Lastly (and I thank anyone brave enough to read all this), I'm
trying to figure out the best approach to performing complex
calculations between several tables. I have to join a series of tables
based on multiple values (which have all been indexed). Some of these
calculations (like cumulative returns) require retrieving data from
multiplel rows in each table at once and performing running totals and
calcs. I'm trying to figure out if it's possible to do this in a model
or if I'm better off trying to create intermediate temp tables and
basing a model on the temp tables.
So my first question would be: can you base a model on a temp table or
on a SQL Select? If so, how would you do it?
My other question is: if I have code outside of the def/end method
construction in a model when/how is it called/executed?
Thanks to anyone in advance for responding.
Tim