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
260
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Ruby on Rails para Iniciantes - Aula 40
Criando pesquisas com o Ransack (Básico) 40
Jackson Pires
May 19, 2015
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
96
Conhecendo o módulo Forwardable do Ruby
jackson_pires
0
79
COMO INSPIRAR PESSOAS E MONETIZAR O SEU CONHECIMENTO?
jackson_pires
0
70
Conhecendo a gem guard, guard-rspec e guard-livereload
jackson_pires
0
88
GDG Meetup - Carreiras em T.I.
jackson_pires
0
100
20 minutos insanos de TDD e Ruby
jackson_pires
0
130
Ruby on Rails para Iniciantes - Aula 46
jackson_pires
0
180
Ruby on Rails para Iniciantes - Aula 47
jackson_pires
0
89
Ruby on Rails para Iniciantes - Aula 48
jackson_pires
0
380
Other Decks in Programming
See All in Programming
GraphRAGのKnowledge Graphを 直接!見る/View-GraphRAG's-KnowledgeGraph-directly!
tyumugi1113
0
210
go-spidermonkeyでAIエージェントのCode Modeを実装する
syumai
3
1.5k
バグを直したら useEffect が消えた
colorful12
3
830
AI時代に学ぶ 好きなルール 嫌いなルール Linter編
shorty5121
0
810
ALB ログから Trace を気合で繋げる技術
fohte
7
860
Vibes Containers 〜AIで変わるコンテナ設計と運用〜
tkikuc
1
470
kubernetes コンポーネント開発入門 / 新卒N年目の勉強会&交流会!〜〇〇への誘い〜 #n_study
mazrean
0
160
初めての模倣学習とVLA
natsutan
0
460
不幸な GC
chencmd
0
870
まだ間に合う!今年の夏こそSchemeのマクロ展開器を完全理解!
omasanori
0
620
What We Talk About When We Talk About XP
m_seki
2
340
ハーネス設計入門 〜プロンプト、コンテキストの次〜
kinopeee
53
35k
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
470
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
500
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
890
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
370
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
440
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
380
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
57k
Discover your Explorer Soul
emna__ayadi
2
1.3k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
490
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!