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
79
Conhecendo o módulo Forwardable do Ruby
jackson_pires
0
65
COMO INSPIRAR PESSOAS E MONETIZAR O SEU CONHECIMENTO?
jackson_pires
0
56
Conhecendo a gem guard, guard-rspec e guard-livereload
jackson_pires
0
80
GDG Meetup - Carreiras em T.I.
jackson_pires
0
82
20 minutos insanos de TDD e Ruby
jackson_pires
0
110
Ruby on Rails para Iniciantes - Aula 46
jackson_pires
0
160
Ruby on Rails para Iniciantes - Aula 47
jackson_pires
0
80
Ruby on Rails para Iniciantes - Aula 48
jackson_pires
0
370
Other Decks in Programming
See All in Programming
Introducing ReActionView: A new ActionView-compatible ERB Engine @ Rails World 2025, Amsterdam
marcoroth
0
330
print("Hello, World")
eddie
1
410
AI時代のドメイン駆動設計-DDD実践におけるAI活用のあり方 / ddd-in-ai-era
minodriven
25
9.7k
1から理解するWeb Push
dora1998
3
1k
Vue・React マルチプロダクト開発を支える Vite
andpad
0
110
Kiroの仕様駆動開発から見えてきたAIコーディングとの正しい付き合い方
clshinji
1
200
詳解!defer panic recover のしくみ / Understanding defer, panic, and recover
convto
0
210
パッケージ設計の黒魔術/Kyoto.go#63
lufia
3
410
複雑なドメインに挑む.pdf
yukisakai1225
5
950
レガシープロジェクトで最大限AIの恩恵を受けられるようClaude Codeを利用する
tk1351
4
1.6k
フロントエンドのmonorepo化と責務分離のリアーキテクト
kajitack
2
160
「手軽で便利」に潜む罠。 Popover API を WCAG 2.2の視点で安全に使うには
taitotnk
0
540
Featured
See All Featured
Making the Leap to Tech Lead
cromwellryan
134
9.5k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
139
34k
Writing Fast Ruby
sferik
628
62k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
9
800
Raft: Consensus for Rubyists
vanstee
140
7.1k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
161
15k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.7k
Code Reviewing Like a Champion
maltzj
525
40k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
6.1k
Code Review Best Practice
trishagee
70
19k
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!