In my opinion this is the best way to do it:
class FooBar < ActiveRecord::Base
validates_uniqueness_of :foo, :bar, :unless => :force_submit
attr_accessor :force_submit
end
then in your view, make sure you name the submit tag like
<%= submit_tag 'Resubmit', :name => 'foo_bar[force_submit]' %>
this way, all the logic is in the model, controller code will stay the same.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…