Hi everyone,
I have this weird problem where error_messages_for isn''t working.
I have a model group which has to validates constraints..
---------------------------------
class Group < ActiveRecord::Base
#directionality points to the user model
#this table contains the foreign key
belongs_to :user
validates_uniqueness_of :name
validates_presence_of :name
end
--------------------------------
In the controller I have a method which persists this group
def create_group
...
if( group.save )
logger.debug( "group save successful")
flash[:notice] = ''Created group '' + group.name +
'' successfully''
else
logger.debug( "group save unsuccessful")
flash[:notice] = ''Could not save group''
end
redirect_to :action=>"manage_friends"
end
in the manage_friends.rhtml i have the code...
------------
<!-- CREATE GROUP -->
<%= start_form_tag :controller=> "profile", :action=>
"create_group" %>
<div title="create group" id="creategroupform"
class="form">
<%= error_messages_for (''group'') %><br/>
<b>Create Group: </b><br>
<%= text_field "group", "name", :size => 30
%><br/>
<input type="submit" value="Create Group »"
class="primary" />
</div>
<%= end_form_tag %>
<!-- ADD FRIEND TO USER GROUP -->
<%= start_form_tag :controller=> "profile", :action=>
"add_user_to_group" %>
-------------------
but no text gets generated from the <%= error_messages_for call.
I also tried the error_messages with (:group)
Any ideas anyone!?!?!
Thanks,
-dan
--
Posted via http://www.ruby-forum.com/.