I''m not sure why i am having this problem but when i execute a call to
the calls controller from a link
<li><%= link_to_unless_current ''My Call Book'', {
:controller =>
"calls", :action => "index" } %></li>
<li><em> :: </em></li>
I get the following error
NoMethodError in CallsController#index
undefined method `_of'' for #<Class:0x2517c1c>
RAILS_ROOT: /Users/owenhmad/Sites/ministrytrackr/ministrytrackr
Application Trace | Framework Trace | Full Trace
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/
base.rb:1532:in `method_missing_without_paginate''
/Library/Ruby/Gems/1.8/gems/mislav-will_paginate-2.3.2/lib/
will_paginate/finder.rb:164:in `method_missing''
app/models/call.rb:23
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/
dependencies.rb:203:in `load_without_new_constant_marking''
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/
dependencies.rb:203:in `load_file''
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/
dependencies.rb:342:in `new_constants_in''
part of my CallsController is
class CallsController < ApplicationController
before_filter :login_required, :only => [ :index, :new, :edit]
def index
@calls = Call.find(:all)
@recent_calls = @current_user.calls.find(:all)
@recent_calls = @current_user.calls.search(params[:search],
params[:page])
end
def list
@calls = @current_user.calls.find(:all)
end
def show
@call = Call.find(params[:id])
end
And my call model is
class Call < ActiveRecord::Base
belongs_to :user
has_many:visits, :dependent => :destroy
has_many:visits do
def latest
find :all, :order => ''id DESC'', :limit => 3
end
def all_latest
find :all, :order => ''id DESC''
end
end
def self.search(search, page)
paginate :per_page => 4, :page => page,
:conditions => [''name like ?'',
"%#{search}%"],
:order => ''name''
end
end
It says in the error message `method_missing_without_paginate''
I have will_paginate installed in rails as a gem and it shows up in my
gem list. Any help to a beginner working on first real app after may
books would be appreciated
Thanks Owen
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
The problem is in your controller action
def index
@calls = Call.find(:all)
@recent_calls = @current_user.calls.find(:all)
@recent_calls = @current_user.calls.search(params[:search],
params[:page])
end
first, you are declaring @recent_calls twice, the first one
(@recent_calls = @current_user.calls.find(:all)) will never work when
the second is there.
next, when you declare a method self.search in the class Call, you
call it in the class!! so Call.search(params[:search], params[:page])
willl return an array of calls. (Note: it will return them for ALL
users, not just the current.
Third, you are calling a method on class Array (which is what
@current_user.calls returns) when you defined that method in the class
Call.
If you want to get a list of call objects from a user (i assume user
has_many :calls, and call belongs_to :user) with a name like something
and paginated. id do it like such:
def index
@recent_calls = @current_user.calls.paginate :per_page => 4, :page
=> params[:page],
:conditions => [''name like ? AND user_id = ?'',
"%#{params[:search]}
%", @current_user.id],
:order => ''name''
end
if you use the method more than twice, then put it in the class, but
you would also need to pass the user id.
good luck
On Aug 20, 11:30 pm, THEBIGO
<Mowenh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I''m not sure why i am having this problem but when i execute a
call to
> the calls controller from a link
>
> <li><%= link_to_unless_current ''My Call Book'',
{ :controller =>
> "calls", :action => "index" } %></li>
>
<li><em> :: </em></li>
>
> I get the following error
>
> NoMethodError in CallsController#index
>
> undefined method `_of'' for #<Class:0x2517c1c>
>
> RAILS_ROOT: /Users/owenhmad/Sites/ministrytrackr/ministrytrackr
> Application Trace | Framework Trace | Full Trace
>
> /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/
> base.rb:1532:in `method_missing_without_paginate''
> /Library/Ruby/Gems/1.8/gems/mislav-will_paginate-2.3.2/lib/
> will_paginate/finder.rb:164:in `method_missing''
> app/models/call.rb:23
> /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/
> dependencies.rb:203:in `load_without_new_constant_marking''
> /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/
> dependencies.rb:203:in `load_file''
> /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/
> dependencies.rb:342:in `new_constants_in''
>
> part of my CallsController is
>
> class CallsController < ApplicationController
> before_filter :login_required, :only => [ :index, :new, :edit]
>
> def index
> @calls = Call.find(:all)
> @recent_calls = @current_user.calls.find(:all)
> @recent_calls = @current_user.calls.search(params[:search],
> params[:page])
> end
>
> def list
> @calls = @current_user.calls.find(:all)
> end
>
> def show
> @call = Call.find(params[:id])
> end
>
> And my call model is
>
> class Call < ActiveRecord::Base
> belongs_to :user
> has_many:visits, :dependent => :destroy
> has_many:visits do
> def latest
> find :all, :order => ''id DESC'', :limit => 3
> end
>
> def all_latest
> find :all, :order => ''id DESC''
> end
> end
>
> def self.search(search, page)
> paginate :per_page => 4, :page => page,
> :conditions => [''name like ?'',
"%#{search}%"],
> :order => ''name''
> end
>
> end
>
> It says in the error message `method_missing_without_paginate''
>
> I have will_paginate installed in rails as a gem and it shows up in my
> gem list. Any help to a beginner working on first real app after may
> books would be appreciated
>
> Thanks Owen
--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Thank you so much Wolas for your reply and your suggestion got rid of
my undefined mehod error And I coppied and pasted your suggestion but
I now get the following error - I am not sure where to correct it
SyntaxError in CallsController#index
/Users/owenhmad/Sites/ministrytrackr/ministrytrackr/app/controllers/
calls_controller.rb:6: syntax error, unexpected ''\n'',
expecting tASSOC
/Users/owenhmad/Sites/ministrytrackr/ministrytrackr/app/controllers/
calls_controller.rb:8: syntax error, unexpected tASSOC, expecting
tCOLON2 or ''['' or ''.''
:conditions => [''name like ? AND user_id = ?'',
"%#{params[:search]}
^
/Users/owenhmad/Sites/ministrytrackr/ministrytrackr/app/controllers/
calls_controller.rb:9: syntax error, unexpected '','', expecting
kEND
RAILS_ROOT: /Users/owenhmad/Sites/ministrytrackr/ministrytrackr
Any suggestions would be appreciated - Owen
On Aug 21, 4:05 am, "\"Wolas!\""
<jcpen...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> The problem is in your controller action
>
> def index
> @calls = Call.find(:all)
> @recent_calls = @current_user.calls.find(:all)
> @recent_calls = @current_user.calls.search(params[:search],
> params[:page])
> end
>
> first, you are declaring @recent_calls twice, the first one
> (@recent_calls = @current_user.calls.find(:all)) will never work when
> the second is there.
>
> next, when you declare a method self.search in the class Call, you
> call it in the class!! so Call.search(params[:search], params[:page])
> willl return an array of calls. (Note: it will return them for ALL
> users, not just the current.
>
> Third, you are calling a method on class Array (which is what
> @current_user.calls returns) when you defined that method in the class
> Call.
>
> If you want to get a list of call objects from a user (i assume user
> has_many :calls, and call belongs_to :user) with a name like something
> and paginated. id do it like such:
>
> def index
> @recent_calls = @current_user.calls.paginate :per_page => 4, :page
> => params[:page],
> :conditions => [''name like ? AND user_id = ?'',
"%#{params[:search]}
> %", @current_user.id],
> :order => ''name''
> end
>
> if you use the method more than twice, then put it in the class, but
> you would also need to pass the user id.
>
> good luck
>
> On Aug 20, 11:30 pm, THEBIGO
<Mowenh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > I''m not sure why i am having this problem but when i execute
a call to
> > the calls controller from a link
>
> > <li><%= link_to_unless_current ''My Call
Book'', { :controller =>
> > "calls", :action => "index" } %></li>
> >
<li><em> :: </em></li>
>
> > I get the following error
>
> > NoMethodError in CallsController#index
>
> > undefined method `_of'' for #<Class:0x2517c1c>
>
> > RAILS_ROOT: /Users/owenhmad/Sites/ministrytrackr/ministrytrackr
> > Application Trace | Framework Trace | Full Trace
>
> > /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/
> > base.rb:1532:in `method_missing_without_paginate''
> > /Library/Ruby/Gems/1.8/gems/mislav-will_paginate-2.3.2/lib/
> > will_paginate/finder.rb:164:in `method_missing''
> > app/models/call.rb:23
> > /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/
> > dependencies.rb:203:in `load_without_new_constant_marking''
> > /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/
> > dependencies.rb:203:in `load_file''
> > /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/
> > dependencies.rb:342:in `new_constants_in''
>
> > part of my CallsController is
>
> > class CallsController < ApplicationController
> > before_filter :login_required, :only => [ :index, :new, :edit]
>
> > def index
> > @calls = Call.find(:all)
> > @recent_calls = @current_user.calls.find(:all)
> > @recent_calls = @current_user.calls.search(params[:search],
> > params[:page])
> > end
>
> > def list
> > @calls = @current_user.calls.find(:all)
> > end
>
> > def show
> > @call = Call.find(params[:id])
> > end
>
> > And my call model is
>
> > class Call < ActiveRecord::Base
> > belongs_to :user
> > has_many:visits, :dependent => :destroy
> > has_many:visits do
> > def latest
> > find :all, :order => ''id DESC'', :limit
=> 3
> > end
>
> > def all_latest
> > find :all, :order => ''id DESC''
> > end
> > end
>
> > def self.search(search, page)
> > paginate :per_page => 4, :page => page,
> > :conditions => [''name like ?'',
"%#{search}%"],
> > :order => ''name''
> > end
>
> > end
>
> > It says in the error message
`method_missing_without_paginate''
>
> > I have will_paginate installed in rails as a gem and it shows up in my
> > gem list. Any help to a beginner working on first real app after may
> > books would be appreciated
>
> > Thanks Owen
--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
On 21 Aug 2008, at 17:10, THEBIGO wrote:> > Thank you so much Wolas for your reply and your suggestion got rid of > my undefined mehod error And I coppied and pasted your suggestion but > I now get the following error - I am not sure where to correct it >looks the email line wrapped it in a bad way:> @recent_calls = @current_user.calls.paginate :per_page => 4, :page > => params[:page],should be all on one line. (if you do put in line breaks put them after a ,) Fred> SyntaxError in CallsController#index > > /Users/owenhmad/Sites/ministrytrackr/ministrytrackr/app/controllers/ > calls_controller.rb:6: syntax error, unexpected ''\n'', expecting tASSOC > /Users/owenhmad/Sites/ministrytrackr/ministrytrackr/app/controllers/ > calls_controller.rb:8: syntax error, unexpected tASSOC, expecting > tCOLON2 or ''['' or ''.'' > :conditions => [''name like ? AND user_id = ?'', > "%#{params[:search]} > ^ > /Users/owenhmad/Sites/ministrytrackr/ministrytrackr/app/controllers/ > calls_controller.rb:9: syntax error, unexpected '','', expecting kEND > > RAILS_ROOT: /Users/owenhmad/Sites/ministrytrackr/ministrytrackr > > > Any suggestions would be appreciated - Owen > > On Aug 21, 4:05 am, "\"Wolas!\"" <jcpen...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> The problem is in your controller action >> >> def index >> @calls = Call.find(:all) >> @recent_calls = @current_user.calls.find(:all) >> @recent_calls = @current_user.calls.search(params[:search], >> params[:page]) >> end >> >> first, you are declaring @recent_calls twice, the first one >> (@recent_calls = @current_user.calls.find(:all)) will never work when >> the second is there. >> >> next, when you declare a method self.search in the class Call, you >> call it in the class!! so Call.search(params[:search], params[:page]) >> willl return an array of calls. (Note: it will return them for ALL >> users, not just the current. >> >> Third, you are calling a method on class Array (which is what >> @current_user.calls returns) when you defined that method in the >> class >> Call. >> >> If you want to get a list of call objects from a user (i assume user >> has_many :calls, and call belongs_to :user) with a name like >> something >> and paginated. id do it like such: >> >> def index >> @recent_calls = @current_user.calls.paginate :per_page => 4, :page >> => params[:page], >> :conditions => [''name like ? AND user_id = ?'', >> "%#{params[:search]} >> %", @current_user.id], >> :order => ''name'' >> end >> >> if you use the method more than twice, then put it in the class, but >> you would also need to pass the user id. >> >> good luck >> >> On Aug 20, 11:30 pm, THEBIGO <Mowenh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >>> I''m not sure why i am having this problem but when i execute a >>> call to >>> the calls controller from a link >> >>> <li><%= link_to_unless_current ''My Call Book'', { :controller => >>> "calls", :action => "index" } %></li> >>> >>> <li><em> :: </em></li> >> >>> I get the following error >> >>> NoMethodError in CallsController#index >> >>> undefined method `_of'' for #<Class:0x2517c1c> >> >>> RAILS_ROOT: /Users/owenhmad/Sites/ministrytrackr/ministrytrackr >>> Application Trace | Framework Trace | Full Trace >> >>> /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/ >>> base.rb:1532:in `method_missing_without_paginate'' >>> /Library/Ruby/Gems/1.8/gems/mislav-will_paginate-2.3.2/lib/ >>> will_paginate/finder.rb:164:in `method_missing'' >>> app/models/call.rb:23 >>> /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/ >>> dependencies.rb:203:in `load_without_new_constant_marking'' >>> /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/ >>> dependencies.rb:203:in `load_file'' >>> /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/ >>> dependencies.rb:342:in `new_constants_in'' >> >>> part of my CallsController is >> >>> class CallsController < ApplicationController >>> before_filter :login_required, :only => [ :index, :new, :edit] >> >>> def index >>> @calls = Call.find(:all) >>> @recent_calls = @current_user.calls.find(:all) >>> @recent_calls = @current_user.calls.search(params[:search], >>> params[:page]) >>> end >> >>> def list >>> @calls = @current_user.calls.find(:all) >>> end >> >>> def show >>> @call = Call.find(params[:id]) >>> end >> >>> And my call model is >> >>> class Call < ActiveRecord::Base >>> belongs_to :user >>> has_many:visits, :dependent => :destroy >>> has_many:visits do >>> def latest >>> find :all, :order => ''id DESC'', :limit => 3 >>> end >> >>> def all_latest >>> find :all, :order => ''id DESC'' >>> end >>> end >> >>> def self.search(search, page) >>> paginate :per_page => 4, :page => page, >>> :conditions => [''name like ?'', "%#{search}%"], >>> :order => ''name'' >>> end >> >>> end >> >>> It says in the error message `method_missing_without_paginate'' >> >>> I have will_paginate installed in rails as a gem and it shows up >>> in my >>> gem list. Any help to a beginner working on first real app after >>> may >>> books would be appreciated >> >>> Thanks Owen > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
As per usual, fred is correct On Aug 21, 5:39 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 21 Aug 2008, at 17:10, THEBIGO wrote: > > > > > Thank you so much Wolas for your reply and your suggestion got rid of > > my undefined mehod error And I coppied and pasted your suggestion but > > I now get the following error - I am not sure where to correct it > > looks the email line wrapped it in a bad way: > > > @recent_calls = @current_user.calls.paginate :per_page => 4, :page > > => params[:page], > > should be all on one line. (if you do put in line breaks put them > after a ,) > > Fred > > > > > SyntaxError in CallsController#index > > > /Users/owenhmad/Sites/ministrytrackr/ministrytrackr/app/controllers/ > > calls_controller.rb:6: syntax error, unexpected ''\n'', expecting tASSOC > > /Users/owenhmad/Sites/ministrytrackr/ministrytrackr/app/controllers/ > > calls_controller.rb:8: syntax error, unexpected tASSOC, expecting > > tCOLON2 or ''['' or ''.'' > > :conditions => [''name like ? AND user_id = ?'', > > "%#{params[:search]} > > ^ > > /Users/owenhmad/Sites/ministrytrackr/ministrytrackr/app/controllers/ > > calls_controller.rb:9: syntax error, unexpected '','', expecting kEND > > > RAILS_ROOT: /Users/owenhmad/Sites/ministrytrackr/ministrytrackr > > > Any suggestions would be appreciated - Owen > > > On Aug 21, 4:05 am, "\"Wolas!\"" <jcpen...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> The problem is in your controller action > > >> def index > >> @calls = Call.find(:all) > >> @recent_calls = @current_user.calls.find(:all) > >> @recent_calls = @current_user.calls.search(params[:search], > >> params[:page]) > >> end > > >> first, you are declaring @recent_calls twice, the first one > >> (@recent_calls = @current_user.calls.find(:all)) will never work when > >> the second is there. > > >> next, when you declare a method self.search in the class Call, you > >> call it in the class!! so Call.search(params[:search], params[:page]) > >> willl return an array of calls. (Note: it will return them for ALL > >> users, not just the current. > > >> Third, you are calling a method on class Array (which is what > >> @current_user.calls returns) when you defined that method in the > >> class > >> Call. > > >> If you want to get a list of call objects from a user (i assume user > >> has_many :calls, and call belongs_to :user) with a name like > >> something > >> and paginated. id do it like such: > > >> def index > >> @recent_calls = @current_user.calls.paginate :per_page => 4, :page > >> => params[:page], > >> :conditions => [''name like ? AND user_id = ?'', > >> "%#{params[:search]} > >> %", @current_user.id], > >> :order => ''name'' > >> end > > >> if you use the method more than twice, then put it in the class, but > >> you would also need to pass the user id. > > >> good luck > > >> On Aug 20, 11:30 pm, THEBIGO <Mowenh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > >>> I''m not sure why i am having this problem but when i execute a > >>> call to > >>> the calls controller from a link > > >>> <li><%= link_to_unless_current ''My Call Book'', { :controller => > >>> "calls", :action => "index" } %></li> > > >>> <li><em> :: </em></li> > > >>> I get the following error > > >>> NoMethodError in CallsController#index > > >>> undefined method `_of'' for #<Class:0x2517c1c> > > >>> RAILS_ROOT: /Users/owenhmad/Sites/ministrytrackr/ministrytrackr > >>> Application Trace | Framework Trace | Full Trace > > >>> /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/ > >>> base.rb:1532:in `method_missing_without_paginate'' > >>> /Library/Ruby/Gems/1.8/gems/mislav-will_paginate-2.3.2/lib/ > >>> will_paginate/finder.rb:164:in `method_missing'' > >>> app/models/call.rb:23 > >>> /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/ > >>> dependencies.rb:203:in `load_without_new_constant_marking'' > >>> /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/ > >>> dependencies.rb:203:in `load_file'' > >>> /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/ > >>> dependencies.rb:342:in `new_constants_in'' > > >>> part of my CallsController is > > >>> class CallsController < ApplicationController > >>> before_filter :login_required, :only => [ :index, :new, :edit] > > >>> def index > >>> @calls = Call.find(:all) > >>> @recent_calls = @current_user.calls.find(:all) > >>> @recent_calls = @current_user.calls.search(params[:search], > >>> params[:page]) > >>> end > > >>> def list > >>> @calls = @current_user.calls.find(:all) > >>> end > > >>> def show > >>> @call = Call.find(params[:id]) > >>> end > > >>> And my call model is > > >>> class Call < ActiveRecord::Base > >>> belongs_to :user > >>> has_many:visits, :dependent => :destroy > >>> has_many:visits do > >>> def latest > >>> find :all, :order => ''id DESC'', :limit => 3 > >>> end > > >>> def all_latest > >>> find :all, :order => ''id DESC'' > >>> end > >>> end > > >>> def self.search(search, page) > >>> paginate :per_page => 4, :page => page, > >>> :conditions => [''name like ?'', "%#{search}%"], > >>> :order => ''name'' > >>> end > > >>> end > > >>> It says in the error message `method_missing_without_paginate'' > > >>> I have will_paginate installed in rails as a gem and it shows up > >>> in my > >>> gem list. Any help to a beginner working on first real app after > >>> may > >>> books would be appreciated > > >>> Thanks Owen- Hide quoted text - > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thank you again Fred and Wolas but now I am back to my undefined
method and the following error
NoMethodError in CallsController#index
undefined method `_of'' for #<Class:0x2355ca8>
RAILS_ROOT: /Users/owenhmad/Sites/ministrytrackr/ministrytrackr
Application Trace | Framework Trace | Full Trace
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/
base.rb:1532:in `method_missing_without_paginate''
/Library/Ruby/Gems/1.8/gems/mislav-will_paginate-2.3.2/lib/
will_paginate/finder.rb:164:in `method_missing''
app/models/call.rb:23
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/
dependencies.rb:203:in `load_without_new_constant_marking''
My index action is now
def index
@recent_calls = @current_user.calls.paginate :per_page =>
4, :page => params[:page],
:conditions => [''name like ? AND user_id = ?'',
"%#{params[:search]}
%", @current_user.id],
:order => ''name''
end
Notice the method-missing-without_paginate. Originally I have the
pagination in my model as post one shows per Ryan Bates and it worked
in another version of
this app so that is why it wasn''t in my original index action. I had
moved it to the model.
I don''t understand why the method_missing_without_paginate is there as
my gem list shows I have the latest will_paginate and I am using rails
2.0.2
Any other suggestions?? Thanks in advance
Owen
On Aug 21, 9:46 am, "\"Wolas!\""
<jcpen...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: @calls
Call.find(:all)> As per usual, fred is correct
>
> On Aug 21, 5:39 pm, Frederick Cheung
<frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> wrote:
>
> > On 21 Aug 2008, at 17:10, THEBIGO wrote:
>
> > > Thank you so much Wolas for your reply and your suggestion got
rid of
> > > my undefined mehod error And I coppied and pasted your suggestion
but
> > > I now get the following error - I am not sure where to correct it
>
> > looks the email line wrapped it in a bad way:
>
> > > @recent_calls = @current_user.calls.paginate :per_page =>
4, :page
> > > => params[:page],
>
> > should be all on one line. (if you do put in line breaks put them
> > after a ,)
>
> > Fred
>
> > > SyntaxError in CallsController#index
>
> > >
/Users/owenhmad/Sites/ministrytrackr/ministrytrackr/app/controllers/
> > > calls_controller.rb:6: syntax error, unexpected
''\n'', expecting tASSOC
> > >
/Users/owenhmad/Sites/ministrytrackr/ministrytrackr/app/controllers/
> > > calls_controller.rb:8: syntax error, unexpected tASSOC, expecting
> > > tCOLON2 or ''['' or ''.''
> > > :conditions => [''name like ? AND user_id =
?'',
> > > "%#{params[:search]}
> > > ^
> > >
/Users/owenhmad/Sites/ministrytrackr/ministrytrackr/app/controllers/
> > > calls_controller.rb:9: syntax error, unexpected
'','', expecting kEND
>
> > > RAILS_ROOT: /Users/owenhmad/Sites/ministrytrackr/ministrytrackr
>
> > > Any suggestions would be appreciated - Owen
>
> > > On Aug 21, 4:05 am, "\"Wolas!\""
<jcpen...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > >> The problem is in your controller action
>
> > >> def index
> > >> @calls = Call.find(:all)
> > >> @recent_calls = @current_user.calls.find(:all)
> > >> @recent_calls =
@current_user.calls.search(params[:search],
> > >> params[:page])
> > >> end
>
> > >> first, you are declaring @recent_calls twice, the first one
> > >> (@recent_calls = @current_user.calls.find(:all)) will never
work when
> > >> the second is there.
>
> > >> next, when you declare a method self.search in the class
Call, you
> > >> call it in the class!! so Call.search(params[:search],
params[:page])
> > >> willl return an array of calls. (Note: it will return them
for ALL
> > >> users, not just the current.
>
> > >> Third, you are calling a method on class Array (which is what
> > >> @current_user.calls returns) when you defined that method in
the
> > >> class
> > >> Call.
>
> > >> If you want to get a list of call objects from a user (i
assume user
> > >> has_many :calls, and call belongs_to :user) with a name like
> > >> something
> > >> and paginated. id do it like such:
>
> > >> def index
> > >> @recent_calls = @current_user.calls.paginate :per_page
=> 4, :page
> > >> => params[:page],
> > >> :conditions => [''name like ? AND user_id =
?'',
> > >> "%#{params[:search]}
> > >> %", @current_user.id],
> > >> :order => ''name''
> > >> end
>
> > >> if you use the method more than twice, then put it in the
class, but
> > >> you would also need to pass the user id.
>
> > >> good luck
>
> > >> On Aug 20, 11:30 pm, THEBIGO
<Mowenh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > >>> I''m not sure why i am having this problem but
when i execute a
> > >>> call to
> > >>> the calls controller from a link
>
> > >>> <li><%= link_to_unless_current ''My
Call Book'', { :controller =>
> > >>> "calls", :action => "index" }
%></li>
>
> > >>> <li><em> :: </em></li>
>
> > >>> I get the following error
>
> > >>> NoMethodError in CallsController#index
>
> > >>> undefined method `_of'' for
#<Class:0x2517c1c>
>
> > >>> RAILS_ROOT:
/Users/owenhmad/Sites/ministrytrackr/ministrytrackr
> > >>> Application Trace | Framework Trace | Full Trace
>
> > >>>
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/
> > >>> base.rb:1532:in
`method_missing_without_paginate''
> > >>>
/Library/Ruby/Gems/1.8/gems/mislav-will_paginate-2.3.2/lib/
> > >>> will_paginate/finder.rb:164:in `method_missing''
> > >>> app/models/call.rb:23
> > >>>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/
> > >>> dependencies.rb:203:in
`load_without_new_constant_marking''
> > >>>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/
> > >>> dependencies.rb:203:in `load_file''
> > >>>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/
> > >>> dependencies.rb:342:in `new_constants_in''
>
> > >>> part of my CallsController is
>
> > >>> class CallsController < ApplicationController
> > >>> before_filter :login_required, :only => [ :index,
:new, :edit]
>
> > >>> def index
> > >>> @calls = Call.find(:all)
> > >>> @recent_calls = @current_user.calls.find(:all)
> > >>> @recent_calls =
@current_user.calls.search(params[:search],
> > >>> params[:page])
> > >>> end
>
> > >>> def list
> > >>> @calls = @current_user.calls.find(:all)
> > >>> end
>
> > >>> def show
> > >>> @call = Call.find(params[:id])
> > >>> end
>
> > >>> And my call model is
>
> > >>> class Call < ActiveRecord::Base
> > >>> belongs_to :user
> > >>> has_many:visits, :dependent => :destroy
> > >>> has_many:visits do
> > >>> def latest
> > >>> find :all, :order => ''id
DESC'', :limit => 3
> > >>> end
>
> > >>> def all_latest
> > >>> find :all, :order => ''id DESC''
> > >>> end
> > >>> end
>
> > >>> def self.search(search, page)
> > >>> paginate :per_page => 4, :page => page,
> > >>> :conditions => [''name like ?'',
"%#{search}%"],
> > >>> :order => ''name''
> > >>> end
>
> > >>> end
>
> > >>> It says in the error message
`method_missing_without_paginate''
>
> > >>> I have will_paginate installed in rails as a gem and it
shows up
> > >>> in my
> > >>> gem list. Any help to a beginner working on first real
app after
> > >>> may
> > >>> books would be appreciated
>
> > >>> Thanks Owen- Hide quoted text -
>
> > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Still havn''t figured out where the NoMethodError is from. Says wiil_paginate is missing and then the log file shows something about rb:23 in my call model. Does that mean line 23 in the model? Any help please for a person in first year rails programing? Thanks in advance - Owen On Aug 21, 10:01 am, THEBIGO <Mowenh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thank you again Fred and Wolas but now I am back to my undefined > method and the following error > > NoMethodError in CallsController#index > > undefined method `_of'' for #<Class:0x2355ca8> > > RAILS_ROOT: /Users/owenhmad/Sites/ministrytrackr/ministrytrackr > Application Trace | Framework Trace | Full Trace > > /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/ > base.rb:1532:in `method_missing_without_paginate'' > /Library/Ruby/Gems/1.8/gems/mislav-will_paginate-2.3.2/lib/ > will_paginate/finder.rb:164:in `method_missing'' > app/models/call.rb:23 > /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/ > dependencies.rb:203:in `load_without_new_constant_marking'' > > My index action is now > def index > @recent_calls = @current_user.calls.paginate :per_page => > 4, :page => params[:page], > :conditions => [''name like ? AND user_id = ?'', > "%#{params[:search]} > %", @current_user.id], > :order => ''name'' > > end > > Notice the method-missing-without_paginate. Originally I have the > pagination in my model as post one shows per Ryan Bates and it worked > in another version of > this app so that is why it wasn''t in my original index action. I had > moved it to the model. > > I don''t understand why the method_missing_without_paginate is there as > my gem list shows I have the latest will_paginate and I am using rails > 2.0.2 > > Any other suggestions?? Thanks in advance > Owen > > On Aug 21, 9:46 am, "\"Wolas!\"" <jcpen...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: @calls > Call.find(:all) > > > As per usual, fred is correct > > > On Aug 21, 5:39 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > wrote: > > > > On 21 Aug 2008, at 17:10, THEBIGO wrote: > > > > > Thank you so much Wolas for your reply and your suggestion got rid of > > > > my undefined mehod error And I coppied and pasted your suggestion but > > > > I now get the following error - I am not sure where to correct it > > > > looks the email line wrapped it in a bad way: > > > > > @recent_calls = @current_user.calls.paginate :per_page => 4, :page > > > > => params[:page], > > > > should be all on one line. (if you do put in line breaks put them > > > after a ,) > > > > Fred > > > > > SyntaxError in CallsController#index > > > > > /Users/owenhmad/Sites/ministrytrackr/ministrytrackr/app/controllers/ > > > > calls_controller.rb:6: syntax error, unexpected ''\n'', expecting tASSOC > > > > /Users/owenhmad/Sites/ministrytrackr/ministrytrackr/app/controllers/ > > > > calls_controller.rb:8: syntax error, unexpected tASSOC, expecting > > > > tCOLON2 or ''['' or ''.'' > > > > :conditions => [''name like ? AND user_id = ?'', > > > > "%#{params[:search]} > > > > ^ > > > > /Users/owenhmad/Sites/ministrytrackr/ministrytrackr/app/controllers/ > > > > calls_controller.rb:9: syntax error, unexpected '','', expecting kEND > > > > > RAILS_ROOT: /Users/owenhmad/Sites/ministrytrackr/ministrytrackr > > > > > Any suggestions would be appreciated - Owen > > > > > On Aug 21, 4:05 am, "\"Wolas!\"" <jcpen...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > >> The problem is in your controller action > > > > >> def index > > > >> @calls = Call.find(:all) > > > >> @recent_calls = @current_user.calls.find(:all) > > > >> @recent_calls = @current_user.calls.search(params[:search], > > > >> params[:page]) > > > >> end > > > > >> first, you are declaring @recent_calls twice, the first one > > > >> (@recent_calls = @current_user.calls.find(:all)) will never work when > > > >> the second is there. > > > > >> next, when you declare a method self.search in the class Call, you > > > >> call it in the class!! so Call.search(params[:search], params[:page]) > > > >> willl return an array of calls. (Note: it will return them for ALL > > > >> users, not just the current. > > > > >> Third, you are calling a method on class Array (which is what > > > >> @current_user.calls returns) when you defined that method in the > > > >> class > > > >> Call. > > > > >> If you want to get a list of call objects from a user (i assume user > > > >> has_many :calls, and call belongs_to :user) with a name like > > > >> something > > > >> and paginated. id do it like such: > > > > >> def index > > > >> @recent_calls = @current_user.calls.paginate :per_page => 4, :page > > > >> => params[:page], > > > >> :conditions => [''name like ? AND user_id = ?'', > > > >> "%#{params[:search]} > > > >> %", @current_user.id], > > > >> :order => ''name'' > > > >> end > > > > >> if you use the method more than twice, then put it in the class, but > > > >> you would also need to pass the user id. > > > > >> good luck > > > > >> On Aug 20, 11:30 pm, THEBIGO <Mowenh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > >>> I''m not sure why i am having this problem but when i execute a > > > >>> call to > > > >>> the calls controller from a link > > > > >>> <li><%= link_to_unless_current ''My Call Book'', { :controller => > > > >>> "calls", :action => "index" } %></li> > > > > >>> <li><em> :: </em></li> > > > > >>> I get the following error > > > > >>> NoMethodError in CallsController#index > > > > >>> undefined method `_of'' for #<Class:0x2517c1c> > > > > >>> RAILS_ROOT: /Users/owenhmad/Sites/ministrytrackr/ministrytrackr > > > >>> Application Trace | Framework Trace | Full Trace > > > > >>> /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/ > > > >>> base.rb:1532:in `method_missing_without_paginate'' > > > >>> /Library/Ruby/Gems/1.8/gems/mislav-will_paginate-2.3.2/lib/ > > > >>> will_paginate/finder.rb:164:in `method_missing'' > > > >>> app/models/call.rb:23 > > > >>> /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/ > > > >>> dependencies.rb:203:in `load_without_new_constant_marking'' > > > >>> /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/ > > > >>> dependencies.rb:203:in `load_file'' > > > >>> /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/ > > > >>> dependencies.rb:342:in `new_constants_in'' > > > > >>> part of my CallsController is > > > > >>> class CallsController < ApplicationController > > > >>> before_filter :login_required, :only => [ :index, :new, :edit] > > > > >>> def index > > > >>> @calls = Call.find(:all) > > > >>> @recent_calls = @current_user.calls.find(:all) > > > >>> @recent_calls = @current_user.calls.search(params[:search], > > > >>> params[:page]) > > > >>> end > > > > >>> def list > > > >>> @calls = @current_user.calls.find(:all) > > > >>> end > > > > >>> def show > > > >>> @call = Call.find(params[:id]) > > > >>> end > > > > >>> And my call model is > > > > >>> class Call < ActiveRecord::Base > > > >>> belongs_to :user > > > >>> has_many:visits, :dependent => :destroy > > > >>> has_many:visits do > > > >>> def latest > > > >>> find :all, :order => ''id DESC'', :limit => 3 > > > >>> end > > > > >>> def all_latest > > > >>> find :all, :order => ''id DESC'' > > > >>> end > > > >>> end > > > > >>> def self.search(search, page) > > > >>> paginate :per_page => 4, :page => page, > > > >>> :conditions => [''name like ?'', "%#{search}%"], > > > >>> :order => ''name'' > > > >>> end > > > > >>> end > > > > >>> It says in the error message `method_missing_without_paginate'' > > > > >>> I have will_paginate installed in rails as a gem and it shows up > > > >>> in my > > > >>> gem list. Any help to a beginner working on first real app after > > > >>> may > > > >>> books would be appreciated > > > > >>> Thanks Owen- Hide quoted text - > > > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
look in line 23 of the model Call yes On Aug 22, 3:23 pm, THEBIGO <Mowenh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Still havn''t figured out where the NoMethodError is from. Says > wiil_paginate is missing > and then the log file shows something about rb:23 in my call model. > Does that mean line 23 > in the model? Any help please for a person in first year rails > programing? > > Thanks in advance - Owen > > On Aug 21, 10:01 am, THEBIGO <Mowenh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Thank you again Fred and Wolas but now I am back to my undefined > > method and the following error > > > NoMethodError in CallsController#index > > > undefined method `_of'' for #<Class:0x2355ca8> > > > RAILS_ROOT: /Users/owenhmad/Sites/ministrytrackr/ministrytrackr > > Application Trace | Framework Trace | Full Trace > > > /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/ > > base.rb:1532:in `method_missing_without_paginate'' > > /Library/Ruby/Gems/1.8/gems/mislav-will_paginate-2.3.2/lib/ > > will_paginate/finder.rb:164:in `method_missing'' > > app/models/call.rb:23 > > /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/ > > dependencies.rb:203:in `load_without_new_constant_marking'' > > > My index action is now > > def index > > @recent_calls = @current_user.calls.paginate :per_page => > > 4, :page => params[:page], > > :conditions => [''name like ? AND user_id = ?'', > > "%#{params[:search]} > > %", @current_user.id], > > :order => ''name'' > > > end > > > Notice the method-missing-without_paginate. Originally I have the > > pagination in my model as post one shows per Ryan Bates and it worked > > in another version of > > this app so that is why it wasn''t in my original index action. I had > > moved it to the model. > > > I don''t understand why the method_missing_without_paginate is there as > > my gem list shows I have the latest will_paginate and I am using rails > > 2.0.2 > > > Any other suggestions?? Thanks in advance > > Owen > > > On Aug 21, 9:46 am, "\"Wolas!\"" <jcpen...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: @calls > > Call.find(:all) > > > > As per usual, fred is correct > > > > On Aug 21, 5:39 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > > wrote: > > > > > On 21 Aug 2008, at 17:10, THEBIGO wrote: > > > > > > Thank you so much Wolas for your reply and your suggestion got rid of > > > > > my undefined mehod error And I coppied and pasted your suggestion but > > > > > I now get the following error - I am not sure where to correct it > > > > > looks the email line wrapped it in a bad way: > > > > > > @recent_calls = @current_user.calls.paginate :per_page => 4, :page > > > > > => params[:page], > > > > > should be all on one line. (if you do put in line breaks put them > > > > after a ,) > > > > > Fred > > > > > > SyntaxError in CallsController#index > > > > > > /Users/owenhmad/Sites/ministrytrackr/ministrytrackr/app/controllers/ > > > > > calls_controller.rb:6: syntax error, unexpected ''\n'', expecting tASSOC > > > > > /Users/owenhmad/Sites/ministrytrackr/ministrytrackr/app/controllers/ > > > > > calls_controller.rb:8: syntax error, unexpected tASSOC, expecting > > > > > tCOLON2 or ''['' or ''.'' > > > > > :conditions => [''name like ? AND user_id = ?'', > > > > > "%#{params[:search]} > > > > > ^ > > > > > /Users/owenhmad/Sites/ministrytrackr/ministrytrackr/app/controllers/ > > > > > calls_controller.rb:9: syntax error, unexpected '','', expecting kEND > > > > > > RAILS_ROOT: /Users/owenhmad/Sites/ministrytrackr/ministrytrackr > > > > > > Any suggestions would be appreciated - Owen > > > > > > On Aug 21, 4:05 am, "\"Wolas!\"" <jcpen...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > >> The problem is in your controller action > > > > > >> def index > > > > >> @calls = Call.find(:all) > > > > >> @recent_calls = @current_user.calls.find(:all) > > > > >> @recent_calls = @current_user.calls.search(params[:search], > > > > >> params[:page]) > > > > >> end > > > > > >> first, you are declaring @recent_calls twice, the first one > > > > >> (@recent_calls = @current_user.calls.find(:all)) will never work when > > > > >> the second is there. > > > > > >> next, when you declare a method self.search in the class Call, you > > > > >> call it in the class!! so Call.search(params[:search], params[:page]) > > > > >> willl return an array of calls. (Note: it will return them for ALL > > > > >> users, not just the current. > > > > > >> Third, you are calling a method on class Array (which is what > > > > >> @current_user.calls returns) when you defined that method in the > > > > >> class > > > > >> Call. > > > > > >> If you want to get a list of call objects from a user (i assume user > > > > >> has_many :calls, and call belongs_to :user) with a name like > > > > >> something > > > > >> and paginated. id do it like such: > > > > > >> def index > > > > >> @recent_calls = @current_user.calls.paginate :per_page => 4, :page > > > > >> => params[:page], > > > > >> :conditions => [''name like ? AND user_id = ?'', > > > > >> "%#{params[:search]} > > > > >> %", @current_user.id], > > > > >> :order => ''name'' > > > > >> end > > > > > >> if you use the method more than twice, then put it in the class, but > > > > >> you would also need to pass the user id. > > > > > >> good luck > > > > > >> On Aug 20, 11:30 pm, THEBIGO <Mowenh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > >>> I''m not sure why i am having this problem but when i execute a > > > > >>> call to > > > > >>> the calls controller from a link > > > > > >>> <li><%= link_to_unless_current ''My Call Book'', { :controller => > > > > >>> "calls", :action => "index" } %></li> > > > > > >>> <li><em> :: </em></li> > > > > > >>> I get the following error > > > > > >>> NoMethodError in CallsController#index > > > > > >>> undefined method `_of'' for #<Class:0x2517c1c> > > > > > >>> RAILS_ROOT: /Users/owenhmad/Sites/ministrytrackr/ministrytrackr > > > > >>> Application Trace | Framework Trace | Full Trace > > > > > >>> /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/ > > > > >>> base.rb:1532:in `method_missing_without_paginate'' > > > > >>> /Library/Ruby/Gems/1.8/gems/mislav-will_paginate-2.3.2/lib/ > > > > >>> will_paginate/finder.rb:164:in `method_missing'' > > > > >>> app/models/call.rb:23 > > > > >>> /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/ > > > > >>> dependencies.rb:203:in `load_without_new_constant_marking'' > > > > >>> /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/ > > > > >>> dependencies.rb:203:in `load_file'' > > > > >>> /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/ > > > > >>> dependencies.rb:342:in `new_constants_in'' > > > > > >>> part of my CallsController is > > > > > >>> class CallsController < ApplicationController > > > > >>> before_filter :login_required, :only => [ :index, :new, :edit] > > > > > >>> def index > > > > >>> @calls = Call.find(:all) > > > > >>> @recent_calls = @current_user.calls.find(:all) > > > > >>> @recent_calls = @current_user.calls.search(params[:search], > > > > >>> params[:page]) > > > > >>> end > > > > > >>> def list > > > > >>> @calls = @current_user.calls.find(:all) > > > > >>> end > > > > > >>> def show > > > > >>> @call = Call.find(params[:id]) > > > > >>> end > > > > > >>> And my call model is > > > > > >>> class Call < ActiveRecord::Base > > > > >>> belongs_to :user > > > > >>> has_many:visits, :dependent => :destroy > > > > >>> has_many:visits do > > > > >>> def latest > > > > >>> find :all, :order => ''id DESC'', :limit => 3 > > > > >>> end > > > > > >>> def all_latest > > > > >>> find :all, :order => ''id DESC'' > > > > >>> end > > > > >>> end > > > > > >>> def self.search(search, page) > > > > >>> paginate :per_page => 4, :page => page, > > > > >>> :conditions => [''name like ?'', "%#{search}%"], > > > > >>> :order => ''name'' > > > > >>> end > > > > > >>> end > > > > > >>> It says in the error message `method_missing_without_paginate'' > > > > > >>> I have will_paginate installed in rails as a gem and it shows up > > > > >>> in my > > > > >>> gem list. Any help to a beginner working on first real app after > > > > >>> may > > > > >>> books would be appreciated > > > > > >>> Thanks Owen- Hide quoted text - > > > > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks for the reply. My model is
class Call < ActiveRecord::Base
belongs_to :user
has_many:visits, :dependent => :destroy
has_many:visits do
def latest
find :all, :order => ''id DESC'', :limit => 3
end
def all_latest
find :all, :order => ''id DESC''
end
#def self.search(search, page)
# paginate :per_page => 4, :page => page,
# :conditions => [''name like ?'',
"%#{search}%"],
# :order => ''name''
#end
end
20 def self.search(search, page)
21 paginate :per_page => 4, :page => page,
22 :conditions => [''name like ?'',
"%#{search}%"],
23 :order => ''name''
end
ALL_FIELDS = %w(name address age area sex notes)
VALID_SEX = ["Male", "Female"]
validates_presence_of :name, :address, :age, :area
validates_inclusion_of :sex,
:in => VALID_SEX,
:message => "must be male or female"
end
And line 23 is in the def for self.search conditions where I have
:order => ''name'' so I am not sure what is wron there
Wolas! wrote:> look in line 23 of the model Call yes
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
thanks all for your help but I found my error and it involved an extra space in a rails method and the fact that when I changed some of the deffinitions in the model when I refrenced them I refrenced the old terms. thanks again - Owen On Aug 22, 8:35 am, THEBIGO <Mowenh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thanks for the reply. My model is > class Call < ActiveRecord::Base > belongs_to :user > has_many:visits, :dependent => :destroy > has_many:visits do > def latest > find :all, :order => ''id DESC'', :limit => 3 > end > > def all_latest > find :all, :order => ''id DESC'' > end > > #def self.search(search, page) > # paginate :per_page => 4, :page => page, > # :conditions => [''name like ?'', "%#{search}%"], > # :order => ''name'' > #end > end > > 20 def self.search(search, page) > 21 paginate :per_page => 4, :page => page, > 22 :conditions => [''name like ?'', "%#{search}%"], > 23 :order => ''name'' > end > > ALL_FIELDS = %w(name address age area sex notes) > VALID_SEX = ["Male", "Female"] > validates_presence_of :name, :address, :age, :area > validates_inclusion_of :sex, > :in => VALID_SEX, > :message => "must be male or female" > > end > > And line 23 is in the def for self.search conditions where I have > > :order => ''name'' so I am not sure what is wron there > > Wolas! wrote: > > look in line 23 of the model Call yes--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---