Is #errors in 0.10 a simple Hash? It would need to duck-type like an AR
errors object to work.
-- Yehuda

On Sat, Jun 20, 2009 at 11:39 AM, Hola <holacost...@gmail.com> wrote:

>
> In Rails, you add error messages to the view like so:
>
> <% remote_form_for(mymodel) do |f| %>
>   <%= f.error_messages %>
>
> However, if mymodel is a Datamapper rather than an ActiveRecord model,
> it produces an error:
>
> undefined method `count' for {}:Hash
>
> At the moment I am addressing this unfortunately by removing the call
> to error_messages in the view.
>
> Is there a better workaround?
>
>
> This is the stack trace, in case it helps (I just updated to the
> latest 0.10 release candidate for all dm gems).
>
>
> ----------------------------------------------------------------------------------------------------
>
> C:/Ruby18/lib/ruby/gems/1.8/gems/dm-validations-0.10.0/lib/dm-
> validations/validation_errors.rb:106:in `send'
> C:/Ruby18/lib/ruby/gems/1.8/gems/dm-validations-0.10.0/lib/dm-
> validations/validation_errors.rb:106:in `method_missing'
> C:/Ruby18/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_view/
> helpers/active_record_helper.rb:179:in `error_messages_for'
> C:/Ruby18/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_view/
> renderable.rb:77:in `inject'
> C:/Ruby18/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_view/
> helpers/active_record_helper.rb:179:in `each'
> C:/Ruby18/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_view/
> helpers/active_record_helper.rb:179:in `inject'
> C:/Ruby18/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_view/
> helpers/active_record_helper.rb:179:in `error_messages_for'
> C:/Ruby18/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_view/
> helpers/form_helper.rb:984:in `error_messages'
> >
>


-- 
Yehuda Katz
Developer | Engine Yard
(ph) 718.877.1325

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to datamapper@googlegroups.com
To unsubscribe from this group, send email to 
datamapper+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to