I am new to Ruby and I开发者_运维知识库 have a question. I am trying to have a controller call a model class which would query a MySQL database.
What is the correct way to set this up? I am trying not to use scaffolding so that I learn how to do this by hand.
class MyController < ApplicationController
def index
@post = Post.find(params[:id])
end
end
when calling index, you will find post in database which id is equal to id given in paramaterer (http://localhost/my_controllers/id)
精彩评论