Class: Panel::SimilarsController
- Inherits:
-
BaseController
- Object
- BaseController
- Panel::SimilarsController
- Defined in:
- app/controllers/ship/panel/similars_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
15 16 17 18 19 20 21 22 |
# File 'app/controllers/ship/panel/similars_controller.rb', line 15 def create @line_similar = @line.line_similars.build @line_similar.similar_id = params[:similar_id] unless @line_similar.save render :new, locals: { model: @line_similar }, status: :unprocessable_entity end end |
#destroy ⇒ Object
38 39 40 41 |
# File 'app/controllers/ship/panel/similars_controller.rb', line 38 def destroy @line_similar = @line.line_similars.find_by(similar_id: params[:id]) @line_similar.destroy end |
#edit ⇒ Object
27 28 |
# File 'app/controllers/ship/panel/similars_controller.rb', line 27 def edit end |
#index ⇒ Object
6 7 8 |
# File 'app/controllers/ship/panel/similars_controller.rb', line 6 def index @similars = @line.similars.page(params[:page]) end |
#new ⇒ Object
10 11 12 13 |
# File 'app/controllers/ship/panel/similars_controller.rb', line 10 def new @similars = @line.similars.page(params[:page]) @lines = Line.where.not(id: @line.similar_ids).page(params[:page]) end |
#show ⇒ Object
24 25 |
# File 'app/controllers/ship/panel/similars_controller.rb', line 24 def show end |
#update ⇒ Object
30 31 32 33 34 35 36 |
# File 'app/controllers/ship/panel/similars_controller.rb', line 30 def update @similar.assign_attributes(similar_params) unless @similar.save render :edit, locals: { model: @similar }, status: :unprocessable_entity end end |