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])
end
and in ServiceDeskTicket model
def self.record_paginate_sd(search_sd_ui_hash,page)
def self.record_paginate_sd(search_sd_ui_hash,page)
paginate(:page => page, :conditions => ["number LIKE ?",
"%#{sd_ticket_number}%"],
:per_page => 10,
:order => "number")
end
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
Sijo
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
maybe this
<%= will_paginate @companies, :params => { ''search_text''
=> @search_text
} %>
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
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
@search_sd_ticket_result=@search_sd_ticket.paginate :per_page=>10,
:page=>params[:page],:sd_ticket=>params[:sd_ticket]
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
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---