form_for should check if object responds to `errors'
Reported by zdk | September 19th, 2008 @ 11:16 AM | in 1.0
at the moment when using form helper like this
<% form_for :user, :action => "/login", :method => :post do %>
<p><%= text_field :login, :label => "Username" %></p>
<p><%= password_control :password, :label => "Password" %></p>
<%= submit_button "Login" %>
<% end %>
with no-ORM model like
class User < SimpleDB::Base
end
it raises error
~ undefined method `errors' for #<User:0xb6946194> - (NoMethodError)
Comments and changes to this ticket
-
Michael Klishin (antares) September 19th, 2008 @ 08:54 PM
- → Assigned user changed from to GMFlash
- → Tag changed from to merb_helpers
- → Milestone changed from to 0.9.8
- → State changed from new to open
-

magnetised September 26th, 2008 @ 06:01 PM
I just hit this one too.
As a workaround you can just include validations in your datamapper class
require "dm-validations"
datamapper's objects obviously don't have an 'errors' method unless you manually turn on validation.
-
Michael Klishin (antares) October 5th, 2008 @ 08:55 PM
- → Assigned user changed from GMFlash to Michael Klishin (antares)
- → Milestone changed from 0.9.8 to 1.0
- → Title changed from ~ undefined method `errors' to form_for should check if object responds to `errors'
It seems that merb-helpers spec suite needs to be re-arranged to use real models first before we can reliably fix this one and add spec examples for Sequel, AR and so forth.
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
