Manivannanj Jeganathan
2010-May-27 11:43 UTC
NoMethodError: You have a nil object when you didn''t expect
Hi,
I have tried to use searchlogic in my application...
in def index,
@search = AccounDetail.search(params[:search])
@account_details = @search.all
In index.rhtml
<%form_for @search do |f|%>
<p>
<%=f.label :name_like,"Name"%>
<%=f.text_field :name_like%>
<%=submit_tag :Search,:name=>nil%>
</p>
<%end%>
I didn''t get any search result...
i tried it with ruby script/console.
when i call @search.all, i got "NoMethodError: You have a nil object
when you didn''t expect"
example
>>search=AccountDetail.search(:name_like_any=>"xx")
>>search.all
give me a suggestion to solve this problem
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
Mathew Augustine
2010-May-28 04:39 UTC
Re: NoMethodError: You have a nil object when you didn''t expect
da manu.this prob is related with routes.yor are suppose to put that method in routes.rb On Thu, May 27, 2010 at 5:13 PM, Manivannanj Jeganathan < lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hi, > > I have tried to use searchlogic in my application... > in def index, > @search = AccounDetail.search(params[:search]) > @account_details = @search.all > > In index.rhtml > <%form_for @search do |f|%> > <p> > <%=f.label :name_like,"Name"%> > <%=f.text_field :name_like%> > <%=submit_tag :Search,:name=>nil%> > </p> > <%end%> > > I didn''t get any search result... > i tried it with ruby script/console. > when i call @search.all, i got "NoMethodError: You have a nil object > when you didn''t expect" > > > example > > >>search=AccountDetail.search(:name_like_any=>"xx") > >>search.all > > give me a suggestion to solve this problem > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- -- Thanks & Regards, Mathew Augustine Software Programmer(ROR) Maxxion Technologies Inc Kakkanad - Cochin Mob:+91 -9846476386 Email(y) :mathewa99-/E1597aS9LQxFYw1CcD5bw@public.gmane.org Email(G):itzmemux99-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Blog:http://electronicstrainer.blogspot.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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Manivannan J
2010-May-28 07:15 UTC
NoMethodError: You have a nil object when you didn''t expect
Hi,
I have tried to use searchlogic in my application...
in def index,
@search = AccounDetail.search(params[:search])
@account_details = @search.all
In index.rhtml
<%form_for @search do |f|%>
<p>
<%=f.label :name_like,"Name"%>
<%=f.text_field :name_like%>
<%=submit_tag :Search,:name=>nil%>
</p>
<%end%>
I didn''t get any search result...
i tried it with ruby script/console.
when i call @search.all, i got "NoMethodError: You have a nil object
when you didn''t expect"
example
>>search=AccountDetail.search(:name_like_any=>"xx")
>>search.all
give me a suggestion to solve this problem
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
Manivannan J
2010-May-29 06:25 UTC
Re: NoMethodError: You have a nil object when you didn''t expect
On May 28, 9:39 am, Mathew Augustine <augustine.mathe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> da manu.this prob is related with routes.yor are suppose to put that > method in routes.rb > > On Thu, May 27, 2010 at 5:13 PM, Manivannanj Jeganathan < > > > > li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > > Hi, > > > I have tried to use searchlogic in my application... > > in def index, > > @search = AccounDetail.search(params[:search]) > > @account_details = @search.all > > > In index.rhtml > > <%form_for @search do |f|%> > > <p> > > <%=f.label :name_like,"Name"%> > > <%=f.text_field :name_like%> > > <%=submit_tag :Search,:name=>nil%> > > </p> > > <%end%> > > > I didn''t get any search result... > > i tried it with ruby script/console. > > when i call @search.all, i got "NoMethodError: You have a nil object > > when you didn''t expect" > > > example > > > >>search=AccountDetail.search(:name_like_any=>"xx") > > >>search.all > > > give me a suggestion to solve this problem > > -- > > Posted viahttp://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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > >I left the rails application then I tried in ruby script/console search=BankingDetail.search(:name_like_all=>"man") search.all i got error when i call ''all'' method NoMethodError: You have a nil object when you didn''t expect it! You might have expected an instance of ActiveRecord::Base. The error occurred while evaluating nil.[] -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Manivannan J
2010-May-29 06:33 UTC
Re: NoMethodError: You have a nil object when you didn''t expect
On May 28, 9:39 am, Mathew Augustine <augustine.mathe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> da manu.this prob is related with routes.yor are suppose to put that > method in routes.rb > > On Thu, May 27, 2010 at 5:13 PM, Manivannanj Jeganathan < > > > > li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > > Hi, > > > I have tried to use searchlogic in my application... > > in def index, > > @search = AccounDetail.search(params[:search]) > > @account_details = @search.all > > > In index.rhtml > > <%form_for @search do |f|%> > > <p> > > <%=f.label :name_like,"Name"%> > > <%=f.text_field :name_like%> > > <%=submit_tag :Search,:name=>nil%> > > </p> > > <%end%> > > > I didn''t get any search result... > > i tried it with ruby script/console. > > when i call @search.all, i got "NoMethodError: You have a nil object > > when you didn''t expect" > > > example > > > >>search=AccountDetail.search(:name_like_any=>"xx") > > >>search.all > > > give me a suggestion to solve this problem > > -- > > Posted viahttp://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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > >I left the rails application then I tried in ruby script/console search=BankingDetail.search(:name_like_all=>"man") search.all i got error when i call ''all'' method NoMethodError: You have a nil object when you didn''t expect it! You might have expected an instance of ActiveRecord::Base. The error occurred while evaluating nil.[] -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.