Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Ruby on Rails para Iniciantes - Aula 40
Search
Jackson Pires
May 19, 2015
Programming
0
260
Ruby on Rails para Iniciantes - Aula 40
Criando pesquisas com o Ransack (Básico) 40
Jackson Pires
May 19, 2015
Tweet
Share
More Decks by Jackson Pires
See All by Jackson Pires
Como usar uma box Vagrant com a Cloud9 IDE para desenvolver com Elixir ou Phoenix?
jackson_pires
0
82
Conhecendo o módulo Forwardable do Ruby
jackson_pires
0
67
COMO INSPIRAR PESSOAS E MONETIZAR O SEU CONHECIMENTO?
jackson_pires
0
57
Conhecendo a gem guard, guard-rspec e guard-livereload
jackson_pires
0
82
GDG Meetup - Carreiras em T.I.
jackson_pires
0
87
20 minutos insanos de TDD e Ruby
jackson_pires
0
110
Ruby on Rails para Iniciantes - Aula 46
jackson_pires
0
170
Ruby on Rails para Iniciantes - Aula 47
jackson_pires
0
82
Ruby on Rails para Iniciantes - Aula 48
jackson_pires
0
370
Other Decks in Programming
See All in Programming
AIコーディングエージェント(NotebookLM)
kondai24
0
240
AI前提で考えるiOSアプリのモダナイズ設計
yuukiw00w
0
190
DevFest Android in Korea 2025 - 개발자 커뮤니티를 통해 얻는 가치
wisemuji
0
170
Basic Architectures
denyspoltorak
0
130
AI時代を生き抜く 新卒エンジニアの生きる道
coconala_engineer
1
450
Cell-Based Architecture
larchanjo
0
150
フルサイクルエンジニアリングをAI Agentで全自動化したい 〜構想と現在地〜
kamina_zzz
0
310
認証・認可の基本を学ぼう後編
kouyuume
0
250
AtCoder Conference 2025
shindannin
0
710
これならできる!個人開発のすゝめ
tinykitten
PRO
0
130
Tinkerbellから学ぶ、Podで DHCPをリッスンする手法
tomokon
0
140
gunshi
kazupon
1
120
Featured
See All Featured
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
55k
A Soul's Torment
seathinner
1
2k
Into the Great Unknown - MozCon
thekraken
40
2.2k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
110
Are puppies a ranking factor?
jonoalderson
0
2.5k
Designing Powerful Visuals for Engaging Learning
tmiket
0
190
Docker and Python
trallard
47
3.7k
Context Engineering - Making Every Token Count
addyosmani
9
560
The Curious Case for Waylosing
cassininazir
0
190
Reflections from 52 weeks, 52 projects
jeffersonlam
355
21k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
31
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.4k
Transcript
Ruby on Rails Para iniciantes - 3a Temporada \o/
http://videosdeti.com.br
[email protected]
Mentoring
Patrocinadores Roger Bernardi
Aula 40 Criando pesquisas com o Ransack (básico)
Ruby on Rails Index Customer Products Usuários Autenticados (normal_user, admin)
Addresses ControlUsers Usuários Autenticados (admin)
Ruby on Rails Products description quantity
Ruby on Rails Ransack
Ruby on Rails Adicione ao Gemfile... gem ‘ransack’
Ruby on Rails Rode o bundle install
Ruby on Rails Simple Mode
Ruby on Rails Helper search_form_for
Ruby on Rails Na View <%= search_form_for @q do |f|
%> <%= f.label :description_cont %> <%= f.search_field :description_cont %> <%= f.submit %> <% end %>
Ruby on Rails No Controller def index @q = Product.ransack(params[:q])
@products = @q.result end
Ruby on Rails Ordenando Colunas sort_link
Ruby on Rails Ordenando Colunas <%= sort_link(@q, :description) %>
Ruby on Rails Adicionando mais opções de pesquisa na view
Ruby on Rails Products description quantity
Ruby on Rails Adicionando mais opções de pesquisa na view
<%= f.label :quantity_lteq %> <%= f.search_field :quantity_lteq %>
Ruby on Rails Pesquisas não restritivas AND => OR def
index @q = Product.ransack(params[:q].try(:merge, m: 'or')) @products = @q.result end
Ruby on Rails Automatizando o E/OU Na view <%= f.select
:combinator, [[‘E’,’and’],[’OU’,’or’]], @q %> No controller @q = Product.ransack(params[:q].try(:merge, m: params[:combinator]))
Ruby on Rails Obrigado!