Skip to content

Commit

Permalink
markdown compatible description
Browse files Browse the repository at this point in the history
  • Loading branch information
flyerhzm committed Feb 16, 2021
1 parent 7571e80 commit 4197725
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions lib/will_paginate/use_new_syntax.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
# frozen_string_literal: true

Synvert::Rewriter.new 'will_paginate', 'use_new_syntax' do
description <<~EOF
description <<~EOS
It uses will_paginate new syntax.
Post.paginate(:conditions => {:active => true}, :order => "created_at DESC", :per_page => 10, :page => 1)
=>
Post.where(:active => true).order("created_at DESC").paginate(:per_page => 10, :page => 1)
Post.paginated_each(:conditions => {:active => true}, :order => "created_at DESC", :per_page => 10) do |post|
end
=>
Post.where(:active => true).order("created_at DESC").find_each(:batch_size => 10) do |post|
end
EOF
```ruby
Post.paginate(:conditions => {:active => true}, :order => "created_at DESC", :per_page => 10, :page => 1)
Post.paginated_each(:conditions => {:active => true}, :order => "created_at DESC", :per_page => 10) do |post|
end
```
=>
```ruby
Post.where(:active => true).order("created_at DESC").paginate(:per_page => 10, :page => 1)
Post.where(:active => true).order("created_at DESC").find_each(:batch_size => 10) do |post|
end
```
EOS

if_gem 'will_paginate', { gte: '3.0.0' }

Expand Down

0 comments on commit 4197725

Please sign in to comment.