Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- after_action :create_notifier, only: %I[create]
- after_action :destroy_notifier, only: %I[destroy]
- def destroy
- # authorize Spaceship
- @spaceship.destroy
- respond_to do |format|
- format.html do
- if @spaceship.destroyed?
- flash[:notice] = 'Удалено'
- else
- flash[:alert] = 'Ошибка удаления'
- end
- end
- format.js
- end
- redirect_to spaceships_path
- end
- private
- def create_notifier
- ActionCable.server.broadcast SpaceshipsChannel::TITLE,
- partial: render_to_string(
- partial: "spaceships/spaceship", object: @spaceship
- )
- end
- def destroy_notifier
- ActionCable.server.broadcast SpaceshipsChannel::TITLE,
- partial: render_to_string(
- partial: "spaceships/spaceship", object: @spaceship
- ),
- action: destroy.to_s,
- id: @expedition.id
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement