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
Nos trilhos do Ruby
Search
Daniel Cavalcante
February 03, 2016
Programming
70
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Nos trilhos do Ruby
Palestra ministrada na XIV semana da computação da UFPB.
Daniel Cavalcante
February 03, 2016
Transcript
36 slides
Nos trilhos do Ruby @danielcdesouza
Daniel Cavalcante
None
None
Rails?
! Framework Web Criado em 2003
David Heinemeier Hansson
" Ruby Linguagem de programação
# MVC Arquitetura
$ Don’t Repeat Yourself Não se repita (DRY)
% REST Organizar sua aplicação com recursos e verbos HTTP
& Convention over Configuration Framework baseado em convenções
Componentes
' Action Controller
/my_app ../app ../controllers ../books_controllers.rb controllers
class BooksController < ApplicationController def index @books = Book.all end
def show @book = Book.find(params[:id]) end end books_controller.rb
# Action View
/my_app ../app ../controllers ../books_controllers.rb ../views ../books ../index.html.erb ../show.html.erb views
<h2>My books</h2> <% @books.each do |book| %> <%= book.title %>
<%= book.author %> <% end %> index.html.erb
Active Record
class Book < ActiveRecord::Base validates_presence_of :title, :author, :user end book.rb
class BooksController < ApplicationController def index @books = Book.all end
def show @book = Book.find(params[:id]) end end books_controller.rb
# Active Resource
routes Rails.application.routes.draw do get ‘/books’ => ‘books#index’ get ‘/book’ =>
‘books#show’ end
routes Rails.application.routes.draw do resources :books end
•Action Controller •Action View •Active Record •Active Resource •Action Mailer
•Railties •Active Support outros componentes …
instalação Instale o Ruby on Rails $ gem install rails
criando o app Criando seu primeiro projeto $ rails new
my_app
arquivos gerados pelo Rails
gemfile source ‘https://rubygems.org' gem 'rails', '4.2.3' gem 'pg' gem 'sass-rails',
'~> 5.0' gem 'uglifier', '>= 1.3.0' gem 'coffee-rails', '~> 4.1.0' gem 'jquery-rails' gem 'turbolinks' gem 'jbuilder', '~> 2.0’ gem 'sdoc', '~> 0.4.0', group: :doc group :development, :test do gem 'byebug' gem 'web-console', '~> 2.0' end
gems Baixar gems $ bundle install
servidor Inicie o servidor $ rails server
acesse localmente Acesse a página da aplicação http://localhost:3000
Outros diferenciais
Jampa Ruby
) Obrigado *@danielcdesouza
More Decks by Daniel Cavalcante
See All by Daniel Cavalcante
Arquiteturas modulares com Node.JS
danielcdesouza
1
85
React Native e GraphQL na construção de mobile apps
danielcdesouza
0
77
Nest Framework
danielcdesouza
0
130
"Go" da Alemanha! Sete passos para começar a desenvolver em Go
danielcdesouza
0
100
Novidades do Ruby on Rails 5
danielcdesouza
0
70
Minerando jóias: como extrair o melhor do Ruby
danielcdesouza
0
68
Conhecendo o AngularJS
danielcdesouza
1
99
Começando com Ruby on Rails
danielcdesouza
0
110
Apresentação sobre Framework VRaptor
danielcdesouza
0
140
Other Decks in Programming
See All in Programming
AIコーディング時代のKotest ユニットテストから APIレベルの仕様固定化テストへ
ooga04
0
330
はじめてのPLATEAU
nokonoko1203
1
670
Ruby から Emacs を操作したい
phigasui
0
390
LLM 101
dalinaum
0
540
クラウドエージェントは、 何がそんなに便利なのか / what makes cloud agents so useful
rkaga
5
980
Materialが消えた日 〜真っ白なFlutterキャンバスにRenderObjectで絵を描く〜
umigishiaoi
0
170
複数ドメインを一つのアプリに統合するFlutterの設計と運用_FlutterKaigi2026登壇資料(須永高弘)
takahirosunaga
0
210
The Cost of the DOM
ypresto
2
200
止まらない比較を止める — 余帰納法で無限ストリームを比べる
tarao
0
210
テストだけで見つかる? Rubyでつくるメソッド発掘器
izawa
0
160
AI時代のIaC入門 〜なぜインフラをコードで管理したいのか?〜 / Introduction to IaC in the AI Era
akihisaikeda
6
1.6k
はじめてのKubernetesコントリビューション
nasa9084
0
320
Featured
See All Featured
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
2
410
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.5k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.7k
Facilitating Awesome Meetings
lara
57
7.2k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.4k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
68
61k
The Pragmatic Product Professional
lauravandoore
37
7.5k
Making Projects Easy
brettharned
120
6.9k
Well, that’s weird…
csswizardry
1
200
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
380
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
580
Web Performance Is a Journey [PerfNow 2026]
tammyeverts
2
150