class MashesController < ApplicationController def redirect_to_new flash[:notice] = 'Sneaky pete.' redirect_to(:action => 'new') end alias_method :index, :redirect_to_new alias_method :show, :redirect_to_new def new @map_a, @map_b = Map.pair @mash = Mash.new( :requester => request.remote_ip, :map_a => @map_a.id, :map_b => @map_b.id, :winner => @map_a.id ) respond_to do |format| format.html end end def create mash_params = params[:mash] mash_params[:requester] = request.remote_ip logger.info("Got mash params: #{mash_params.inspect}") @mash = Mash.new(mash_params) @winner = Map.find(@mash.winner) @winner.points += 1 respond_to do |format| if @mash.save && @winner.save flash[:notice] = 'Mash was successfully created.' format.html { redirect_to(:action => 'new') } else format.html { render :action => 'new' } end end end end