I've been trying to figure this out since yesterday afternoon with no
success. I've tried to run ruby with oracle, 11, 10, and as of today
10g XE. The problem is obviously not on the oracle side because I can
query the database successfully using the command-line ruby exec
command.
But after I created an a simple ruby application with a simple
database table called emails that contains only one column called
email, running the generate scaffold command leaves me with an empty
class in email.rb:
class Email < ActiveRecord::Base
end
Isn't it supposed to populate the class with the database column
information?
The generate command completed successfully with no errors. I'm
totally lost at this point. Any pointers would be greatly appreciated.
The model's not supposed to populate with anything. The connections
are made in ActiveRecord behind the scenes. However, if you created a
scaffold, there should be some new files in the app/views/emails
directory if you had any columns in your table.
Still confused. Shouldn't the database migration .rb file under db/
migrate contain something that looks like my column names? I don't see
any files that contains any of my column names.
then it would generate a model, controller, views, AND a migration
file which would create a table called emails with three columns: id
(the primary key), body, and recipient.
script/generate scafold does not READ the database to get a table definition.
This link explains my confusion. I almost gave up because I couldn't
get any of the basic tutorials going. Peak Obsession
The first sentence says "Rails 2.0.0+ breaks chapter 1 of every
existing quality rails tutorial because of scaffolding." Sigh ... it
makes me not so hopeful about learning this new platform. This seems
to be the general problem with any open source platform. Bad or lack
of quality documentation. It's too easy to get stuck, and too hard to
get out of being stuck.
I completely agree with you. Half of the tutorials don't work with the
latest release and th changes are quite significant without barealy
any compatibility. It is taking forever to find out what is in the
present release. So much for the 'agile' platform.
I completely agree with you. Half of the tutorials don't work with the
latest release and th changes are quite significant without barealy
any compatibility. It is taking forever to find out what is in the
present release. So much for the 'agile' platform.
tutorials have been hit disproportionately hard, because they tend to lean on things that were extracted (scaffolding).
My rails 1.2 apps required very little changes (basically just grabbing the plugins for the extracted features).
I agree. It's not at all the fault of the framework that the freebie
tutorials have failed to keep up. With respect to the tutorials...
you get what you paid for. If you're willing to invest in your Rails
education, I'd recommend "The Rails Way" (Fernandez, Addison-Wesley
Professional series). It's as comprehensive a text as you'll find AND
it was written with Rails 2.x in view. Also, railscasts is a great
(still free!) source for tutorials. You'll probably want to
concentrate on the later editions since they will cover Rails 2.x as
well.