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
72
Conhecendo o módulo Forwardable do Ruby
jackson_pires
0
60
COMO INSPIRAR PESSOAS E MONETIZAR O SEU CONHECIMENTO?
jackson_pires
0
54
Conhecendo a gem guard, guard-rspec e guard-livereload
jackson_pires
0
78
GDG Meetup - Carreiras em T.I.
jackson_pires
0
70
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
78
Ruby on Rails para Iniciantes - Aula 48
jackson_pires
0
360
Other Decks in Programming
See All in Programming
Cloudflare MCP ServerでClaude Desktop からWeb APIを構築
kutakutat
1
630
Flatt Security XSS Challenge 解答・解説
flatt_security
0
520
アクターシステムに頼らずEvent Sourcingする方法について
j5ik2o
6
660
HTML/CSS超絶浅い説明
yuki0329
0
150
月刊 競技プログラミングをお仕事に役立てるには
terryu16
1
900
EC2からECSへ 念願のコンテナ移行と巨大レガシーPHPアプリケーションの再構築
sumiyae
3
540
ドメインイベント増えすぎ問題
h0r15h0
2
530
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
270
テストケースの名前はどうつけるべきか?
orgachem
PRO
1
180
テストコードのガイドライン 〜作成から運用まで〜
riku929hr
6
1.3k
テストコード書いてみませんか?
onopon
2
280
オニオンアーキテクチャを使って、 Unityと.NETでコードを共有する
soi013
0
340
Featured
See All Featured
Optimizing for Happiness
mojombo
376
70k
The Invisible Side of Design
smashingmag
299
50k
Optimising Largest Contentful Paint
csswizardry
33
3k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
230
52k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
Visualization
eitanlees
146
15k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
850
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
120k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
1
150
The Language of Interfaces
destraynor
155
24k
Java REST API Framework Comparison - PWX 2021
mraible
28
8.3k
A Philosophy of Restraint
colly
203
16k
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!