Created
June 17, 2009 12:01
-
-
Save mrichman/131206 to your computer and use it in GitHub Desktop.
simple_form errors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ContactForm < SimpleForm | |
sender {|c| %{"#{c.name}" <#{c.email}>}} | |
subject 'Contact Form' | |
recipients '[email protected]' | |
append :remote_ip, :user_agent, :session | |
attribute :name, :validate => true | |
attribute :email, :validate => defined?(Authlogic::Regex.email) ? Authlogic::Regex.email : /@/ | |
attribute :company_name | |
attribute :telephone | |
attribute :message, :validate => true | |
attribute :nickname, :captcha => true | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ContactFormsController < InheritedResources::Base | |
actions :new, :create | |
def new | |
@contact_form = ContactForm.new(params[:contact_form], request) | |
end | |
def create | |
create! { root_url } | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- content_for :title do | |
= t(:feedback) | |
- error_messages_for :contact_form | |
- semantic_form_for @contact_form, :url => contact_form_path do |f| | |
- f.inputs do | |
= f.input :name | |
= f.input :email, :validate => defined?(Authlogic::Regex.email) ? Authlogic::Regex.email : /@/ | |
= f.input :nickname, :wrapper_html => { :style => "display:none;" } | |
= f.input :message, :as => :text, :rows => 6, :cols => 25 | |
- f.buttons do | |
= submit_tag "Send" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Processing ContactFormsController#create (for 127.0.0.1 at 2009-06-17 07:58:01) [POST] | |
Parameters: {"commit"=>"Send", "contact_form"=>{"message"=>"Testing 123", "name"=>"Mark A. Richman", "nickname"=>"", "email"=>"[email protected]"}, "action"=>"create", "authenticity_token"=>"x+fsI69dddddddddddddddI1+SYw7o8P68evqync=", "controller"=>"contact_forms", "locale"=>"en"} | |
ScriptError (You set :append values but forgot to give me the request object): | |
/Library/Ruby/Gems/1.8/gems/josevalim-simple_form-0.3.1/lib/simple_form/notifier.rb:12:in `contact' | |
/Library/Ruby/Gems/1.8/gems/josevalim-simple_form-0.3.1/lib/simple_form/base.rb:88:in `save' | |
/Library/Ruby/Gems/1.8/gems/josevalim-inherited_resources-0.8.2/lib/inherited_resources/actions.rb:36:in `create!' | |
app/controllers/contact_forms_controller.rb:9:in `create' | |
/Library/Ruby/Gems/1.8/gems/haml-edge-2.1.12/lib/sass/plugin/rails.rb:20:in `process' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment