Permalink
Browse files

Fixed will_paginate behavior changed by gem version update (it's no more

Array).
  • Loading branch information...
yoosee committed Sep 14, 2018
1 parent 5e4d436 commit aae40b1af39e0c09461558610349b52dcb6b7936
@@ -7,6 +7,8 @@ gem 'coffee-rails', '~> 4.2.2'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

gem 'bootsnap', '>= 1.1.0', require: false

gem 'unicorn'

gem 'bootstrap-sass' #, '3.2.0.0'
@@ -58,8 +60,9 @@ end

group :development do
# gem 'rspec-rails'
gem 'web-console', '~> 2.0'
gem 'web-console'
gem 'spring'
gem 'listen'

gem 'better_errors'
# gem 'quiet_assets'
@@ -13,8 +13,10 @@ def home

def index
# index shows all articles belongs to specific blog_id and status: published regardless users
articles = Article.where(blog_id: @blog.id).unscoped.published.order("published_at DESC").paginate(page: params[:page], :per_page => 5)
@articles = articles.each do |article|
# articles = Article.where(blog_id: @blog.id).unscoped.published.order("published_at DESC").paginate(page: params[:page], :per_page => 5)
# @articles_page particularly for will_paginate, while @article is Array for general use with markdown to html transferred
@articles_page = Article.where(blog_id: @blog.id).page(params[:page]).per_page(5).published.order("published_at DESC")
@articles = @articles_page.each do |article|
article.content = markdown article.content
end
end
@@ -30,11 +32,11 @@ def rss
end

def drafts
# Drafts shows draft articles belongs to current_user
articles = current_user.articles.unscoped.draft.order("updated_at DESC").paginate(page: params[:page], :per_page => 10)
@articles = articles.each do |article|
article.content = markdown article.content
end
# Drafts shows draft articles belongs to current_user. it isn't converted to html
@articles = current_user.articles.unscoped.draft.order("updated_at DESC").paginate(page: params[:page], :per_page => 10)
# @articles = articles.each do |article|
# article.content = markdown article.content
# end
end

def create
@@ -5,7 +5,7 @@
<small>a blog on first go without spending ages practicing.</small></h1>
</div>

<%= will_paginate %>
<%= will_paginate @articles_page %>

<div class="articles">
<% @articles.each do |article| %>
@@ -14,4 +14,4 @@
<% end %>
</div>

<%= will_paginate %>
<%= will_paginate @articles_page %>
@@ -0,0 +1 @@
#require 'will_paginate/array'

0 comments on commit aae40b1

Please sign in to comment.