# HG changeset patch # User Nattee Niparnan # Date 2015-08-27 13:44:25 # Node ID 32578781bde78c9ac8b77d6a0b73c460b82a77b6 # Parent dfe79b5eef357f602b402aee5ccb0c3e0b078fd6 add submission view loggin diff --git a/app/controllers/graders_controller.rb b/app/controllers/graders_controller.rb --- a/app/controllers/graders_controller.rb +++ b/app/controllers/graders_controller.rb @@ -86,7 +86,7 @@ @formatted_code = formatter.format(lexer.lex(@submission.source)) @css_style = Rouge::Themes::ThankfulEyes.render(scope: '.highlight') - SubmissionLogView.create(user_id: user.id,submission_id: @submission.id) + SubmissionViewLogs.create(user_id: session[:user_id],submission_id: @submission.id) end diff --git a/db/migrate/20150827133841_add_last_ip_to_user.rb b/db/migrate/20150827133841_add_last_ip_to_user.rb new file mode 100644 --- /dev/null +++ b/db/migrate/20150827133841_add_last_ip_to_user.rb @@ -0,0 +1,5 @@ +class AddLastIpToUser < ActiveRecord::Migration + def change + add_column :users, :last_ip, :string + end +end diff --git a/db/schema.rb b/db/schema.rb --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20150827131927) do +ActiveRecord::Schema.define(:version => 20150827133841) do create_table "announcements", :force => true do |t| t.string "author" @@ -249,6 +249,7 @@ t.string "section" t.boolean "enabled", :default => true t.string "remark" + t.string "last_ip" end add_index "users", ["login"], :name => "index_users_on_login", :unique => true