Topic: How to display data from model help?
I have book on rails and looked at several documentation. I am confused on how to grab the data in my model to display in a view. The steps I took:
I have a SQLite3 db that I created with only one row.
columns - first_name middle_name last_name
All three column in my only row are filed in with data.
rails new app_name
changed yml path to a database I have already created in SQLite3
rails generate controller User index
rails generate model User first_name:string middle_name:string last_name:string
Now I am lost on how to grab the data in the model to display in view.
I tried to use below:
@names = User.find(:all)
in my view I place the <%= @names %> and I only see a bracket. If my file extension to my database displays a prefix .db, does that make my adapter: sqlite3 wrong?
Last edited by Lluvain (2012-07-17 08:28:13)