I just found this forum today and I'm having trouble with a rails
tutorial I'm working on. On all other rails console commands it runs
when I hit enter such as:
Nothing happens. I tried create as well. When I hit enter it just puts
an enter and doesn't run the command which returns. Any clue what I'm
doing wrong?
That won't save a record. It will only create an object. To save it
as a database record, you need to do subject.save -- and that also
assumes that the class inherits from ActiveRecord, you've created the
table in the database, etc.
Nothing happens. I tried create as well. When I hit enter it just puts
an enter and doesn't run the command which returns. Any clue what I'm
doing wrong?
Does it do absolutely nothing, not even tell you something like:
Subject.new only create a new object in memory, to persist in the database you should to use subject.save or directly Subject.create(:name => “First Subject”, :position => 1", :visible =>
true)
The reason it did not do anything was because you had not entered a
complete statement (the extra quote meant that the last stuff on the
line appeared to be a quoted string) so it was waiting for you to
enter the rest of the statement. I imagine it prompted you with a >
or similar.