Adding an error to the model
How to manually add errors to the model
Should probably be done as part of the validate callback
self.errors.add :field_name, "isn't as it should be"
TextSnippets > stocad > rails
2040 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)
Aaron http://www.stocad.com
self.errors.add :field_name, "isn't as it should be"
<%= radio_button_tag "payment_method_token", pm.token, (@payment_method_token == pm.token ? true : false), {:onchange => remote_function( :with => "'payment_method_token='+this.value", :url => {:action => 'load_payment_method' } )}%> > <TD nowrap><B><%=pm.name%><%=pm.description%> > TR> <%}%> <% observe_field('payment_method_token', :frequency => 0.5, :with => "payment_method_token", :url => { :action => 'load_payment_method' }) %>
<%= link_to_remote( "click here", :update => "specific_div_block", :url =>{ :action => :action_name }) %>
<%= select_tag( :saction, options_for_select([["Actions:",0],["Edit",1],["Delete",2]],0), :onchange => "if(confirm('Are you sure? This will effect all products checked below.')) products_form.submit(); else products_form.saction.value = 0;")%>
<%= select_tag( :sort_by, options_for_select([["Sort by:",0],["Name",'name'],["Price",'price'], ["Date Listed",'id']],0), :onchange => remote_function( :with => "'sort_by='+$(\"sort_by\").value", :loading => "false;", :url => { :controller => 'products', :action => :change_order } ) ) %>
<%= link_to 'Link Name', { :action => 'action_name', :id => 0 }, :confirm => 'Are you sure?', :post => true %>