jclem/active_record_rollout

View on GitHub
app/controllers/detour/features_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage
class Detour::FeaturesController < Detour::ApplicationController
  def create
    @feature = Detour::Feature.new(params[:feature])

    if @feature.save
      flash[:notice] = "Your feature has been successfully created."
      render "detour/shared/success"
    else
      @model = @feature
      render "detour/shared/error"
    end
  end

  def destroy
    @feature = Detour::Feature.find(params[:id])
    @feature.destroy
    flash[:notice] = "Feature #{@feature.name} has been deleted."
    redirect_to flags_path(params[:flaggable_type])
  end
end