I''m a rails newbie and well into a new project. I''m using he ActionMailer component for the first time but I keep getting an error when executing it at the last step. I am passing some data through a contact form that needs to be sent to a specific address, heres what I have done so far. First i setup the enviroment.rb with the ActionMailer configurations like so: config.action_mailer.delivery_method = :smtp config.action_mailer.server_settings = { :address => "smtp.outitgoes.com", :port => 25, :user_name => "rpugh-9i0M0AOlhVBrPbaTPnWswA@public.gmane.org", :password => "374884", :authentication => "login" } Then using the console I used the generate mailer script and created all the necessary files in which edited the create model mailer class, view for the email and then the controller like so: def quote_send quote = params[:quote] QuoteMailer.deliver_send(quote) end When I access this controller i get this error: "wrong number of arguments (2 for 1)" Can somebody point me out whats wrong, I have checked my code and can''t see any problems. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> def quote_send > quote = params[:quote] > QuoteMailer.deliver_send(quote) > end > > > When I access this controller i get this error: "wrong number of > arguments (2 for 1)"what does params[:qoute] return? you are apperantely passing two arguments to the QouteMailer#send method, where if you check in the QouteMailer model, you only need one. (this is why is says "2 for 1") ...i believe this is the problem, but if you post the :send method in QouteMailer i''m sure we could debug a little further. (the problem lies therein, i believe) -- 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 -~----------~----~----~----~------~----~------~--~---
params[:quote] returns data thats been entered into a form. i still don''t understand what i''m doing wrong. On 24 Jun, 10:29, shai <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > def quote_send > > quote = params[:quote] > > QuoteMailer.deliver_send(quote) > > end > > > When I access this controller i get this error: "wrong number of > > arguments (2 for 1)" > > what does params[:qoute] return? you are apperantely passing two > arguments to the QouteMailer#send method, where if you check in the > QouteMailer model, you only need one. (this is why is says "2 for 1") > > ...i believe this is the problem, but if you post the :send method in > QouteMailer i''m sure we could debug a little further. (the problem lies > therein, i believe) > > -- > 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-/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 -~----------~----~----~----~------~----~------~--~---
def quote_send quote = params[:quote] QuoteMailer.deliver_send(quote) end two things i have in mind: in QouteMailer.rb , you apparently have a ''send'' method defined there. (hence the deliver_send(arg) ). this may be the cause of the error, as the "send" may be a reserved word. ( http://dev.rubyonrails.org/ticket/6467 ). try changing the method to something less generic such as "def email" instead of "def send", and then change the controller method to QouteMailer.deliver_email(arg) ; maybe that will help. second thing, if the above doesn''t work (hopefully this should be enough) would be to dump the params[:qoute] and see what that returns, as that could be the only other thing that is stopping this from working. shai -- 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 -~----------~----~----~----~------~----~------~--~---