I have a rails app that allows you to request an invite to sign up. Upon request I save your email and send you an email saying thanks 'you have requested to join in'. For some reason the line UserMailer.request(@request).deliver
gives me this error ArgumentError in RequestsController#create -- wrong number of arguments (0 for 1)
Any ideas?
requests controller
class RequestsController < ApplicationController
def new
@request = Request.new
end
def create
@request = Request.new(params[:request])
if @request.valid?
if User.find_by_email(@request.email) || Invitation.find_by_email(@request.email)
redirect_to log_in_path, notice: "Email already in use"
elsif @request.save
@request.save
redirect_to root_url, :notice => "Request sent."
UserMailer.request(@request).deliver
end
else
render "new"
end
end
end
request.html.haml
You have requested to join in
mailers/user_mailer.rb
class UserMailer < ActionMailer::Base
def request(request)
@request = request
mail(:to => request.email, :subject => "Requested an invite", :from => '[email protected]')
end
end
I think request
is a reserved word. Try change to request_mail
and see whether it works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With