Bonsoir;
Je suis entrain de développer une application E-commerce en Ruby on rails sous linux : ubuntu 12.04.
Après avoir créé l'application avec : rails new appli -d mysql. j'ai créé le model prodduit : rails g model produit .
suite a la création de ce model je cherche à créer la base de données qui doit être liée à la ce model.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 invoke active_record create db/migrate/20140512173741_create_products.rb create app/models/product.rb invoke test_unit create test/models/product_test.rb create test/fixtures/products.yml
je modifie le fichier: ../20140512173741_create_products.rb
vi db/migrate/20140512173741_create_products.rb
En suite à la migration rake db:migration
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 class CreateProducts < ActiveRecord::Migration def self.up create_table :products do |t| t.column : title, :string t.column : description, :text t.column : url_iamge, :string t.column : prix, :decimal # t.timestamps end end def self.down drop_table :products end end
je me confronte aux erreurs suivantes:
Je sollicite l'aide d'une tierce personne : voici le fichier de config database.yml.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 koita-mohamed@koitamohamed-EN:~/ROR/applicattions$ rake db:migrate rake aborted! ActiveRecord::JDBCError: The driver encountered an unknown error: java.sql.SQLException: Access denied for user 'koita-mohamed'@'localhost' (using password: YES) Tasks: TOP => db:migrate (See full trace by running task with --trace)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48 # MySQL. Versions 4.1 and 5.0 are recommended. # # Install the MySQL driver: # gem install activerecord-jdbcmysql-adapter # # Configure Using Gemfile # gem 'activerecord-jdbcmysql-adapter' # # And be sure to use new-style password hashing: # http://dev.mysql.com/doc/refman/5.0/en/old-client.html # default: &default adapter: mysql username: root password: host: localhost development: adapter: mysql database: applicattions_development username: koita-mohamed password: mohamedkoita host: localhost # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: adapter: mysql database: applicattions_test username: koita-mohamed password: mohamedkoita host: localhost # production: # url: <%= ENV['DATABASE_URL'] %> # production: <<: *default database: applicattions_production username: applicattions password: <%= ENV['APPLICATTIONS_DATABASE_PASSWORD'] %> #adapter: mysql # database: applicattions_production # username: koita-mohamed # password: mohamedkoita # host: localhost # database: <%= JSON.parse( ENV['VCAP_SERVICES'] )['mysql-5.1'].first['credenti$ # username: <%= JSON.parse( ENV['VCAP_SERVICES'] )['mysql-5.1'].first['credent$ # password: <%= JSON.parse( ENV['VCAP_SERVICES'] )['mysql-5.1'].first['credenti$
Partager