Environment:
Mac OS X (Leopard) version 10.5.1
ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-darwin8.10.1]
Rails 2.0.2
Rake, version 0.8.1
I''m following a simple example from OS X''s dev doc
("Expenses").
My Problems: 1) I would like to work with MySQL vs sqlite3
2) Rake doesn''t know how to build; even
though
I followed a simple example.
--------------------------------------
1) Entered ''$>rails expenses'' (at the prompt), got the
''expenses''
directories built.
expenses/config/database.yml:
My Default Database is sqlite3: <-- problem #1: I want MySQL; not
sqlite3.
# SQLite version 3.x
# gem install sqlite3-ruby (not necessary on OS X Leopard)
development:
adapter: sqlite3
database: db/development.sqlite3
timeout: 5000
--------------------------------------
2) I MANUALLY modified the database.yml for mysql:
development:
adapter: mysql
database: db/development.mysql
host: localhost
timeout: 5000
...
---------
MySQL has the following table:
mysql> use expenses_development;
Database changed
mysql> show tables;
Empty set (0.00 sec)
--------------------------------------
3) script/generate migration accounts
create db/migrate
create db/migrate/001_accounts.rb
--------------------------------------
4) edit db/migrate/001_accounts.rb:
class Accounts < ActiveRecord::Migration
def self.up
create_table :accounts do |table|
table.column :name, :string
table.column :budget, :float
end
end
def self.down
drop_table :accounts
end
end
--------------------------------------
5) rake migrate --trace
[/Users/Ric/workarea/ruby/expenses]rake migrate --trace
(in /Users/Ric/workarea/ruby/expenses)
rake aborted!
Don''t know how to build task ''migrate''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1634:in `[]''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1930:in
`invoke_task''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in
`top_level''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in `each''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in
`top_level''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in
`standard_exception_handling''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1903:in
`top_level''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1881:in `run''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in
`standard_exception_handling''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1878:in `run''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.1/bin/rake:31
/opt/local/bin/rake:16:in `load''
/opt/local/bin/rake:16
--------
What happened?
1) How do I change the default db to MySQL?
2) Why can''t rake build the ''migrate'' file?
Remedy???
Regards,
Ric.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
1) rails newProject -d mysql 2) isn''t it rake db:migrate ? you are calling rake migrate instead -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Andreh Luis wrote:> 1) rails newProject -d mysql > > 2) isn''t it rake db:migrate ? you are calling rake migrate insteadYou''re correct on *BOTH*. I was following the example too closely, lacked the db: so obviously the build got lost: [/Users/Ric/workarea/ruby/expenses]rake db:migrate (in /Users/Ric/workarea/ruby/expenses) == 1 Accounts: migrating =====================================================-- create_table(:accounts) -> 0.1104s == 1 Accounts: migrated (0.1106s) ============================================ As for #1: Is there a way to make MySQL the de facto db so all I would need to do is: $> rails <newProject>? --- Thanks for pointing out the obvious! Regards, Ric. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
how did you manage to get your modifed file with database: db/development.mysql yet it was able to insert into the "expenses_development" table. i had to change my database file entry to database: expenses_development any thoughts? On Feb 8, 1:14 pm, Frederick Lee <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Andreh Luis wrote: > > 1) rails newProject -d mysql > > > 2) isn''t it rake db:migrate ? you are calling rake migrate instead > > You''re correct on *BOTH*. > > I was following the example too closely, lacked the db: so obviously the > build got lost: > > [/Users/Ric/workarea/ruby/expenses]rake db:migrate > (in /Users/Ric/workarea/ruby/expenses) > == 1 Accounts: migrating > =====================================================> -- create_table(:accounts) > -> 0.1104s > == 1 Accounts: migrated (0.1106s) > ============================================> > As for #1: Is there a way to make MySQL the de facto db so all I would > need to do is: > $> rails <newProject>? > > --- Thanks for pointing out the obvious! > > Regards, > > Ric. > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---