title: display model base error in view on create rails 3
body: <p>I have form where user can subscribe for latest coupons.When i open same store link in multiple tab and subscribe, i get multiple subscription for single store causing duplication of data and sending same mail multiple times .So added validation on model.So the question is how do i get the error to be shown in view .When a user is already subscribed to a store.Since create is making a ajax request..I have pasted the codes below .Any help would be appreciated Thanks</p>
  
  <p>_index.html.haml (views)</p>
  
  <pre><code>=form_for([@merchant,@coupon_subscription],:remote =&gt; true,:html =&gt; { :class =&gt; "store_subscribe" } ) do |f|
      %h3 subscribe for #{@merchant.merchant_name} coupons 
  -if !logged_in?
    =f.text_field :user ,:class =&gt; "input_text email"
  =f.submit "Subscribe",:disable_with =&gt; "Subscribing...",:class =&gt; "store_subscribe subscribe_button"
  </code></pre>
  
  <p>subscription Controller </p>
  
  <pre><code>def create                                                            #creates subscription 
  return if !logged_in?
  return if current_user.subscription_limit?
  @merchant=Merchant.find_by_permalink(params[:merchant_id])
  @coupon_subcription=CouponSubscription.new(:merchant_id =&gt; @merchant.id,:user =&gt; current_user)
  @coupon_subcription.coupon_subscribe
  respond_to do |format|
    if @coupon_subcription.save!
      format.html { redirect_to(:back, :notice =&gt; 'Success.') }  
      format.js
    else
      format.html { redirect_to(:back, :notice =&gt; @coupon_subcription.errors.full_messages || "Oops something went wrong")}  
      format.js 
  
    end
  end
  UserMailer.delay.coupon_subscription(current_user,@coupon_subcription)
  </code></pre>
  
  <p>end</p>
  
  <p>Model</p>
  
  <pre><code>validate :validate_subscription ,:on =&gt; :create
  
  private 
  def validate_subscription
  @coupon_subscribed=CouponSubscription.find_by_user_id_and_merchant_id_and_active(self.user_id,self.merchant_id,true)
  if @coupon_subscribed
     self.errors.add(:base , 'You have already subscribed.')
  end
  </code></pre>
  
  <p>end</p>
  
  <p>create.js</p>
  
  <pre><code>&lt;% if !logged_in? %&gt;
  $(".store_subscribe").remove()
  $(".subscription_feedback").show().append("Login!")
  &lt;% else %&gt;
  $(".store_subscribe").remove()
  $(".store_subscribe").show().append("&lt;h3&gt;Thanks for subscription .We have send you a   mail &lt;/h3&gt;")
  &lt;% end %&gt;
  </code></pre>