Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Rails Bootcamp [Sesión 04, 05]
Search
A. Felipe Cabargas Madrid
June 11, 2016
Programming
150
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Rails Bootcamp [Sesión 04, 05]
A. Felipe Cabargas Madrid
June 11, 2016
Transcript
20 slides
RAILS BOOTCAMP 4 JUNIO 2016
ACTIONVIEW ACTIONCONTROLLER
Datos del Modelo a la Vista: Controladores
app/controller/home_controller.rb class HomeController < ApplicationController def index @nombre = "Felipe"
@people = Person.all end end
La “pagina web”: Vistas
$ rails generate scaffold Person
/app/views/person
ERB
erb-loud
<%= @person.first.name %>
erb-silent
<% @person.each do |p| %> <% end %> Se utiliza
en ciclos u otro código que no se expondrá al usuario
Partials
$ touch app/views/layouts/ _navbar.html.erb
<h1> Hola <% if @nombre.nil? %> Mundo <% else %>
<%= @nombre %> <% end %> </h1> <hr>
<%= render 'layouts/navbar' %>
Asset Pipeline
LINKS <%= link_to 'Nuevo Post', new_post_path, class: ['hola', 'mundo'] %>
<%= link_to 'Posts', posts_url, id: 'mundo' %> <%= link_to 'Google', 'http://google.com' %> IMAGENES <%= image_tag 'leyton.jpg' %> CSS/JS (SASS/COFFEESCRIPT) <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks- track' => true %> <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
Una vista completa
<%= render 'layouts/navbar' %> <ul> <% @people.each do |var|%> <li>
<%= image_tag 'leyton.jpg' %> <strong><%= var.name %></strong> <p><%= var.email %></p> </li> <% end %> </ul> <% # RELATIVA %> <%= link_to 'Nuevo Post', new_post_path, class: ['hola', 'mundo'] %> <% # URL COMPLETA %> <%= link_to 'Posts', posts_url, id: 'mundo' %> <% # EXTERNA %> <%= link_to 'Google', 'http://google.com' %>
More Decks by A. Felipe Cabargas Madrid
See All by A. Felipe Cabargas Madrid
Layers Layers Layers
felipecabargas
0
80
Accesibilidad Web: Que, como, cuando y por que?
felipecabargas
0
65
Untangling git
felipecabargas
0
75
Docker 101
felipecabargas
1
100
GroupRaise Learning Fridays: UX 101
felipecabargas
0
120
GroupRaise Learning Fridays: Hows and whys of version control
felipecabargas
0
67
Sesion III - Taller RoR LCC
felipecabargas
0
110
Sesion II - Taller RoR LCC
felipecabargas
0
140
Taller RoR LCC
felipecabargas
0
170
Other Decks in Programming
See All in Programming
どうしても Eloquent でリポジトリパターンをやりたいんだ #phpcon_niigata / phpcon-niigata-2026
shogogg
0
670
Materialが消えた日 〜真っ白なFlutterキャンバスにRenderObjectで絵を描く〜
umigishiaoi
0
170
将来の標準フォーマッター?ktfmtを深堀る
t45k
0
240
仕様駆動開発入門 (何を作るかを先に決めて渡す) | 目指せ Kiro マスター 05
inariku
PRO
3
220
AIが生成したコードは読むべきか?抽象化設計とコードの品質保証 / abstraction-design-and-quality
minodriven
17
9.5k
Ruby から Emacs を操作したい
phigasui
0
380
AIコーディング時代のKotest ユニットテストから APIレベルの仕様固定化テストへ
ooga04
0
330
baseline으로 마이그레이션, 리팩토링 안전하게 맡기기
fornewid
1
1.1k
느린 네트워크와 저사양 디바이스 사용자를 위한 웹뷰 로딩 시간 개선기
kmkim
1
270
React Native経験者が Flutterを30⽇間触って驚いたこと
3saito
0
200
Proxmox x Talos Linux x Terraform で実現するなんかいい感じの Kubernetes クラスタ / A Sleek Kubernetes Cluster Powered by Proxmox, Talos Linux, and Terraform
nnaka2992
0
300
Python Lambdaにおけるテストしやすい設計とAI支援の活用 / Designing Testable Python Lambda Functions with AI
kitano_yuichi
1
350
Featured
See All Featured
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.2k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
540
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
4
4.4k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3.1k
The Language of Interfaces
destraynor
162
27k
[SF Ruby Conf 2025] Rails X
palkan
3
1.5k
A better future with KSS
kneath
240
18k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
850
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.7k
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
4
1.3k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3.1k
Tell your own story through comics
letsgokoyo
1
1.1k