Scaffold/db problem

When I have:
class MachineController < ApplicationController
def index
render_text “Hello”
end

def new
render_text “bla”
end
end

http://127.0.0.1:3000/machine/new shows ‘bla’

but, when I have:

class MachineController < ApplicationController
scaffold:machine
end

I get:

Mysql::Error in MachineController#new

Access denied for user ‘ruby’@‘localhost’ (using password: NO)

(I am able to login to db via shell using 'mysql '… with same login
and password as in database.yml.
machines table exists with data inside, user has permission to access
this database.