amatsuda/kaminari — pull request #548 by dblommesteijn (2014-04-21 23:31:44+00:00)
Title: ActionView check for NilClass & unextended models

I've added some checks for NilClass and Unextended models in an empty Array (missing methods: entry_name, limit_value, offset_value, total_count), which are used in `lib/kaminari/helpers/action_view_extension.rb` in helper methods: paginate, link_to_previous_page, link_to_next_page, page_entries_info, and rel_next_prev_link_tags.

This way I can safely use those helpers, without having to manually check their types in the views (reducing the chance of accidental issues). Below a sample code snippet:

```haml
# controller
unless current_user.nil?
@posts = current_user.all_posts
end
# view
div.paginate
= paginate @posts
= link_to_previous_page @posts, "<< Previous"
= link_to_next_page @posts, "Next >>"
= page_entries_info @posts
= rel_next_prev_link_tags @posts
```

PS. I've included tests for these altered helpers as well. All `action_view_extension.rb` tests are still successful.