Skip to content

Instantly share code, notes, and snippets.

@Fire-Dragon-DoL
Created February 19, 2013 23:17
Show Gist options
  • Save Fire-Dragon-DoL/4991159 to your computer and use it in GitHub Desktop.
Save Fire-Dragon-DoL/4991159 to your computer and use it in GitHub Desktop.
Gist showing kaminari functionality
class TripsController < ExtjsController
def viewer
if true # Ok qua non c'era questa if ma non mi va di andare a prendere in cima quella giusta
# ... Lunghissima e inutile configurazione della query...
@trips = Trip.joins(table_join_to_cache)
.where(trips_find_condition_values)
.uniq.order('begin_date ASC, title ASC')
.page(params[:page])
.per(15) if do_search
end
respond_to do |format|
format.html { render } # index.html.erb
end
end
end
<%= paginate @trips if @trips.length > 0 %>
<% @trips.each do |trip| %>
<%= render :partial => 'viewer_trip', :locals => { :trip => trip } %>
<% end %>
<% if @trips.length == 0 %>
<div style="text-align: center;">Nessuna escursione presente</div>
<% else %>
<%= paginate @trips %>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment