Class: FeaturesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- FeaturesController
- Defined in:
- app/controllers/features_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/controllers/features_controller.rb', line 42 def create @feature = @featureable.features.build(feature_params) respond_to do |format| if @feature.save format.html { redirect_to @featureable, notice: 'Feature was successfully created.' } format.json { render json: @feature, status: :created, location: @feature } else format.html { redirect_to @featureable, alert: @feature.errors..join(',') } format.json { render json: @feature.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
70 71 72 73 74 75 76 77 78 |
# File 'app/controllers/features_controller.rb', line 70 def destroy @feature = Feature.find(params[:id]) @feature.destroy respond_to do |format| format.html { redirect_to @featureable, notice: 'Feature was successfully removed.' } format.json { head :no_content } end end |
#edit ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'app/controllers/features_controller.rb', line 33 def edit @feature = Feature.find(params[:id]) respond_to do |format| format.html format.json { render json: @feature } end end |
#index ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'app/controllers/features_controller.rb', line 6 def index @features = Feature.all respond_to do |format| format.html format.json { render json: @features } end end |
#new ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'app/controllers/features_controller.rb', line 24 def new @feature = @featureable.features.build respond_to do |format| format.html format.json { render json: @feature } end end |
#show ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'app/controllers/features_controller.rb', line 15 def show @feature = Feature.find(params[:id]) respond_to do |format| format.html format.json { render json: @feature } end end |
#update ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'app/controllers/features_controller.rb', line 56 def update @feature = Feature.find(params[:id]) respond_to do |format| if @feature.update(feature_params) format.html { redirect_to @featureable, notice: 'Feature was successfully updated.' } format.json { head :no_content } else format.html { redirect_to @featureable, alert: @feature.errors..join(',') } format.json { render json: @feature.errors, status: :unprocessable_entity } end end end |