title: Rails error messages not appearing on website but showing in Chrome DevTools Network Preview
body: <p>I'm trying to show error messages when creating a new instance of a model in my Rails app when a field doesn't pass validation. For some reason, the errors never actually show up on the website next to the fields like they're supposed to. <em>However, the errors appear in the 'Preview' section of the Network tab of Chrome DevTools.</em> So the errors are generating properly. In the terminal it says that <code>new.html.erb</code> is rendered but I don't think it actually does? Any help would be greatly appreciated - I haven't found much about this online. I'm using Tailwind CSS for styling the front end if that's helpful.</p>
  <p>Here's my code:</p>
  <p><strong>occasion.rb</strong></p>
  <pre><code>class Occasion &lt; ApplicationRecord
      belongs_to :user
      has_many :registries
      has_many :charities, :through =&gt; :registries
      
      validates :occasion_name, presence: true
      validates :occasion_date, presence: true
      validates :url, presence: true, format: { without: /\s/ }, uniqueness: true
      validates_uniqueness_of :user_id
  
  end
  </code></pre>
  <p><strong>occasions_controller.rb</strong></p>
  <pre><code>class OccasionsController &lt; ApplicationController
    load_and_authorize_resource only: [:new, :create, :edit, :update, :destroy]
  
    def index
      @occasions = Occasion.all
    end
    
    def show
      @occasion = Occasion.where(url: params[:url]).first
    end
    
    def new
      @occasion = Occasion.new
    end
  
    def create
      @occasion = Occasion.new(occasion_params)
      @occasion.user = current_user
  
      if @occasion.save
        respond_to do |format|
          format.html { redirect_to new_registry_path }
          format.js   { render :js =&gt; &quot;window.location='#{ new_registry_path }'&quot; }
        end
      else
        render :new
      end
    end
  
    def edit
      @occasion = Occasion.find(params[:id])
    end
  
    def update
      @occasion = Occasion.find(params[:id])
  
      if @occasion.update(occasion_params)
        redirect_to @occasion
        return
      else
        render :edit
      end
    end
  
    def destroy
      @occasion = Occasion.find(params[:id])
      @occasion.destroy
  
      redirect_to occasions_path
    end
  
    private
      def occasion_params
        params.require(:occasion).permit(:user_id, :occasion_name, :occasion_date, :url)
      end
      
    # user authentication is not required for show
    skip_before_action :authenticate_user!, :only =&gt; [:show]
  
  
  end
  </code></pre>
  <p><strong>new.html.erb</strong></p>
  <pre><code>&lt;%= form_with model: @occasion do |form| %&gt;
  
      &lt;div class=&quot;text-center&quot;&gt;
          &lt;%= form.label :occasion_name, &quot;Occasion Name&quot;, class: &quot;text-red-400 font-semibold px-8&quot; %&gt;&lt;br&gt;
          &lt;%= form.text_field :occasion_name, class: &quot;rounded w-2/5&quot; %&gt;
          &lt;% @occasion.errors.full_messages_for(:occasion_name).each do |message| %&gt;
          &lt;div&gt;&lt;%= message %&gt;&lt;/div&gt;
          &lt;% end %&gt;
      &lt;/div&gt;
  
      &lt;div class=&quot;text-center py-2&quot;&gt;
          &lt;%= form.label :occasion_date, &quot;Occasion Date&quot;, class: &quot;text-red-400 font-semibold px-8&quot; %&gt;&lt;br&gt;
          &lt;%= form.date_field :occasion_date, type: &quot;date&quot;, class: &quot;rounded&quot; %&gt;
          &lt;% @occasion.errors.full_messages_for(:occasion_date).each do |message| %&gt;
          &lt;div&gt;&lt;%= message %&gt;&lt;/div&gt;
          &lt;% end %&gt;
      &lt;/div&gt;
  
      &lt;div class=&quot;text-center py-2&quot;&gt;
          &lt;%= form.label :url, 'URL', class: &quot;text-red-400 font-semibold px-8&quot; %&gt;&lt;br&gt;
          &lt;%= form.text_field :url, class: &quot;rounded&quot; %&gt;
          &lt;% @occasion.errors.full_messages_for(:url).each do |message| %&gt;
          &lt;div&gt;&lt;%= message %&gt;&lt;/div&gt;
          &lt;% end %&gt;
          &lt;em&gt;&lt;div class=&quot;text-sm&quot;&gt;domainname.com/yourURLhere&lt;/div&gt;&lt;/em&gt;
      &lt;/div&gt;
  
      &lt;div class=&quot;text-center py-2&quot;&gt;
          &lt;%= form.submit occasion.persisted? ? 'Update' : 'Save', class: &quot;rounded-full bg-red-400 text-white px-3&quot; %&gt;
      &lt;/div&gt;
  
  &lt;% end %&gt;
  </code></pre>