I am sure many people have asked this already… But I could not find
anything helpful. I am trying to use RoR with an existing database with
tables already defined.
I used script/generate scaffold account
But when I point to localhost:3000/account, no table columns showed up.
The “new account” link is there, but no columns nor any content (and I
have content in my db table). When I click on new account, only the
create button showed up. When I click on the create button, a new entry
gets added to my existing db table, with all fields blank!
What’s up with this? It’s obviously able to talk to the DB, but what did
I do wrong that caused RoR to not able to figure out what fields already
exist?
My table was named account, but ActiveScaffold insists on using accounts
as the table name, so I added set_table_name “account” to my Model
class.
But when I point to localhost:3000/account, no table columns showed up.
The “new account” link is there, but no columns nor any content (and I
have content in my db table). When I click on new account, only the
create button showed up. When I click on the create button, a new entry
gets added to my existing db table, with all fields blank!
Hi
this is because you have to do scaffolding with all the columns that
the current db has. So for example if it has an email field you can do
like
I am sure many people have asked this already… But I could not find
anything helpful. I am trying to use RoR with an existing database with
tables already defined.
I used script/generate scaffold account
But when I point to localhost:3000/account, no table columns showed up.
The “new account” link is there, but no columns nor any content (and I
have content in my db table). When I click on new account, only the
create button showed up. When I click on the create button, a new entry
gets added to my existing db table, with all fields blank!
What’s up with this? It’s obviously able to talk to the DB, but what did
I do wrong that caused RoR to not able to figure out what fields already
exist?
My table was named account, but ActiveScaffold insists on using accounts
as the table name, so I added set_table_name “account” to my Model
class.
I appreciate any help.
Thank you,
Rat
In model there is Account (A capital letter) u have change in schema and
migrate folder bd/ …
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.