Hi guys,
I’m having problems when creating basic web applications using rails
2.2 and mySQL databases.
If I create the following table in a database named
moviecritc_development:
CREATE TABLE movies (
id INT NOT NULL AUTO_INCREMENT PRIMARY_KEY,
name VARCHAR(30) NOT NULL );
and then run the following ruby commands:
gem install rails
gem install mysql
rails -d mysql moviecritic (creates all the necessary files without any
issue.)
I then modify the config/database.yml to include the root password to
my database.
About your application’s environment
Ruby version 1.8.6 (i386-mswin32)
RubyGems version 1.3.1
Rails version 2.2.2
Active Record version 2.2.2
Action Pack version 2.2.2
Active Resource version 2.2.2
Action Mailer version 2.2.2
Active Support version 2.2.2
Application root C:/Documents and Settings/Stephen/moviecritic
Environment development
Database adapter mysql
Database schema version 0
I then run the following command:
ruby script/generate scaffold Movie (creates usual files without error).
If i now view the db/migrate.create_movies.rb i see the following:
class CreateMovies < ActiveRecord::Migration
def self.up
create_table :movies do |t|
t.timestamps
end
end
def self.down
drop_table :movies
end
end
It doesn’t make a reference to the name column i created! This is
reflected when i navigate to localhost:3000/movies/new i only see a
Back link and a Create Button, i don’t see a NAME FIELD INPUT.
Has anyone any ideas why this is happening?
Thanks in advance,
Stephen