1 class ApplicationController < ActionController::Base
3 layout :devise_layout if MagicNumber['test_layout']
21 :location => {:controller => params[:controller], :action => params[:action]}
23 @server_result[:location][:id] = params[:id] if params[:id]
24 if Admin.count.to_i == 0 or License.count.to_i == 0
25 if params[:controller] == 'system' and params[:action] == 'start'
27 redirect_to :controller => '/system', :action => 'start'
32 @author = @user.author
33 @artist = if @author and @author.artist?
39 @admin = if admin_signed_in?
47 def authenticate_author
51 respond_to do |format|
52 format.html { redirect_to main_app.new_author_path, :status => :found }
53 format.js { render "authors/new" }
55 raise ActiveRecord::Forbidden
62 def authenticate_artist
66 respond_to do |format|
67 format.html { redirect_to main_app.new_artist_path, :status => :found }
68 format.js { render "artists/new" }
70 raise ActiveRecord::Forbidden
78 if file.respond_to?(:read)
81 Base64.decode64(file.to_s.gsub(' ', '+'))
86 rescue_from ActiveRecord::RecordNotFound, :with => :render_404
89 def render_404(exception = nil)
91 logger.info "Rendering 404: #{exception.message}"
93 respond_to do |format|
95 render :file => "#{Rails.root}/public/404.html", :status => 404, :layout => false
98 render :text => "404 found", :status => 404