leikind / wice_grid

A Rails grid plugin to create grids with sorting, pagination, and (automatically generated) filters
MIT License
537 stars 213 forks source link

can't get #read method successfully, after I initialize a ActiveRecord with initialize_grid. Always tell me "undefined method `[]' for nil:NilClass", and hove no either reminder #227

Closed winterbang closed 9 years ago

winterbang commented 9 years ago

I guess that there is some bug in the method “form_ar_options” of class Wice::WiceGrid

leikind commented 9 years ago

I need to see the code and stack traces. I do not possess telepathy skills.

leikind commented 9 years ago

Also the version number

winterbang commented 9 years ago
def income_expenses
    @freports = initialize_grid(Freport.active_null,
      :order => 'freports.created_at',
      :include => [:doctor, :order],
      :csv_file_name => 'projects'
    )
    @freports.read
end

1a3c2ec4-4766-4b9a-9491-5fe25d1ad64e

winterbang commented 9 years ago

version 3.4.2

winterbang commented 9 years ago

thanks!

leikind commented 9 years ago

Please remove the call to read. You don't need it. There is no #read in examples. And what you attached is not a stacktrace.

winterbang commented 9 years ago

@leikind How can I get ActiveRecord::Relation of Freport after filter. Is there provided method?

leikind commented 9 years ago

I am not sure I understand.Please elaborate

winterbang commented 9 years ago

I am sorry for my terrible English.

def income_expenses
    @freports = initialize_grid(Freport.active_null,
      :order => 'freports.created_at',
      :include => [:doctor, :order],
      :csv_file_name => 'projects'
    )
    @freports.read
end

This code will filter Freport record. But the @freports is not ActiveRecord Relation instance. I want get the object of record of filter via the object of @freports.

winterbang commented 9 years ago

is there any methodes for this?

leikind commented 9 years ago

This is how you do it: http://wicegrid.herokuapp.com/resultset_processings2

REMOVE @freports.read!

winterbang commented 9 years ago

ok, thanks