diff options
| author | cedricnjanga | 2017-07-13 15:40:36 +0200 |
|---|---|---|
| committer | cedricnjanga | 2017-07-13 15:40:36 +0200 |
| commit | 2a336a095c028d0864b4fda140e47569a20c7a87 (patch) | |
| tree | d53dbbb8f3b71f5d67e5c1bdfbde8311503d4856 | |
| parent | 6af57dbc8b61c04db99e87eb5fabe9386e5ce94a (diff) | |
| parent | 20610cb69f5d6c27c7874c48bda39f9857720d1b (diff) | |
| download | chouette-core-2a336a095c028d0864b4fda140e47569a20c7a87.tar.bz2 | |
Resolve conflict in index.js file
| -rw-r--r-- | app/controllers/line_footnotes_controller.rb | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/app/controllers/line_footnotes_controller.rb b/app/controllers/line_footnotes_controller.rb index 6a9048392..f24d624d4 100644 --- a/app/controllers/line_footnotes_controller.rb +++ b/app/controllers/line_footnotes_controller.rb @@ -1,16 +1,7 @@ -class LineFootnotesController < BreadcrumbController - defaults :resource_class => Chouette::Line - include PolicyChecker - respond_to :json, :only => :show +class LineFootnotesController < ChouetteController + defaults resource_class: Chouette::Line, collection_name: 'lines', instance_name: 'line' belongs_to :referential - def show - show! do - build_breadcrumb :show - end - @footnotes = @line.footnotes - end - def edit edit! do build_breadcrumb :edit @@ -18,25 +9,27 @@ class LineFootnotesController < BreadcrumbController end def update - if @line.update(line_params) - redirect_to referential_line_footnotes_path(@referential, @line) , notice: t('notice.footnotes.updated') - else - render :edit + update! do |success, failure| + success.html { redirect_to referential_line_footnotes_path(@referential, @line) , notice: t('notice.footnotes.updated') } + failure.html { render :edit } end end protected + + alias_method :line, :resource + # overrides default def check_policy authorize resource, "#{action_name}_footnote?".to_sym end - private def resource - @referential = Referential.find params[:referential_id] - @line = @referential.lines.find params[:line_id] + @line ||= current_referential.lines.find params[:line_id] end + private + def line_params params.require(:line).permit( { footnotes_attributes: [ :code, :label, :_destroy, :id ] } ) |
