diff --git a/app/api/mobile/entities/user.rb b/app/api/mobile/entities/user.rb index 1f52ae841..9112e7ec5 100644 --- a/app/api/mobile/entities/user.rb +++ b/app/api/mobile/entities/user.rb @@ -15,13 +15,13 @@ module Mobile when :img_url url_to_avatar(u) when :gender - u.user_extensions.gender.nil? ? 0 : u.user_extensions.gender + u.nil? || u.user_extensions.nil? || u.user_extensions.gender.nil? ? 0 : u.user_extensions.gender when :work_unit get_user_work_unit u when :location get_user_location u when :brief_introduction - u.user_extensions.brief_introduction + u.nil? || u.user_extensions.nil? ? "" : u.user_extensions.brief_introduction end end end diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index a96bc0fbe..aa216d755 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -345,7 +345,7 @@ class CoursesService def course_dynamic(params,current_user) @user = User.find(params[:id]) - if !current_user.admin? && !@user.active? + if current_user.nil? && !current_user.admin? && !@user.active? raise '404' return end diff --git a/db/migrate/20150415032102_change_file_digests.rb b/db/migrate/20150415032102_change_file_digests.rb new file mode 100644 index 000000000..a8fe5febf --- /dev/null +++ b/db/migrate/20150415032102_change_file_digests.rb @@ -0,0 +1,9 @@ +class ChangeFileDigests < ActiveRecord::Migration + def up + change_column :zip_packs, :file_digests, :text + end + + def down + change_column :zip_packs, :file_digests, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index a8ade8ed0..e4c11e8ce 100644 --- 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 => 20150402015402) do +ActiveRecord::Schema.define(:version => 20150415032102) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -1458,7 +1458,7 @@ ActiveRecord::Schema.define(:version => 20150402015402) do t.string "file_path" t.integer "pack_times", :default => 1 t.integer "pack_size", :default => 0 - t.string "file_digests" + t.text "file_digests" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false end