when i try /contact_mail/newi it return me error: undefined local
variable
or method `em’ for #<#Class:0x007fca24248858:0x007fca21186df0>
model: contact_mail.rg
class ContactMail < ActiveRecord::Base
attr_accessible :email, :message, :name, :subject
end
controler: contarct_mail_controller.rb
class ContactMailController < ApplicationController
def new
@em=ContactMail.new
end
def create
@em = ContactMail.new(params[:contact_mail])
@em.save
end
end
view: new.html.erb
<%= form_for(@em) do |f| %>
when i add @em.save to def new in controller it pass but i’t not the way
i
want to do it.
Do enyone know how can i fix it? or what is wrong with my solution?
i had made 4 model and controllers allrady using this method and it
works
perfetly.
i had add resources :contact_mail to routes.