Hi, I''m baffled by this error. I need a simple controller to send e-mails, so first I thought about just creating the controller manually (without using script/generate), since that didn''t seem to work, I created a dummy table in my DB and used the usual procedure to generate scaffold code. Then I modified the controller to have only two methods, send and compose: class MailsController < ApplicationController def compose render_text ''composing'' end def send render_text ''sending'' end end And I have these routes defined: map.connect _(''mail/:id/send''), :controller => ''mails'', :action => ''send'' map.connect _(''mail/:id''), :controller => ''mails'', :action => ''compose'' But when I try to browse to /mail/4 for example, I get this error (which by the way seems to have to do only with the route, because if I rename the actions in the controller, the behavior is just the same): ArgumentError in Mails#compose wrong number of arguments (1 for 0) And since Tuesday I can''t figure out what is wrong... Could someone please help me out here? Thanks in advance! - Ivan V.
On 21 Oct 2005, at 9:43 pm, Iván Vega Rivera wrote:> I have these routes defined: > > map.connect _(''mail/:id/send''), :controller => ''mails'', :action => > ''send'' > map.connect _(''mail/:id''), :controller => ''mails'', :action => > ''compose'' > > But when I try to browse to /mail/4 for example, I get this error > (which by the way seems to have to do only with the route, because > if I rename the actions in the controller, the behavior is just the > same): > > > ArgumentError in Mails#compose > > wrong number of arguments (1 for 0)You don''t need that underscore or the parentheses. Just map.connect ''mail/:id/:send'', :controller => ''mails'', :action => ''send'' should work. Chris
On 10/21/05, Iván Vega Rivera <ivanvr-Xl95p0XkWPRBDgjK7y7TUQ@public.gmane.org> wrote:> And I have these routes defined: > > map.connect _(''mail/:id/send''), :controller => ''mails'', :action => ''send'' > map.connect _(''mail/:id''), :controller => ''mails'', :action => ''compose''Try map.connect ''mail/:id/send'', :controller => ''mails'', :action => ''send'' map.connect ''mail/:id'', :controller => ''mails'', :action => ''compose''
Iván Vega Rivera
2005-Oct-21 21:10 UTC
Re: Wrong number of arguments (1 for 0) on routes.rb
Oh, I forgot to remove those function calls. They''re just there so I can use specific routes for each language. They''re not the culprit (I have already tried as you say). Any ideas? Thanks! Cuong Tran wrote:> On 10/21/05, Iván Vega Rivera <ivanvr-Xl95p0XkWPRBDgjK7y7TUQ@public.gmane.org> wrote: > > >> And I have these routes defined: >> >> map.connect _(''mail/:id/send''), :controller => ''mails'', :action => ''send'' >> map.connect _(''mail/:id''), :controller => ''mails'', :action => ''compose'' >> > > Try > map.connect ''mail/:id/send'', :controller => ''mails'', :action => ''send'' > map.connect ''mail/:id'', :controller => ''mails'', :action => ''compose'' > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > >
Iván Vega Rivera
2005-Oct-21 21:13 UTC
Re: Wrong number of arguments (1 for 0) on routes.rb
Yeah, as I replied to Cuong, those are not really the culprit. Thanks for your help, do you have any other ideas why this behavior occurs? Thanks again! Chris Mear wrote:> On 21 Oct 2005, at 9:43 pm, Iván Vega Rivera wrote: > >> I have these routes defined: >> >> map.connect _(''mail/:id/send''), :controller => ''mails'', :action => >> ''send'' >> map.connect _(''mail/:id''), :controller => ''mails'', :action => ''compose'' >> >> But when I try to browse to /mail/4 for example, I get this error >> (which by the way seems to have to do only with the route, because if >> I rename the actions in the controller, the behavior is just the same): >> >> >> ArgumentError in Mails#compose >> >> wrong number of arguments (1 for 0) > > You don''t need that underscore or the parentheses. Just > > map.connect ''mail/:id/:send'', :controller => ''mails'', :action => ''send'' > > should work. > > Chris_______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
When you click on "Show Framework Trace", what does it show? -Steve On Fri, 2005-10-21 at 15:43 -0500, Iván Vega Rivera wrote:> Hi, > > I''m baffled by this error. I need a simple controller to send e-mails, > so first I thought about just creating the controller manually (without > using script/generate), since that didn''t seem to work, I created a > dummy table in my DB and used the usual procedure to generate scaffold code. > > Then I modified the controller to have only two methods, send and compose: > > class MailsController < ApplicationController > def compose > render_text ''composing'' > end > > def send > render_text ''sending'' > end > end > > And I have these routes defined: > > map.connect _(''mail/:id/send''), :controller => ''mails'', :action => ''send'' > map.connect _(''mail/:id''), :controller => ''mails'', :action => ''compose'' > > But when I try to browse to /mail/4 for example, I get this error (which > by the way seems to have to do only with the route, because if I rename > the actions in the controller, the behavior is just the same): > > > ArgumentError in Mails#compose > > wrong number of arguments (1 for 0) > > And since Tuesday I can''t figure out what is wrong... > > Could someone please help me out here? > > Thanks in advance! > > - Ivan V. > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
This: |c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:356:in `send'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:356:in `process'' c:/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/dispatcher.rb:32:in `dispatch'' c:/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:105:in `handle_dispatch'' c:/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:71:in `service'' c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' c:/ruby/lib/ruby/1.8/webrick/server.rb:155:in `start_thread'' c:/ruby/lib/ruby/1.8/webrick/server.rb:144:in `start'' c:/ruby/lib/ruby/1.8/webrick/server.rb:144:in `start_thread'' c:/ruby/lib/ruby/1.8/webrick/server.rb:94:in `start'' c:/ruby/lib/ruby/1.8/webrick/server.rb:89:in `each'' c:/ruby/lib/ruby/1.8/webrick/server.rb:89:in `start'' c:/ruby/lib/ruby/1.8/webrick/server.rb:79:in `start'' c:/ruby/lib/ruby/1.8/webrick/server.rb:79:in `start'' c:/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:57:in `dispatch'' Thanks. Ivan V. | Steve Prentice wrote:> When you click on "Show Framework Trace", what does it show? > > -Steve > > On Fri, 2005-10-21 at 15:43 -0500, Iván Vega Rivera wrote: > >> Hi, >> >> I''m baffled by this error. I need a simple controller to send e-mails, >> so first I thought about just creating the controller manually (without >> using script/generate), since that didn''t seem to work, I created a >> dummy table in my DB and used the usual procedure to generate scaffold code. >> >> Then I modified the controller to have only two methods, send and compose: >> >> class MailsController < ApplicationController >> def compose >> render_text ''composing'' >> end >> >> def send >> render_text ''sending'' >> end >> end >> >> And I have these routes defined: >> >> map.connect _(''mail/:id/send''), :controller => ''mails'', :action => ''send'' >> map.connect _(''mail/:id''), :controller => ''mails'', :action => ''compose'' >> >> But when I try to browse to /mail/4 for example, I get this error (which >> by the way seems to have to do only with the route, because if I rename >> the actions in the controller, the behavior is just the same): >> >> >> ArgumentError in Mails#compose >> >> wrong number of arguments (1 for 0) >> >> And since Tuesday I can''t figure out what is wrong... >> >> Could someone please help me out here? >> >> Thanks in advance! >> >> - Ivan V. >> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > >
Have you defined a ''process'' action somewhere in your controller? It looks like there''s some kind of conflict there. If you do have one, you''ll need to rename it. - Jamis On Oct 21, 2005, at 3:31 PM, Iván Vega R. wrote:> This: > > |c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ > action_controller/base.rb:356:in `send'' c:/ruby/lib/ruby/gems/1.8/ > gems/actionpack-1.9.1/lib/action_controller/base.rb:356:in > `process'' c:/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/ > dispatcher.rb:32:in `dispatch'' c:/ruby/lib/ruby/gems/1.8/gems/ > rails-0.13.1/lib/webrick_server.rb:105:in `handle_dispatch'' c:/ruby/ > lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:71:in > `service'' c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in > `service'' c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' c:/ > ruby/lib/ruby/1.8/webrick/server.rb:155:in `start_thread'' c:/ruby/ > lib/ruby/1.8/webrick/server.rb:144:in `start'' c:/ruby/lib/ruby/1.8/ > webrick/server.rb:144:in `start_thread'' c:/ruby/lib/ruby/1.8/ > webrick/server.rb:94:in `start'' c:/ruby/lib/ruby/1.8/webrick/ > server.rb:89:in `each'' c:/ruby/lib/ruby/1.8/webrick/server.rb:89:in > `start'' c:/ruby/lib/ruby/1.8/webrick/server.rb:79:in `start'' c:/ > ruby/lib/ruby/1.8/webrick/server.rb:79:in `start'' c:/ruby/lib/ruby/ > gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:57:in `dispatch'' > > Thanks. > > Ivan V. > | > Steve Prentice wrote: > >> When you click on "Show Framework Trace", what does it show? >> >> -Steve >> >> On Fri, 2005-10-21 at 15:43 -0500, Iván Vega Rivera wrote: >> >> >>> Hi, >>> >>> I''m baffled by this error. I need a simple controller to send e- >>> mails, so first I thought about just creating the controller >>> manually (without using script/generate), since that didn''t seem >>> to work, I created a dummy table in my DB and used the usual >>> procedure to generate scaffold code. >>> >>> Then I modified the controller to have only two methods, send and >>> compose: >>> >>> class MailsController < ApplicationController >>> def compose >>> render_text ''composing'' >>> end >>> >>> def send >>> render_text ''sending'' >>> end >>> end >>> >>> And I have these routes defined: >>> >>> map.connect _(''mail/:id/send''), :controller => ''mails'', :action >>> => ''send'' >>> map.connect _(''mail/:id''), :controller => ''mails'', :action => >>> ''compose'' >>> >>> But when I try to browse to /mail/4 for example, I get this error >>> (which by the way seems to have to do only with the route, >>> because if I rename the actions in the controller, the behavior >>> is just the same): >>> >>> >>> ArgumentError in Mails#compose >>> >>> wrong number of arguments (1 for 0) >>> >>> And since Tuesday I can''t figure out what is wrong... >>> >>> Could someone please help me out here? >>> >>> Thanks in advance! >>> >>> - Ivan V. >>> >>> _______________________________________________ >>> Rails mailing list >>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>> http://lists.rubyonrails.org/mailman/listinfo/rails >>> >>> >> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> >> >> > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Jackpot! Actually, it was a ''send'' action I had defined. Upon renaming it all is fine with the world. Thanks a lot! Ivan V. Jamis Buck wrote:> Have you defined a ''process'' action somewhere in your controller? It > looks like there''s some kind of conflict there. If you do have one, > you''ll need to rename it. > > - Jamis > > On Oct 21, 2005, at 3:31 PM, Iván Vega R. wrote: > >> This: >> >> |c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:356:in >> `send'' >> c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:356:in >> `process'' >> c:/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/dispatcher.rb:32:in >> `dispatch'' >> c:/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:105:in >> `handle_dispatch'' >> c:/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:71:in >> `service'' c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' >> c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' >> c:/ruby/lib/ruby/1.8/webrick/server.rb:155:in `start_thread'' >> c:/ruby/lib/ruby/1.8/webrick/server.rb:144:in `start'' >> c:/ruby/lib/ruby/1.8/webrick/server.rb:144:in `start_thread'' >> c:/ruby/lib/ruby/1.8/webrick/server.rb:94:in `start'' >> c:/ruby/lib/ruby/1.8/webrick/server.rb:89:in `each'' >> c:/ruby/lib/ruby/1.8/webrick/server.rb:89:in `start'' >> c:/ruby/lib/ruby/1.8/webrick/server.rb:79:in `start'' >> c:/ruby/lib/ruby/1.8/webrick/server.rb:79:in `start'' >> c:/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:57:in >> `dispatch'' >> >> Thanks. >> >> Ivan V. >> | >> Steve Prentice wrote: >> >>> When you click on "Show Framework Trace", what does it show? >>> >>> -Steve >>> >>> On Fri, 2005-10-21 at 15:43 -0500, Iván Vega Rivera wrote: >>> >>> >>>> Hi, >>>> >>>> I''m baffled by this error. I need a simple controller to send >>>> e-mails, so first I thought about just creating the controller >>>> manually (without using script/generate), since that didn''t seem to >>>> work, I created a dummy table in my DB and used the usual procedure >>>> to generate scaffold code. >>>> >>>> Then I modified the controller to have only two methods, send and >>>> compose: >>>> >>>> class MailsController < ApplicationController >>>> def compose >>>> render_text ''composing'' >>>> end >>>> >>>> def send >>>> render_text ''sending'' >>>> end >>>> end >>>> >>>> And I have these routes defined: >>>> >>>> map.connect _(''mail/:id/send''), :controller => ''mails'', :action => >>>> ''send'' >>>> map.connect _(''mail/:id''), :controller => ''mails'', :action => >>>> ''compose'' >>>> >>>> But when I try to browse to /mail/4 for example, I get this error >>>> (which by the way seems to have to do only with the route, because >>>> if I rename the actions in the controller, the behavior is just the >>>> same): >>>> >>>> >>>> ArgumentError in Mails#compose >>>> >>>> wrong number of arguments (1 for 0) >>>> >>>> And since Tuesday I can''t figure out what is wrong... >>>> >>>> Could someone please help me out here? >>>> >>>> Thanks in advance! >>>> >>>> - Ivan V. >>>> >>>> _______________________________________________ >>>> Rails mailing list >>>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>> http://lists.rubyonrails.org/mailman/listinfo/rails >>>> >>>> >>> >>> _______________________________________________ >>> Rails mailing list >>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>> http://lists.rubyonrails.org/mailman/listinfo/rails >>> >>> >>> >> >> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >