Installation:
ruby script/plugin install git://github.com/norman/active_record_random.git
Controllers:
@countries = Country.find(:all, :order => :random, :limit => 10)
Controller using will_paginate:
@countries = Country.paginate :page => params[:page], :per_page => 20, :order => :random
Views:
<% for country in @countries %>
<%=h country.name %>
<% end %>
<%= will_paginate @countries %>
http://github.com/norman/active_record_random/tree/master
0 comments:
Post a Comment