Sha256: fe72cd76351d87bddf718f49c2a132e0b5ecaeaf02b51078b44be38ef74319c6

Contents?: true

Size: 802 Bytes

Versions: 2

Compression:

Stored size: 802 Bytes

Contents

Application.class_eval do
  
  get '/tests/:id/destroy' do
    restrict
    @test = ABTest.find params[:id]
    if @test
      @test.destroy
      flash[:success] = 'Test deleted successfully.'
    else
      flash[:error] = 'Could not delete test.'
    end
    redirect '/'
  end
  
  post '/tests/:id/update' do
    restrict
    @test = ABTest.find params[:id]
    if @test
      @test.update_attributes params[:test]
      flash[:success] = 'Test updated successfully.'
    else
      flash[:error] = 'Could not update test.'
    end
    redirect '/'
  end
  
  post '/tests/create' do
    restrict
    @test = ABTest.create params[:test]
    if @test.id
      flash[:success] = 'Test created successfully.'
    else
      flash[:error] = 'Could not create test.'
    end
    redirect '/'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
a_b-0.1.1 lib/a_b/controller/tests.rb
a_b-0.1.0 lib/a_b/controller/tests.rb