Slide 5
Slide 5 text
The MVC way
jbuilder
Model
View (show.json.jbuilder)
Controller
class Model < ActiveRecord::Base
end
json.(@model, :id, :name)
json.other @model.compute_something
class ModelsController < ApplicationController
def show
@model = Model.find(params[:id])
end
end
We use templates like we do for html rendering
Partial templates
Multiple presentation for models, depending of the action
Advanced rendering