From 6f7632c8ea1f5406a59491b75572c65339a70f2e Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sat, 17 Jun 2017 01:02:13 +0200 Subject: [PATCH] Improved code layout. --- app/controllers/first_steps_controller.rb | 4 ++-- app/controllers/form_controller.rb | 4 ++-- app/controllers/recent_view_controller.rb | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/first_steps_controller.rb b/app/controllers/first_steps_controller.rb index 9136a5eb4..e6641e272 100644 --- a/app/controllers/first_steps_controller.rb +++ b/app/controllers/first_steps_controller.rb @@ -185,12 +185,12 @@ class FirstStepsController < ApplicationController raw: true, ) UserInfo.current_user_id = customer.id - ticket = Ticket.create( + ticket = Ticket.create!( group_id: Group.find_by(active: true, name: 'Users').id, customer_id: customer.id, title: result[:subject], ) - article = Ticket::Article.create( + article = Ticket::Article.create!( ticket_id: ticket.id, type_id: Ticket::Article::Type.find_by(name: 'phone').id, sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id, diff --git a/app/controllers/form_controller.rb b/app/controllers/form_controller.rb index 13804e9d6..664f34f5d 100644 --- a/app/controllers/form_controller.rb +++ b/app/controllers/form_controller.rb @@ -97,12 +97,12 @@ class FormController < ApplicationController # set current user UserInfo.current_user_id = customer.id - ticket = Ticket.create( + ticket = Ticket.create!( group_id: 1, customer_id: customer.id, title: params[:title], ) - article = Ticket::Article.create( + article = Ticket::Article.create!( ticket_id: ticket.id, type_id: Ticket::Article::Type.find_by(name: 'web').id, sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id, diff --git a/app/controllers/recent_view_controller.rb b/app/controllers/recent_view_controller.rb index 9f54e2be4..bd1b275d3 100644 --- a/app/controllers/recent_view_controller.rb +++ b/app/controllers/recent_view_controller.rb @@ -19,7 +19,7 @@ curl http://localhost/api/v1/recent_view -v -u #{login}:#{password} -H "Content- =end def index - recent_viewed = RecentView.list_full( current_user, 10 ) + recent_viewed = RecentView.list_full(current_user, 10) # return result render json: recent_viewed @@ -46,7 +46,7 @@ curl http://localhost/api/v1/recent_view -v -u #{login}:#{password} -H "Content- def create - RecentView.log( params[:object], params[:o_id], current_user ) + RecentView.log(params[:object], params[:o_id], current_user) # return result render json: { message: 'ok' }