Reputation: 96544
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
Upvotes: 2
Views: 1700
Reputation: 2649
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 %>
Upvotes: 1
Reputation: 96544
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
[email protected]_messages.each do |msg|
%li
=msg
Upvotes: 1
Reputation: 1938
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.
Upvotes: 1