Class: Plug::FeaturesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/plug/features_controller.rb

Instance Method Summary collapse

Instance Method Details

#create ⇒ Object

POST /features



30
31
32
33
34
35
36
37
38
# File 'app/controllers/plug/features_controller.rb', line 30

def create
  @feature = Feature.new(feature_params)

  if @feature.save
    redirect_to @feature, notice: 'Feature was successfully created.'
  else
    render :new
  end
end

#destroy ⇒ Object

DELETE /features/1



50
51
52
53
# File 'app/controllers/plug/features_controller.rb', line 50

def destroy
  @feature.destroy
  redirect_to features_url, notice: 'Feature was successfully destroyed.'
end

#edit ⇒ Object

GET /features/1/edit



26
27
# File 'app/controllers/plug/features_controller.rb', line 26

def edit
end

#index ⇒ Object

GET /features



12
13
14
# File 'app/controllers/plug/features_controller.rb', line 12

def index
  @features = Feature.all
end

#new ⇒ Object

GET /features/new



21
22
23
# File 'app/controllers/plug/features_controller.rb', line 21

def new
  @feature = Feature.new
end

#show ⇒ Object

GET /features/1



17
18
# File 'app/controllers/plug/features_controller.rb', line 17

def show
end

#update ⇒ Object

PATCH/PUT /features/1



41
42
43
44
45
46
47
# File 'app/controllers/plug/features_controller.rb', line 41

def update
  if @feature.update_attributes(feature_params)
    redirect_to @feature, notice: 'Feature was successfully updated.'
  else
    render :edit
  end
end