title: Unable to save or update ticket status
body: <p>I'm creating a ticket booking app for my sample project using Ruby on Rails 4.1. Three are three models - Events, Tickets and Bookings. Events have many tickets and bookings. Tickets have many bookings and they belong to events. Bookings belongs to events and tickets.</p>
  
  <p>Here's the ticket model:</p>
  
  <pre><code>class Ticket &lt; ActiveRecord::Base
   belongs_to :event
   has_many :bookings
  
   before_create :check_start_date
   before_update :check_start_date
  
  def self.check_start_date
   if self.booking_start_date == Date.today
      self.update_attribute(:status =&gt; 'Open')
  end
  end
  </code></pre>
  
  <p>The ticket controller:</p>
  
  <pre><code> class TicketsController &lt; ApplicationController
  
  def index
      @event = Event.find(params[:event_id])
      @tickets = @event.tickets.all
  end
  
  def show
      @event = Event.find(params[:event_id])
      @ticket = @event.tickets.find(params[:id])
  end
  
  def new
      @event = Event.find(params[:event_id])
      @ticket = Ticket.new
  end
  
  def create
      @event = Event.find(params[:event_id])
      @ticket = @event.tickets.create(ticket_params)
      if @ticket.save
          redirect_to [@event, @ticket]
      else
          render 'new'
      end
  end
  
  def edit
      @event = Event.find(params[:event_id])
      @ticket= @event.tickets.find(params[:id])
  end
  
  def update
      @event = Event.find(params[:event_id])
      @ticket = @event.tickets.find(params[:id])
  
      if @ticket.update(ticket_params)
          redirect_to [@event, @ticket]
      else
          render 'edit'
      end
  end
  
  def destroy
      @event = Event.find(params[:event_id])
      @ticket = @event.tickets.find(params[:id])
      @ticket.destroy
      redirect_to event_tickets_path
  end
  
  private
  
  def ticket_params
      params.require(:ticket).permit(:ticket_name, :booking_start_date, :booking_end_date, :ticket_price, :ticket_quantity, :minimum_quantity, :maximum_quantity, :terms_conditions, :more_information, :status)
  end
  </code></pre>
  
  <p>end</p>
  
  <p>The form partial:</p>
  
  <pre><code>&lt;%= form_for ([@event, @ticket]) do |f| %&gt;
          &lt;%= f.label :ticket_name %&gt;
          &lt;%= f.text_field :ticket_name %&gt;
  
          &lt;%= f.label :booking_start_date %&gt;
          &lt;%= f.datetime_select :booking_start_date %&gt;
  
          &lt;%= f.label :booking_end_date %&gt;
          &lt;%= f.datetime_select :booking_end_date %&gt;
  
          &lt;%= f.label :ticket_price %&gt;
          &lt;%= f.text_field :ticket_price %&gt;
  
          &lt;%= f.label :ticket_quantity %&gt;
          &lt;%= f.text_field :ticket_quantity %&gt;
  
          &lt;%= f.label :minimum_quantity %&gt;
          &lt;%= f.text_field :minimum_quantity %&gt;
  
          &lt;%= f.label :maximum_quantity %&gt;
          &lt;%= f.text_field :maximum_quantity %&gt;
  
          &lt;%= f.label :terms_contitions %&gt;
          &lt;%= f.text_area :terms_conditions %&gt;
  
          &lt;%= f.label :more_information %&gt;
          &lt;%= f.text_area :more_information %&gt;
          &lt;%= f.hidden_field :status %&gt;
          &lt;%= f.submit 'Create Ticket' %&gt;
  </code></pre>
  
  
  
  <p>I use a hidden field for :status in the form partial and I'm trying to update the value to open or closed based on the model method check_start_date. But, I'm not able to create or update tickets and I get a No Method Error in Tickets Controller, undefined method `check_start_date'. </p>
  
  <p>Where am I going wrong? Is using a hidden field and a model method to update it's status the right way to do this?</p>