When i tabe this line in Terminal
$ script/generate Model Expense
I show only that
exists app/models/
exists test/unit/
exists test/fixtures/
create app/models/expense.rb
create test/unit/expense_test.rb
create test/fixtures/expenses.yml
i didn’t see this commands
create db/migrate
create db/migrate/001_create_expenses.rb
rails -d sqlite3 /path/to/you/new/railsapp
u write this command with Locomotive ?
For me
Ordinateur-de-Bolo-Michelin:~/Documents/Creation_Perso/Developement/expenses
bolomichelin$ rails -d sqlite3
/Documents/Creation_Perso/Developement/expenses
sorry to reiterate some points, but i use sqlite3 successfully so…
easy steps for rails 1.1
rails -d sqlite3 /path/to/you/new/railsapp
cd /path/to/you/new/railsapp
rake db:schema:dump
./script/generate model MyNewModel
step 1 can be ommitted for an existing app - obviously! but it saves you
changing anything in database.yaml except the db name
step 3 may not be exact syntax - old syntax of rake db_schema_dump still
works, which is all i’ve used yet - this step creates the database if it
doesn’t already exist.
No Working for me
I tested the second solution
Ordinateur-de-Bolo-Michelin:$ ./script/generate migration Expense
create db/migrate
create db/migrate/001_expense.rb
Ok After i create my table in 001_expenses
class Expense < ActiveRecord::Migration
def self.up
create_table :account do|table|
table.column :name, :string
table.column :budget, :float
end
end
def self.down
drop_table :accounts
end
end
Then
Ordinateur-de-Bolo-Michelin:$ rake migrate
(in /Users/bolomichelin/Documents/Creation_Perso/Developement/expenses)
running rails --help will tell you all this - but like i said its only a
shortcut
migration looks ok, apart from :float - im not 100% if sqlite3 supports
floats
you better check the docs (sqlite.org) - i dont use them (i would store
cents
in the db rather than dollars for instance, and do the necessary
translation
in the model)
i’m assuming
create_table :account do|table|
should be
create_table :accounts do |table|
that said, are you sure the database exists after dumping the schema?
file
permissions ok? you dont mention any error messages
only other thing that i can think of is that its something to do with
locomotive, which i cannot help with
class Account < ActiveRecord::Migration
def self.up
puts ‘Creating Table: accounts…’
create_table :accounts, :force => true do |t|
t.column :name, :string
t.column :budget, :float
end
end
def self.down
puts ‘Deleteing Table: accounts’
drop_table :accounts
end
end
when i teste rake migrate ,i have this now
$ rake migrate
(in /Users/bolomichelin/Documents/Creation_Perso/Developement/expense)
rake aborted!
parse error on line 9, col 12: `’