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 
  1. 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 %> 
  2. the message model built using activeattr:

    class message   include activeattr::model    attribute :name   attribute :email   attribute :content end 
  3. 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.

http://ruby-doc.org/core-2.0/object.html#method-i-send


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -