KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
class PostsController < ApplicationController # GET /posts # GET /posts.xml def index @posts = Post.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @posts } end end ... What exactly is "respond_to" Is it part of rails? What is "do" and"|format|"? Why are there vertical separators around format? How come Rails knows about the Post model? I didn't import that model. (In Python/Django, you have to import a model before you can use it) This is from the Ruby on Rails tutorial: http://edgeguides.rubyonrails.org/getting_started.html#setting-the-application-home-page
Tags (comma-separated)
Save Edits
Cancel