Forum: Ruby on Rails Rails 2.2 - Getting started - need some help

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A07ec64186c6d821ca51abb2df646dda?d=identicon&s=25 Johan Van mol (johan-vm)
on 2009-03-06 13:46
Hi,

I've used ROR in the past,
but recently started working with version 2.2.

I don't seem to be able to get started:

# I create a rails app: @rails music_library@
# I create a db using an SQlite gui: @music_library_DB.rsd@
# I edit the config/database.yml file:
@development:
  adapter: sqlite3
  database: db/music_library_DB.rsd
  pool: 5
  timeout: 5000@
#I run @script/generate scaffold Album@
#I run @rake db:migrate@

Afterwards, I run @script/generate migration columns@, so I can add
columns to the @albums@ DB table:

# @class Columns < ActiveRecord::Migration
  def self.up
    drop_table :albums
    create_table :albums do |t|
      t.string :title, :artist, :genre
      t.datetime :releasedate
      t.timestamps
    end
  end

  def self.down
    drop_table :albums
  end
end@

# I run @rake db:migrate@ again, to execute the migration

And here's my question:

How do I update the scaffolding, so I can use CRUD to add albums, ...
A07ec64186c6d821ca51abb2df646dda?d=identicon&s=25 Johan Van mol (johan-vm)
on 2009-03-06 13:48
Sorry, I thought this forum could understand Textile...

Here we go again:

Hi,

I've used ROR in the past,
but recently started working with version 2.2.

I don't seem to be able to get started:

1/ I create a rails app: rails music_library
2/ I create a db using an SQlite gui: music_library_DB.rsd
3/ I edit the config/database.yml file:

development:
  adapter: sqlite3
  database: db/music_library_DB.rsd
  pool: 5
  timeout: 5000

4/I run script/generate scaffold Album
5/I run rake db:migrate

Afterwards, I run script/generate migration columns, so I can add
columns to the albums DB table:

class Columns < ActiveRecord::Migration
  def self.up
    drop_table :albums
    create_table :albums do |t|
      t.string :title, :artist, :genre
      t.datetime :releasedate
      t.timestamps
    end
  end

  def self.down
    drop_table :albums
  end
end

I run rake db:migrate again, to execute the migration

And here's my question:

How do I update the scaffolding, so I can use CRUD to add albums, ...
51655eeeedad656fad30717c46852437?d=identicon&s=25 Chris Kottom (Guest)
on 2009-03-06 15:05
(Received via mailing list)
You don't.  Dynamic scaffolding was deprecated after Rails 1.2.x, I
believe.  Rails 2.0 and beyond actually generate the view files as ERB
depending on the model attributes you provide on the command line to
create
the scaffold.

The preferred way to create a new scaffold now will look something like
this:

    ruby script/generate scaffold Album title:string artist_name:string
release_year:integer ...

This creates a new resource with all the extra REST-ful stuff that comes
along with it.

If you want to try installing the old dynamic scaffolding as a plugin,
it's
still available (ruby script/plugin install scaffolding should do it),
but
it's questionable whether or not it will work with any newer version of
the
framework.


On Fri, Mar 6, 2009 at 1:48 PM, Johan Van mol <
This topic is locked and can not be replied to.