I created a new action called "asked". asked.haml is in views/questions as it should be. I've also added
def asked
respond_to do |format|
format.html
format.xml { render :xml => @questions }
end
end
to the Questions controller for this action.
My problem is that when I got to the url http://localhost:3000/questions/asked, I get this error:
ActiveRecord::RecordNotFound in QuestionsController#show
Couldn't find Question with ID=asked
So, I Googled this and found out that I needed to change the way I route things.
I tried: map.connect ':controller/asked', :action => 'asked'
and map.resources :questions, :collection => {:asked => :get}
, but to no avail.
Obviously I don't fully understand how Rails mapping works, but if someone would let me know what's going on, I'd really appreciate it!