OSDN Git Service

user check
[pettanr/pettanr.git] / app / controllers / application_controller.rb
1 class ApplicationController < ActionController::Base
2   protect_from_forgery
3   before_filter :bf
4   
5   def bf
6     if Admin.count.to_i == 0
7       if params[:controller] == 'system' and params[:action] == 'start'
8       else
9         redirect_to :controller => '/system', :action => 'start'
10       end
11     else
12       if user_signed_in?
13         @user = current_user
14         @author = @user.author
15         @artist = if @author and @author.artist?
16           @author.artist
17         else
18           Artist.new author_id: @author.id, email: @user.email, name: @author.name, default_license_id: 1
19         end
20       end
21     end
22   end
23   
24 end