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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
83
Conhecendo o módulo Forwardable do Ruby
jackson_pires
0
69
COMO INSPIRAR PESSOAS E MONETIZAR O SEU CONHECIMENTO?
jackson_pires
0
58
Conhecendo a gem guard, guard-rspec e guard-livereload
jackson_pires
0
84
GDG Meetup - Carreiras em T.I.
jackson_pires
0
90
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
実践ハーネスエンジニアリング #MOSHTech
kajitack
7
4.8k
Ruby and LLM Ecosystem 2nd
koic
1
1.4k
PHPのバージョンアップ時にも役立ったAST(2026年版)
matsuo_atsushi
0
270
AIコードレビューの導入・運用と AI駆動開発における「AI4QA」の取り組みについて
hagevvashi
0
570
RailsのValidatesをSwift Macrosで再現してみた
hokuron
0
140
Smarter Angular mit Transformers.js & Prompt API
christianliebel
PRO
1
100
AIと共にエンジニアとPMの “二刀流”を実現する
naruogram
0
100
我々はなぜ「層」を分けるのか〜「関心の分離」と「抽象化」で手に入れる変更に強いシンプルな設計〜 #phperkaigi / PHPerKaigi 2026
shogogg
2
700
一度始めたらやめられない開発効率向上術 / Findy あなたのdotfilesを教えて!
k0kubun
1
860
見せてもらおうか、 OpenSearchの性能とやらを!
shunta27
1
150
守る「だけ」の優しいEMを抜けて、 事業とチームを両方見る視点を身につけた話
maroon8021
3
1.6k
Understanding Apache Lucene - More than just full-text search
spinscale
0
140
Featured
See All Featured
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
880
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
91
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
300
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.1k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.6k
Bash Introduction
62gerente
615
210k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Facilitating Awesome Meetings
lara
57
6.8k
WENDY [Excerpt]
tessaabrams
9
37k
Designing Experiences People Love
moore
143
24k
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!