I'm getting started on figuring out how to use RESTful design. I have this action:
# GET /feedback_messages
# GET /feedback_messages.xml
def index
page = params[:page]
page ||= 1
@feedback_messages = FeedbackMessage.paginate(
:all,
:page => page,
:per_page => 20,
:order => 'updated_at'
)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @feedback_messages }
end
end
And I have the template...
views/feedback_message/index.haml
When I hit it with app.get '/feedback_messages'
I get an error saying "Missing template feedback_messages/index.erb".
How do I tell Rails that I want it to use the Haml template?
If you are running HAML - first make sure that you've installed HAML to the application... by running haml --rails .
at the root of your project. Then from there make sure all of your HAML files are named [filename].html.haml - which breaks down to filename.format.interpreter. It's important you do this in REST specially because of the respond_to format block.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With