Sha256: d7e632fc15c7de3f5471296d6ea50e1b989b3d14fa15f6d64dfeafc55bfaa706

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base

  include Pictrails::CachingMethods

  helper :all # include all helpers, all the time

  # See ActionController::RequestForgeryProtection for details
  # Uncomment the :secret if you're not using the cookie session store
  #protect_from_forgery :secret => '9d6a74942666a6c164e479585234439c'
  
  before_filter :verify_config
  before_filter :update_size_picture
  before_filter :skip_caching_filter
 

protected

  # Define the webapp by default. The first by Id
  def this_webapp
    @setting ||= Setting.default
  end

  helper_method :this_webapp

  # Verify if it's the first connection in
  # application
  def verify_config
    if User.count.zero?
      redirect_to admin_signup_url
    else
      true
    end
  end

  def update_size_picture
    if Import.picture_update.count > 0
      Import.limited(5).picture_update.each { |import| 
        import.update_size
        @import_picture_update_total = import.total
      }
      @import_picture_update_count = Import.picture_update.count
    end
  end

  def skip_caching_filter
    if flash[:notice]
      @skip_caching = true
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pictrails-0.5.0 app/controllers/application.rb