2

DEPRECATION WARNING: f.error_messages was removed from Rails and is now available as a plugin. Please install it with rails plugin install git://...

Seems a bit extreme to use a plugin for error messages like this. Am I not using the right standard names or something?

The code (HAML) is:

- simple_form_for(@link) do |f|
  = f.error_messages
Michael Durrant
  • 93,410
  • 97
  • 333
  • 497

3 Answers3

1

You could install the dynamic_form gem which supports a few helpers for your Rails 3 models. One of this helpers is error_messages. So the code below, that use to work on a Rails 2.3.x app, will still work on Rails 3 without deprecation warnings.

<% form_for @video, :html=>{:multipart=>true} do |f| %>
  <%= f.error_messages %>
  ...more view code...
<% end %>
Americo Savinon
  • 2,569
  • 1
  • 19
  • 16
1

There is no misspelling in your code, f.error_messages are deprecated in fact. There is a discussion on stackoverflow: f.error_messages in Rails 3.0.

Community
  • 1
  • 1
Michał Czapko
  • 1,948
  • 1
  • 16
  • 25
1

Thanks Michal. I will give you an upvote. I found that the following was a good quick replacement for the upgrade:

  -if @link.errors.any?
    %div#error_explanation
      %h2
        =pluralize(@link.errors.count, "error")+' '
        prohibited this link from being saved:
      %ul
      -@link.errors.full_messages.each do |msg|
        %li
          =msg
Michael Durrant
  • 93,410
  • 97
  • 333
  • 497