SlideShare a Scribd company logo
1 of 14
Download to read offline
Rails Gems:
Will_Paginate
Kaminari
Kuyseng Chhoeurn
Contents
● Gem vs RubyGems
● RVM, Gemset, bundler, rvmrc
● Will_Paginate
● Kaminari
● Q/A ?
● Practice
● References
RubyGems vs Gem
● Gem is a libraries (a collection of code to do
something)
e.g. rails, rspec, rake, bundler, will_paginate, kaminari,...
● RubyGems is a tool designed to easily manage
the installation of gems, and a server for
distributing them.
e.g. gem list, gem install, gem uninstall,
gem –help command (#list all gem commands)
RVM, Bundler
● RVM (Ruby Version Manager) is a command-
line tool which allows you to easily install,
manage, and work with multiple ruby
environments from interpreters to sets of gems.
e.g. rvm list, rvm install, rvm use, rvm gemset create,...
● Bundler is a gem to manage your application's
gem dependencies with less pain. (after install
ruby)
e.g. bundle install, bundle update,...
Gemset, rvmrc
● Gemset is a set of gems.
e.g. rvm gemset list, rvm gemset create rails4
● rvmrc is a dot file in repo to auto choose
gemset ...
e.g. rvm gemset create rails4, rvm gemset use rails4, rvm
gemset use rails4, rvm gemset create rails4
will_paginate
● Introduction:
will_paginate is a pagination library that integrates with Ruby on Rails, Sinatra, Merb,
DataMapper and Sequel.
● Set up Git:
$ git init
$ git add --all
$ git commit -m 'before will_paginate'
● How to Use:
1) Add in Gemfile & bundle install
gem 'will_paginate', '~> 3.0'
2) perform a paginated query
Movie.released.paginate(page: params[:page], per_page: 3)
will_paginate
3) render page links in the view
4) see the result in browser
5) make those pagination links prettier
# Download css or sass from “http://mislav.uniqpath.com/will_paginate/”
into “app/assets/stylesheets/”
# add in applications.css
*= require pagination
6) Use css class in the paginate helper
<%= will_paginate @movies, class: 'flickr_pagination' %>
<%= will_paginate @movies %>
will_paginate
7) See the result
● Git Commit:
$ git status
$ git add --all
$ git commit -m 'added will_paginate'
kaminari
●
Introduction:
A Scope & Engine based, clean, powerful, customizable
and sophisticated paginator for modern web app
frameworks and ORMs.
● How to Use:
1)Add in Gemfile & bundle install
gem 'kaminari'
2) perform a paginated query
Movie.released.page(params[:page]).per(3)
kaminari
3) render page links in the view
<%= paginate @movies %>
4) see the result in browser
5) play around with theme
$ rails g kaminari:views # to list themes
$ rails g kaminari:views google
$ rails d kaminari:views google # destroy theme
$ rails g kaminari:views bootstrap
kaminari
6) play around with helper & locales
- delete first, last and keep previous & next
- use outer_windows: 3
- use link_to_next_page, link_to_previous_page
Git commit
$ git status
$ git add --all
$ git commit -m 'kaminari with some custome'
Questions & Answers
Practice
● Add header paginate have Previous and Next buttons
● Add footer paginate with outer_window: 3 in bootstrap
theme and no first and last link
References:
● http://en.wikipedia.org/wiki/RubyGems
● http://bundler.io/
● https://github.com/bundler/bundler
● https://rvm.io
● http://www.codeschool.com/courses/try-git
● http://rubygems.org/
● https://github.com/mislav/will_paginate
● https://github.com/amatsuda/kaminari
● http://railscasts.com/episodes/51-will-paginate-revised
● http://railscasts.com/episodes/254-pagination-with-kaminari

More Related Content

What's hot

JSConf US 2014: Building Isomorphic Apps
JSConf US 2014: Building Isomorphic AppsJSConf US 2014: Building Isomorphic Apps
JSConf US 2014: Building Isomorphic AppsSpike Brehm
 
a_rubygem_for_iknow_api
a_rubygem_for_iknow_apia_rubygem_for_iknow_api
a_rubygem_for_iknow_apiNov Matake
 
RVM, Bundler and Ruby Tracker
RVM, Bundler and Ruby TrackerRVM, Bundler and Ruby Tracker
RVM, Bundler and Ruby TrackerKeith Pitty
 
Секретный доклад о React Router - OdessaJS 2014
Секретный доклад о React Router - OdessaJS 2014Секретный доклад о React Router - OdessaJS 2014
Секретный доклад о React Router - OdessaJS 2014Andrey Listochkin
 
Once upon a time, there were css, js and server-side rendering
Once upon a time, there were css, js and server-side renderingOnce upon a time, there were css, js and server-side rendering
Once upon a time, there were css, js and server-side renderingAndrea Giannantonio
 
Introducing Merb
Introducing MerbIntroducing Merb
Introducing MerbBalint Erdi
 
General Assembly Workshop: Advanced JavaScript
General Assembly Workshop: Advanced JavaScriptGeneral Assembly Workshop: Advanced JavaScript
General Assembly Workshop: Advanced JavaScriptSpike Brehm
 
Ruby Sapporo Night Vol2
Ruby Sapporo Night Vol2Ruby Sapporo Night Vol2
Ruby Sapporo Night Vol2Koji SHIMADA
 
Be Happy With Ruby on Rails - Ecosystem
Be Happy With Ruby on Rails - EcosystemBe Happy With Ruby on Rails - Ecosystem
Be Happy With Ruby on Rails - EcosystemLucas Renan
 
An Introduction to node.js
An Introduction to node.jsAn Introduction to node.js
An Introduction to node.jsnodejsbcn
 
Cuvic OnDemand on JRuby
Cuvic OnDemand on JRubyCuvic OnDemand on JRuby
Cuvic OnDemand on JRubyKoichiro Ohba
 
MVVM Windows UWP apps with Template 10
MVVM Windows UWP apps with Template 10MVVM Windows UWP apps with Template 10
MVVM Windows UWP apps with Template 10Jiri Danihelka
 
Inesita — Ihor Strumetskyi
Inesita — Ihor StrumetskyiInesita — Ihor Strumetskyi
Inesita — Ihor StrumetskyiRuby Meditation
 
A Toda Maquina Con Ruby on Rails
A Toda Maquina Con Ruby on RailsA Toda Maquina Con Ruby on Rails
A Toda Maquina Con Ruby on RailsRafael García
 

What's hot (19)

JSConf US 2014: Building Isomorphic Apps
JSConf US 2014: Building Isomorphic AppsJSConf US 2014: Building Isomorphic Apps
JSConf US 2014: Building Isomorphic Apps
 
Very Xd
Very XdVery Xd
Very Xd
 
RubyGem
RubyGemRubyGem
RubyGem
 
a_rubygem_for_iknow_api
a_rubygem_for_iknow_apia_rubygem_for_iknow_api
a_rubygem_for_iknow_api
 
TsWorkflow
TsWorkflowTsWorkflow
TsWorkflow
 
RVM, Bundler and Ruby Tracker
RVM, Bundler and Ruby TrackerRVM, Bundler and Ruby Tracker
RVM, Bundler and Ruby Tracker
 
Секретный доклад о React Router - OdessaJS 2014
Секретный доклад о React Router - OdessaJS 2014Секретный доклад о React Router - OdessaJS 2014
Секретный доклад о React Router - OdessaJS 2014
 
Once upon a time, there were css, js and server-side rendering
Once upon a time, there were css, js and server-side renderingOnce upon a time, there were css, js and server-side rendering
Once upon a time, there were css, js and server-side rendering
 
Introducing Merb
Introducing MerbIntroducing Merb
Introducing Merb
 
General Assembly Workshop: Advanced JavaScript
General Assembly Workshop: Advanced JavaScriptGeneral Assembly Workshop: Advanced JavaScript
General Assembly Workshop: Advanced JavaScript
 
Ruby Sapporo Night Vol2
Ruby Sapporo Night Vol2Ruby Sapporo Night Vol2
Ruby Sapporo Night Vol2
 
Be Happy With Ruby on Rails - Ecosystem
Be Happy With Ruby on Rails - EcosystemBe Happy With Ruby on Rails - Ecosystem
Be Happy With Ruby on Rails - Ecosystem
 
Juju presentation
Juju presentationJuju presentation
Juju presentation
 
An Introduction to node.js
An Introduction to node.jsAn Introduction to node.js
An Introduction to node.js
 
Cuvic OnDemand on JRuby
Cuvic OnDemand on JRubyCuvic OnDemand on JRuby
Cuvic OnDemand on JRuby
 
MVVM Windows UWP apps with Template 10
MVVM Windows UWP apps with Template 10MVVM Windows UWP apps with Template 10
MVVM Windows UWP apps with Template 10
 
Inesita — Ihor Strumetskyi
Inesita — Ihor StrumetskyiInesita — Ihor Strumetskyi
Inesita — Ihor Strumetskyi
 
An Intro into webpack
An Intro into webpackAn Intro into webpack
An Intro into webpack
 
A Toda Maquina Con Ruby on Rails
A Toda Maquina Con Ruby on RailsA Toda Maquina Con Ruby on Rails
A Toda Maquina Con Ruby on Rails
 

Similar to Will paginate and kaminari

RoR (Ruby on Rails)
RoR (Ruby on Rails)RoR (Ruby on Rails)
RoR (Ruby on Rails)scandiweb
 
Rails Engine | Modular application
Rails Engine | Modular applicationRails Engine | Modular application
Rails Engine | Modular applicationmirrec
 
JRuby, Ruby, Rails and You on the Cloud
JRuby, Ruby, Rails and You on the CloudJRuby, Ruby, Rails and You on the Cloud
JRuby, Ruby, Rails and You on the CloudHiro Asari
 
Capybara and cucumber with DSL using ruby
Capybara and cucumber with DSL using rubyCapybara and cucumber with DSL using ruby
Capybara and cucumber with DSL using rubyDeepak Chandella
 
Consegi 2010 - Dicas de Desenvolvimento Web com Ruby
Consegi 2010 - Dicas de Desenvolvimento Web com RubyConsegi 2010 - Dicas de Desenvolvimento Web com Ruby
Consegi 2010 - Dicas de Desenvolvimento Web com RubyFabio Akita
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby TeamArto Artnik
 
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...Matt Raible
 
Introduction to padrino
Introduction to padrinoIntroduction to padrino
Introduction to padrinoVictor Stan
 
JavaScript Modules Done Right
JavaScript Modules Done RightJavaScript Modules Done Right
JavaScript Modules Done RightMariusz Nowak
 
Client Side MVC with Backbone and Rails
Client Side MVC with Backbone and RailsClient Side MVC with Backbone and Rails
Client Side MVC with Backbone and RailsTom Z Zeng
 
Radiant CMS - Boston.rb 7/12
Radiant CMS - Boston.rb 7/12Radiant CMS - Boston.rb 7/12
Radiant CMS - Boston.rb 7/12joliveira
 
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & CucumberUdaya Kiran
 
DiUS Computing Lca Rails Final
DiUS  Computing Lca Rails FinalDiUS  Computing Lca Rails Final
DiUS Computing Lca Rails FinalRobert Postill
 
Ruby On Rails Basics
Ruby On Rails BasicsRuby On Rails Basics
Ruby On Rails BasicsAmit Solanki
 
Wordpress Workflow
Wordpress Workflow Wordpress Workflow
Wordpress Workflow Filippo Dino
 
Fisl 11 - Dicas de Desenvolvimento Web com Ruby
Fisl 11 - Dicas de Desenvolvimento Web com RubyFisl 11 - Dicas de Desenvolvimento Web com Ruby
Fisl 11 - Dicas de Desenvolvimento Web com RubyFabio Akita
 
Ruby on Rails: Coding Guideline
Ruby on Rails: Coding GuidelineRuby on Rails: Coding Guideline
Ruby on Rails: Coding GuidelineNascenia IT
 
Ruby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developerRuby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developergicappa
 

Similar to Will paginate and kaminari (20)

RoR (Ruby on Rails)
RoR (Ruby on Rails)RoR (Ruby on Rails)
RoR (Ruby on Rails)
 
Rails Engine | Modular application
Rails Engine | Modular applicationRails Engine | Modular application
Rails Engine | Modular application
 
JRuby, Ruby, Rails and You on the Cloud
JRuby, Ruby, Rails and You on the CloudJRuby, Ruby, Rails and You on the Cloud
JRuby, Ruby, Rails and You on the Cloud
 
Capybara and cucumber with DSL using ruby
Capybara and cucumber with DSL using rubyCapybara and cucumber with DSL using ruby
Capybara and cucumber with DSL using ruby
 
Consegi 2010 - Dicas de Desenvolvimento Web com Ruby
Consegi 2010 - Dicas de Desenvolvimento Web com RubyConsegi 2010 - Dicas de Desenvolvimento Web com Ruby
Consegi 2010 - Dicas de Desenvolvimento Web com Ruby
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby Team
 
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
 
Sinatra
SinatraSinatra
Sinatra
 
Introduction to padrino
Introduction to padrinoIntroduction to padrino
Introduction to padrino
 
JavaScript Modules Done Right
JavaScript Modules Done RightJavaScript Modules Done Right
JavaScript Modules Done Right
 
Client Side MVC with Backbone and Rails
Client Side MVC with Backbone and RailsClient Side MVC with Backbone and Rails
Client Side MVC with Backbone and Rails
 
Radiant CMS - Boston.rb 7/12
Radiant CMS - Boston.rb 7/12Radiant CMS - Boston.rb 7/12
Radiant CMS - Boston.rb 7/12
 
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
 
Intro to Sails.js
Intro to Sails.jsIntro to Sails.js
Intro to Sails.js
 
DiUS Computing Lca Rails Final
DiUS  Computing Lca Rails FinalDiUS  Computing Lca Rails Final
DiUS Computing Lca Rails Final
 
Ruby On Rails Basics
Ruby On Rails BasicsRuby On Rails Basics
Ruby On Rails Basics
 
Wordpress Workflow
Wordpress Workflow Wordpress Workflow
Wordpress Workflow
 
Fisl 11 - Dicas de Desenvolvimento Web com Ruby
Fisl 11 - Dicas de Desenvolvimento Web com RubyFisl 11 - Dicas de Desenvolvimento Web com Ruby
Fisl 11 - Dicas de Desenvolvimento Web com Ruby
 
Ruby on Rails: Coding Guideline
Ruby on Rails: Coding GuidelineRuby on Rails: Coding Guideline
Ruby on Rails: Coding Guideline
 
Ruby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developerRuby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developer
 

Recently uploaded

Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsAndrey Dotsenko
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 

Recently uploaded (20)

Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 

Will paginate and kaminari

  • 2. Contents ● Gem vs RubyGems ● RVM, Gemset, bundler, rvmrc ● Will_Paginate ● Kaminari ● Q/A ? ● Practice ● References
  • 3. RubyGems vs Gem ● Gem is a libraries (a collection of code to do something) e.g. rails, rspec, rake, bundler, will_paginate, kaminari,... ● RubyGems is a tool designed to easily manage the installation of gems, and a server for distributing them. e.g. gem list, gem install, gem uninstall, gem –help command (#list all gem commands)
  • 4. RVM, Bundler ● RVM (Ruby Version Manager) is a command- line tool which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems. e.g. rvm list, rvm install, rvm use, rvm gemset create,... ● Bundler is a gem to manage your application's gem dependencies with less pain. (after install ruby) e.g. bundle install, bundle update,...
  • 5. Gemset, rvmrc ● Gemset is a set of gems. e.g. rvm gemset list, rvm gemset create rails4 ● rvmrc is a dot file in repo to auto choose gemset ... e.g. rvm gemset create rails4, rvm gemset use rails4, rvm gemset use rails4, rvm gemset create rails4
  • 6. will_paginate ● Introduction: will_paginate is a pagination library that integrates with Ruby on Rails, Sinatra, Merb, DataMapper and Sequel. ● Set up Git: $ git init $ git add --all $ git commit -m 'before will_paginate' ● How to Use: 1) Add in Gemfile & bundle install gem 'will_paginate', '~> 3.0' 2) perform a paginated query Movie.released.paginate(page: params[:page], per_page: 3)
  • 7. will_paginate 3) render page links in the view 4) see the result in browser 5) make those pagination links prettier # Download css or sass from “http://mislav.uniqpath.com/will_paginate/” into “app/assets/stylesheets/” # add in applications.css *= require pagination 6) Use css class in the paginate helper <%= will_paginate @movies, class: 'flickr_pagination' %> <%= will_paginate @movies %>
  • 8. will_paginate 7) See the result ● Git Commit: $ git status $ git add --all $ git commit -m 'added will_paginate'
  • 9. kaminari ● Introduction: A Scope & Engine based, clean, powerful, customizable and sophisticated paginator for modern web app frameworks and ORMs. ● How to Use: 1)Add in Gemfile & bundle install gem 'kaminari' 2) perform a paginated query Movie.released.page(params[:page]).per(3)
  • 10. kaminari 3) render page links in the view <%= paginate @movies %> 4) see the result in browser 5) play around with theme $ rails g kaminari:views # to list themes $ rails g kaminari:views google $ rails d kaminari:views google # destroy theme $ rails g kaminari:views bootstrap
  • 11. kaminari 6) play around with helper & locales - delete first, last and keep previous & next - use outer_windows: 3 - use link_to_next_page, link_to_previous_page Git commit $ git status $ git add --all $ git commit -m 'kaminari with some custome'
  • 13. Practice ● Add header paginate have Previous and Next buttons ● Add footer paginate with outer_window: 3 in bootstrap theme and no first and last link
  • 14. References: ● http://en.wikipedia.org/wiki/RubyGems ● http://bundler.io/ ● https://github.com/bundler/bundler ● https://rvm.io ● http://www.codeschool.com/courses/try-git ● http://rubygems.org/ ● https://github.com/mislav/will_paginate ● https://github.com/amatsuda/kaminari ● http://railscasts.com/episodes/51-will-paginate-revised ● http://railscasts.com/episodes/254-pagination-with-kaminari