Hi, I'm new to Rails but I develop in PHP somtimes. I figured that the best way to learn Rails is to create a simple CMS. While I understand the basics of ruby and rails, one issue has caught me: how can I set a default ID for an action?
Here is my code for the index action in my pages controller:
def index
@page = Page.find(params[:id])
respond_to do |format| format.html # show.html.erb format.xml { render :xml => @page } end end
However, when I load http://localhost:3000/pages , I get a message:
Couldn't find Page without an ID
How can I make my application assume a default ID of 1 if none is provided?