Skip to content

Commit f84ac1c

Browse files
committed
Fixed to_i position
1 parent 19d8ec2 commit f84ac1c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,12 @@ class CategorySerializer < ActiveModel::Serializer
237237
has_one :user
238238
has_many :posts
239239
def posts
240-
post_page = instance_options.dig(:pagaination_param, :post_page).presence.to_i || 1
241-
post_per = instance_options.dig(:pagaination_param, :post_per).presence.to_i || 10
240+
post_page = (instance_options.dig(:pagaination_param, :post_page).presence || 1).to_i
241+
post_per = (instance_options.dig(:pagaination_param, :post_per).presence || 0).to_i
242242
object.posts.published.by_date.page(post_page).per(post_per)
243243
end
244244
def posts_pagination
245-
post_per = instance_options.dig(:pagaination_param, :post_per).presence.to_i || 10
245+
post_per = (instance_options.dig(:pagaination_param, :post_per).presence || 10).to_i
246246
Pagination.build_json(posts)[:posts_pagination] if post_per > 0
247247
end
248248
end

0 commit comments

Comments
 (0)