Attendance update route can now take a reason from params. Updates #78

Also not tested. All I could do in a few minutes before going to work. 

- Created a new Attendance controller and pointed update route to it
- Passed in `reason` param to `flake!` method as part of opts and assigned it
to the record. 

This could use a unit test for `flake` and a feature spec as well. I'll see if I can
do it tonight :)
Yup, that would cause the issue. Basically whatever the parent resource of
the route is wins `:id` IIRC

On Tue, Sep 30, 2014 at 11:10 PM, Mehul Kar <notifications@github.com>
wrote:

> In app/controllers/attendance_controller.rb:
>
> > +  def update
> > +    respond_to do |format|
> > +      if @attendance.flake!({reason: params[:attendance][:reason]})
> > +        format.html { redirect_to profile_path, notice: 'Your spot is now open for someone else!' }
> > +        format.json { render :show, status: :created, location: @tea_time }
> > +      else
> > +        format.html { redirect_to profile_path }
> > +        format.json { render json: @attendance.errors, status: :unprocessable_entity }
> > +      end
> > +    end
> > +  end
> > +
> > +  private
> > +
> > +  def set_attendance
> > +    @tea_time = params[:id]
>
> ah ok, I was looking at another project and I guess we have the route
> defined slightly differently. The following produces the situation I was
> talking about:
>
> resources :teatimes do
>   resources :attendances, only: [:show]
> end
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/TeaWithStrangers/tws-on-rails/pull/248/files#r18262675>
> .
>