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
89
Conhecendo o módulo Forwardable do Ruby
jackson_pires
0
78
COMO INSPIRAR PESSOAS E MONETIZAR O SEU CONHECIMENTO?
jackson_pires
0
65
Conhecendo a gem guard, guard-rspec e guard-livereload
jackson_pires
0
87
GDG Meetup - Carreiras em T.I.
jackson_pires
0
99
20 minutos insanos de TDD e Ruby
jackson_pires
0
120
Ruby on Rails para Iniciantes - Aula 46
jackson_pires
0
180
Ruby on Rails para Iniciantes - Aula 47
jackson_pires
0
86
Ruby on Rails para Iniciantes - Aula 48
jackson_pires
0
380
Other Decks in Programming
See All in Programming
Strategic Design in the Frontend: Moduliths & Micro Frontends @DDDEurope
manfredsteyer
PRO
0
130
そのテスト、説明できますか?~LWテスト戦略FW~のご紹介
nakahara
0
170
メソッドのジェネリクスでGoの夢は広がるか? / Kyoto.go #65
utgwkk
3
980
ローカルLLMでどこまでコードが書けるか -拡張版 / How much code can be written on a local LLM Extended
kishida
12
4.5k
任せる範囲はこう広がった / How the Scope of AI Delegation Has Expanded
nrslib
0
160
Developing with AI Agents — Codex, Claude Code & Cowork Practical Guide
x5gtrn
PRO
0
1.3k
AI時代のUIはどこへ行く?その2!
yusukebe
22
7.5k
ECSアプリログをFireLensでコスト削減しようとしたけど諦めた話 in Fargate×Node.js
akihisaikeda
2
4.2k
セキュリティの専門家じゃなくてもできる。「セキュリティ意識」をアップデートして サプライチェーン攻撃への耐性を高めよう。
tk3fftk
5
970
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
8.5k
SREは、MCPとSRE Agentをこう使え!
kazumax55
0
120
生成AI時代にこそ効くGo | Why Go Works in the Age of Generative AI
mom0tomo
8
3.3k
Featured
See All Featured
The Curious Case for Waylosing
cassininazir
1
400
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
450
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
1
360
HDC tutorial
michielstock
2
720
The browser strikes back
jonoalderson
0
1.3k
Building the Perfect Custom Keyboard
takai
2
800
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
62
55k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
570
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
850
So, you think you're a good person
axbom
PRO
2
2.1k
Writing Fast Ruby
sferik
630
63k
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!