diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d83690e..3d57e55 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,5 +1,13 @@ class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception + + helper_method :current_user + + protected + + def current_user + @current_user ||= User.last + end end diff --git a/lib/tasks/user.rake b/lib/tasks/user.rake new file mode 100644 index 0000000..8c10052 --- /dev/null +++ b/lib/tasks/user.rake @@ -0,0 +1,11 @@ +namespace :user do + desc 'Create a temp user for development reasons' + task :generate_user => :environment do |t| + + u = User.new + u.username = 'baas_dev' + u.email = 'baas_dev@example.com' + u.user_type = :admin + u.save + end +end