title: Model validate method returns error from server rails 5
body: <p>I have this method in my <code>micropost.rb</code>, the error is souly when I run this method. When I submit my form I do not get the errors from the model but the rendering of the <code>else</code> condition in the <strong>controller</strong>. Something seems to be wrong in the <strong>model</strong> but don't see why I get rollback transaction from server?</p>
  
  <p>The method just checks that a user has not entered and sent more than one field.</p>
  
  <p><strong>Micropost.rb</strong>    </p>
  
  <pre><code>validate :return_media_field_errors
  
  private 
  
  def return_media_field_errors
    if :img_url? &amp;&amp; :video_url? 
      errors.add(:img_url, "Can only submit one field at a time")
    end
  end
  </code></pre>
  
  <p><strong>MicropostController</strong></p>
  
  <pre><code>def create
    @micropost = current_user.microposts.build(micropost_params)
    if @micropost.save
      flash[:success] = "Micropost created!"
      @micropost  = current_user.microposts.build
      @feed_items = current_user.feed.paginate(page: params[:page])
      render 'static_pages/home'
    else
      @feed_items = []
      render 'shared/error_messages'
    end
  end
  
  private
  
    def micropost_params
      params.require(:micropost).permit(:content, :picture, :picture_cache, :image_url, :video_url, :gif_url)
    end
  </code></pre>
  
  <p><strong>micropost schema.rb</strong></p>
  
  <pre><code>create_table "microposts", force: :cascade do |t|
    t.text     "content"
    t.integer  "user_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string   "picture"
    t.string   "image_url"
    t.string   "video_url"
    t.string   "gif_url"
    t.index ["user_id", "created_at"], name: "index_microposts_on_user_id_and_created_at"
    t.index ["user_id"], name: "index_microposts_on_user_id"
  end
  </code></pre>
  
  <p>View params</p>
  
  <pre><code>&lt;div class="media_field_1"&gt;    
    Image &lt;%= f.text_field :image_url, class: 'form-control' %&gt;
  &lt;/div&gt;
  &lt;div class="media_field_2"&gt; 
    Video &lt;%= f.text_field :video_url, class: 'form-control' %&gt;
  &lt;/div&gt; 
  </code></pre>