FRONTEND & RUBY ON RAILS AGENDA INTRODUCCIÓN LAYOUTS PARTIALS ASSETS FORMS AGENDA INTRODUCCIÓN LAYOUTS PARTIALS ASSE
Views 119 Downloads 4 File size 570KB
FRONTEND & RUBY ON RAILS
AGENDA INTRODUCCIÓN LAYOUTS PARTIALS ASSETS FORMS
AGENDA INTRODUCCIÓN LAYOUTS PARTIALS ASSETS FORMS
REQUESTS & RESPONSES Los controllers generan los responses. Posibilidades:
render redirect_to head
RENDER CoC class CategoriesController < ApplicationController # ... def index end #... end # # # # #
Asumiendo que en routes.rb encontramos resources :categories El controller hace render de app/views/categories/index.html.erb
REQUESTS & RESPONSES def update respond_to do |format| if @blog.update(blog_params) format.html { redirect_to @blog, notice: 'Blog was successfully updated.' } format.json { render :show, status: :ok, location: @blog } else format.html { render :edit } format.json { render json: @blog.errors, status: :unprocessable_entity } end end end
AGENDA INTRODUCCIÓN LAYOUTS PARTIALS ASSETS FORMS FRONTEND GEMS & FRAMEWORKS
LAYOUTS app/views/layouts application.html.erb
HELPERS layout helpers auto_discovery_link_tag javascript_include_tag stylesheet_link_tag image_tag video_tag audio_tag
HELPERS javascript_include_tag javascript_include_tag -> HTML script tag
genera
HELPERS javascript_include_tag Múltiples archivos
HELPERS stylesheet_link_tag
HELPERS image_tag
HELPERS video_tag
genera (por defecto /public/videos)
HELPERS video_tag
genera (por defecto /public/videos)
HELPERS audio_tag
genera (por defecto /public/audios)
YIELD yield tag
la vista
YIELD Región de contenido nombrada
YIELD content_for
The page title
Welcome developers!
Welcome developers!
Category name
Category name
Category Name: