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
<ul>
<% @items.each do |item| %>
<li>[<%= item.access_ranking.rank %>] <%= item.name %><li>
<% end %>
</ul>
Note
- Almicube uses Redis for DataStore.
- Example Project: https://github.com/niaeashes/almicube-sample