smeade wrote:
Sam,
If you have
class Ratecomment < ActiveRecord::Base
validates_presence_of :some_field
Then @comments.save should return false and the new instance of
Ratecomment not retained if :some_field is blank, regardless of what
controller it's called in.
Is that what you mean and what is not happening?
On Aug 27, 12:56�pm, Sam Ginko <rails-mailing-l...@andreas-s.net>
yes that is the issue.
########this is the model
class Ratecomment < ActiveRecord::Base
validates_presence_of :content
end
##############this is the view
<% form_tag( "rate?id=#{@furnii.id}", :name => "theform") do %>
<table border="0" width="450" cellpadding="3" cellspacing="0">
<tr><td colspan=2><%= error_messages_for 'furni' %></td></tr>
<tr>
<td class="txtBlackSmall" valign=top colspan=2>
<table border="0" cellspacing="0" cellpadding="4">
<tr>
<td class="headerBlackSmall">Rate it: </td>
<td class="txtBlackSmall">1 <%= radio_button "ratecomment",
"rating", "1", :checked => "checked"%></td>
<td class="txtBlackSmall">2 <%= radio_button "ratecomment",
"rating", "2" %></td>
<td class="txtBlackSmall">3 <%= radio_button "ratecomment",
"rating", "3" %></td>
<td class="txtBlackSmall">4 <%= radio_button "ratecomment",
"rating", "4" %></td>
<td class="txtBlackSmall">5 <%= radio_button "ratecomment",
"rating", "5" %></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="headerBlackSmall" colspan=2>
<label for="content">Add comment</label><br>
<%= text_area :ratecomment, :content,
:rows=>"6", :cols=>"60" %><br>
</td>
</tr>
<tr bgcolor="ffffff">
<td><%= link_to 'cancel''''', index_furnii_path()%></td>
<td align=right>
<%= submit_tag "Submit" %>
</td>
</tr>
</table>
<%= hidden_field :ratecomment, :rateable_id, :value => @furnii.id %>
<% end %>