ruby on rails - TypeError: #<...> is not a symbol -
i cannot figure out issue, if not seem complicated...
i want make form send emails in rails app 1 not work. receive following error:
typeerror in messagescontroller#create
: #<message content: "test", email: "test@test.fr", name: "test"> not symbol
error occurs in: app/controllers/messages_controller.rb:10:in 'create'
1.here messages_controller
:
class messagescontroller < applicationcontroller def new @message = message.new end def create @message = message.new(params[:message]) if @message.valid? messenger.send(@message).deliver redirect_to root_url, notice: "message sent! thank contacting us." else render "new" end end end
the form
new.html.erb
:<%= form_for @message |f| %> <%= f.text_field :name %> <%= f.text_field :email %> <%= f.text_area :content, :rows => 5 %> <%= f.submit "send message" %> <% end %>
the
message
model built usingactiveattr
:class message include activeattr::model attribute :name attribute :email attribute :content end
my
messenger
mailer:class messenger < actionmailer::base default :from => "test@test.com" def send(message) mail(:to => "test@test.com", :subject => "test") end end
thank help!
replace send
different method name because conflicts 1 defined in ruby.
Comments
Post a Comment