almicube
Extend Your Model
in app/models/item.rb
class Item < ActiveRecord::Base
ranking_with :access, as: Integer
end
in app/controllers/items\_controller.rb
class ItemsController
def index
@items = Item.access_ranking.page params[:page]
end
end
in `app/views/items/index.html.erb`
```erb
<ul>
<% @items.each do |item| %>
<li>[<%= item.access_ranking.rank %>] <%= item.name %><li>
<% end %>
</ul>
Note
- Almicube uses Redis for DataStore.