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
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
85
Conhecendo o módulo Forwardable do Ruby
jackson_pires
0
70
COMO INSPIRAR PESSOAS E MONETIZAR O SEU CONHECIMENTO?
jackson_pires
0
60
Conhecendo a gem guard, guard-rspec e guard-livereload
jackson_pires
0
85
GDG Meetup - Carreiras em T.I.
jackson_pires
0
91
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
84
Ruby on Rails para Iniciantes - Aula 48
jackson_pires
0
380
Other Decks in Programming
See All in Programming
Surviving Black Friday: 329 billion requests with Falcon!
ioquatix
0
3k
開発とはなにか、Essenceカーネルで見えるもの
ukin0k0
0
140
GitHubCopilotCLIをはじめよう.pdf
htkym
0
330
Firefoxにコントリビューションして得られた学び
ken7253
2
160
Liberating Ruby's Parser from Lexer Hacks
ydah
2
2.7k
書籍「ユーザーストーリーマッピング」が私のバイブル
asumikam
4
490
Claude CodeでETLジョブ実行テストを自動化してみた
yoshikikasama
0
1.2k
[RubyKaigi 2026] Require Hooks
palkan
1
310
「OSSがあるなら自作するな」は AI時代も正しいか ── Build vs Adopt の新しい判断基準
kumorn5s
7
2.6k
AI時代のエンジニアリングの原則 / Engineering Principles in the AI Era
haru860
0
1.2k
AIを導入する前にやるべきこと
negima
2
350
cloudnative conference 2026 flyle
azihsoyn
0
170
Featured
See All Featured
Side Projects
sachag
455
43k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.4k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
130
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.9k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
280
Designing for Timeless Needs
cassininazir
0
220
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
110
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Become a Pro
speakerdeck
PRO
31
5.9k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
920
Why Our Code Smells
bkeepers
PRO
340
58k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.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!