class CreateClassifieds < ActiveRecord::Migration
def self.up
create_table :classifieds do |t|
t.column :title, :string
t.column :price, :float
t.column :location, :string
t.column :description, :text
t.column :email, :string
t.column :created_at, :timestamp
t.column :updated_at, :timestamp
end
end
def self.down
drop_table :classifieds
end
end
rake migrate – check to see tables have been made in Cocoa
(success!)
ruby script/generate controller Classified
Update classified_controller.rb file w/
def list
@classifieds = Classified.find(:all)
end
def show
@classified = Classified.find(params[:id])
end
def new
end
def create
end
def edit
end
def update
end
def delete
end
end```
11. Point page to <a
href="http://localhost:3000/classified/list">http://localhost:3000/classified/list</a>
12. ERROR #28000Access denied for user 'root'@'localhost' (using
password: NO)
I don't get it, if rake can setup the tables then the rails must be
communicating fine w/ MySQL ??
ruby script/server class CreateClassifieds < ActiveRecord::Migration
end
end
password: NO)
I don’t get it, if rake can setup the tables then the rails must be
communicating fine w/ MySQL ??
Shutdown the server. Check your database.yml file and make sure all the
environments have a password set and try it again. The “(using password:
NO)”
implies it’s using the default database.yml setup where root has no
password
rather than the one you configured. rake runs independent of the having
a
server running which is why it picked up the database.yml changes.
Shutdown the server. Check your database.yml file and make sure all the
environments have a password set and try it again. The “(using password:
NO)”
implies it’s using the default database.yml setup where root has no
password
rather than the one you configured. rake runs independent of the having
a
server running which is why it picked up the database.yml changes.
–
Michael W.
Michael,
I did as you said and I get past that error now! I failed to mention
earlier in the day that I had gotten it to work before, but I started
getting this problem after I set a password to my ‘root’ user – how can
I fix this from now on?
I did as you said and I get past that error now! I failed to mention
earlier in the day that I had gotten it to work before, but I started
getting this problem after I set a password to my ‘root’ user – how can
I fix this from now on?
Should I update my setup?
It should be fixed now. There are a few changes you make to your app
while the
server is running in development mode that aren’t picked up until you
restart
the server. E.g. if you change config/environment.rb you need to restart
the
server for the changes to be seen.
–
Michael W.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.