Hi
I hav a search UI.And I use will_paginate to paginate result.My action
is
def search_sd_ticket
#@search_sd_ui_hash=params[:sd_ticket]
@search_sd_ticket_result=ServiceDeskTicket.record_paginate_sd(params[:sd_ticket],params[:page])
My problem is the first page comes but when i click on the next page the
following error happens
You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.[]
The second time params[:sd_ticket] has no value…ow can I solve
this?Please help
Hi
Thanks a lot for ur reply.It worked.So my complete current code as
below.this is working
def search_sd_ticket
@search_sd_ui_hash=params[:sd_ticket]
@sd_ticket_number=@search_sd_ui_hash[:number]
@sd_ticket_status_id=@search_sd_ui_hash[:service_desk_status_id]
@search_sd_ticket = ServiceDeskTicket.find_where(:all ) do |sd|
sd.number.downcase =~ “%”+@sd_ticket_number.downcase+"%" if
!@sd_ticket_number.nil?
sd.service_desk_status_id== @sd_ticket_status_id
end
So the above code is working…Now chow can i move this to model.I tried
like in controller
@search_sd_ticket_result=ServiceDeskTicket.record_paginate_sd(params[:sd_ticket],
params[:page]) And in model self.record_paginate_sd method pasted the
above…But some where mistake and i can’t figure out.No error.But no
result…Could you please tell me how to move the above working code to
model?
Thanks in advance
Sijo
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.