mardi 9 février 2016

What is the .html in respond_to do |format| in ruby on rails?

so for Ruby on Rails, I see lots of code snippets that goes

respond_to do |format|
  format.html { something }
  format.json { something }
end

and so on.

What I'm wondering is what the html and json is in the above code snippet. Are they methods? Scopes? Attributes? I've searched on Rails API and Ruby API to find none of those exist. The closest I've got to is the html? method.

I know, I could just accept it as it is, but it's been bothering me so much that I'm getting headaches now. Someone please save me.




Aucun commentaire:

Enregistrer un commentaire