Browse Source

Improved code layout.

Martin Edenhofer 7 years ago
parent
commit
6f7632c8ea

+ 2 - 2
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,

+ 2 - 2
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,

+ 2 - 2
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' }