diff options
| author | cedricnjanga | 2017-09-28 16:57:01 +0200 | 
|---|---|---|
| committer | cedricnjanga | 2017-09-28 18:15:01 +0200 | 
| commit | 40c8df4c8594f13176d1ab58d972e40e0d6695a2 (patch) | |
| tree | d78428ce8985883d8d9a9010017668082aabff43 /app/controllers | |
| parent | 0d12e059377f4fde0fc67d31e8a0dbbe10b8e914 (diff) | |
| download | chouette-core-40c8df4c8594f13176d1ab58d972e40e0d6695a2.tar.bz2 | |
Refs #4634 Create ComplianceControlBlocksController and adapt models
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/compliance_control_blocks_controller.rb | 36 | 
1 files changed, 36 insertions, 0 deletions
diff --git a/app/controllers/compliance_control_blocks_controller.rb b/app/controllers/compliance_control_blocks_controller.rb new file mode 100644 index 000000000..cce074e46 --- /dev/null +++ b/app/controllers/compliance_control_blocks_controller.rb @@ -0,0 +1,36 @@ +class ComplianceControlBlocksController < BreadcrumbController +  defaults resource_class: ComplianceControlBlock +  belongs_to :compliance_control_set + +  def new +    @compliance_control_set = parent +    @compliance_control_block = ComplianceControlBlock.new(compliance_control_set: @compliance_control_set) +  end + +  def create +    create! do |success, failure| +      success.html { redirect_to compliance_control_set_path(@compliance_control_set) }   +      failure.html { render :action => :new } +    end +  end + +  def update +    update! do |success, failure| +      success.html { redirect_to compliance_control_set_path(@compliance_control_set) }   +      failure.html { render :action => :edit } +    end  +  end + +  private + +  def create_resource compliance_control_block +    binding.pry +    compliance_control_block.transport_mode = params[:compliance_control_block][:transport_mode] +    super +  end + +  def compliance_control_block_params +    params.require(:compliance_control_block).permit(:transport_mode) +  end + +end
\ No newline at end of file  | 
