Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
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
270
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
Transcript
22 slides
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!
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
100
Conhecendo o módulo Forwardable do Ruby
jackson_pires
0
83
COMO INSPIRAR PESSOAS E MONETIZAR O SEU CONHECIMENTO?
jackson_pires
0
74
Conhecendo a gem guard, guard-rspec e guard-livereload
jackson_pires
0
93
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
190
Ruby on Rails para Iniciantes - Aula 47
jackson_pires
0
96
Ruby on Rails para Iniciantes - Aula 48
jackson_pires
0
390
Other Decks in Programming
See All in Programming
どうしても Eloquent でリポジトリパターンをやりたいんだ #phpcon_niigata / phpcon-niigata-2026
shogogg
0
670
将来の標準フォーマッター?ktfmtを深堀る
t45k
0
250
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
120
protojson における文字化けの扱い
kazuki1023
0
460
エラーチャンネルのボールを拾い続けて鍛えるエンジニアの地力 / phpcon-niigata2026
meihei3
1
500
JavaScriptはシングルバイナリの夢を見るか / Does JavaScript Dream of a Single Binary?
ssssota
0
130
AppFunctionsの内部実装を紐解く
hiroaki404
0
120
React Native経験者が Flutterを30⽇間触って驚いたこと
3saito
0
210
flutter_test のその先へ — Flutter アプリの LLM 機能に「評価」という品質保証を
kosukesaigusa
0
210
高橋メソッドでCVE解説シリーズ 〜CVE-2026-112816〜
hakkadaikon
0
270
baseline으로 마이그레이션, 리팩토링 안전하게 맡기기
fornewid
1
1.1k
ローカルLLMの基本と近況 2611 / Local LLM basics and recent situation 2611
kishida
3
660
Featured
See All Featured
Facilitating Awesome Meetings
lara
57
7.2k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
320
BBQ
matthewcrist
90
10k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
380
Ten Tips & Tricks for a 🌱 transition
stuffmc
1
290
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
790
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.5k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.5k
The browser strikes back
jonoalderson
0
2k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
820
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
121
130k