search for: sort_column

Displaying 5 results from an estimated 5 matches for "sort_column".

2013 Apr 03
2
strange behavior with active relation any? method
...nil, because the else is triggered instead when I click on second page in view. What''s even weirder is that when I call inspect on @drivers, then @drivers.any? is evaluated to true in the view when I click on the second page using kaminari: @drivers = Driver.select("drivers.*, #{sort_column}") .joins([:reports, :driving_habits]) .by_month(for_selected_month.to_i, for_selected_year.to_i) .order(sort_column + " " + sort_direction) .page(params[:page]).per(1) puts "The drivers #{@driv...
2012 Mar 06
0
Devise/Cancan Signout User On Controller Action
...:all can :read, :all elsif user.role == 2 #Vendor can :manage, VendorTransaction can :index, Account end end end Ok Here is my Transaction controller require ''csv'' class TransactionsController < ApplicationController load_and_authorize_resource helper_method :sort_column, :sort_direction respond_to :html, :js def index per_page = 40 @transactions = Transaction.search(params[:id]).order(sort_column + " " + sort_direction) respond_to do |format| format.html # index.html.erb format.csv { render :csv => @transactions} end AND Account Controlle...
2007 Jan 14
3
ListCtrl help
...add it to the samples library.... I''d expect that being able to quickly whip up a cross platform data viewer is a popular reason to use wxRuby. -Hawley ------------------- def on_col_left_click(event) @log.write_text("col clicked, id=%d" % event.get_column()) if @sort_column == event.get_column() @the_data.reverse! else @sort_column = event.get_column() @the_data.sort! {|a,b| a[@sort_column]<=>b[@sort_column]} end @the_data.each do |d| @log.write_text( "%s %s" % [d[0], d[4]]) ## just sorting on the d[...
2007 Oct 15
6
SQL injection with :order, :limit, :group
I know how to avoid SQL injection attacks when you use :conditions User.find :first, :conditions => ["login=?", params[:username]] but how about with :order, :limit or :group? # uh-oh...spaghetti-oh User.find :first, :order => "login; delete from users; select * from users" Pat --~--~---------~--~----~------------~-------~--~----~ You received this message because you
2009 Jul 02
7
Params Merge and URL sorting/pagination
...ginate the URL changes to: /rushing_offenses?compiled_on=2009-07-02&orderby=rank&page=2&sortby=asc My table helper functions for sorting and for the show all / show simple are: # adds up / down images for asc and desc sorting to all table columns based on controller name called def sort_column(title, direction) direction == "asc" ? image = "up.gif" : image = "down.gif" (link_to image_tag(image, :border=>0, :alt => direction), :controller => controller.controller_name, :numteams => (@showall ? 120 : nil), :orderby => title, :sortby =&gt...