Class: CacheableFlash::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/cacheable_flash/install/install_generator.rb

Overview

Copies javascript libraries flash.js and js.cookie.js to public/javascripts/ (Rails 3.0.X only, Rails 3.1 has asset pipeline)

Examples:

$ rails generate cacheable_flash:install

Instance Method Summary collapse

Instance Method Details

#copy_filesObject



15
16
17
18
19
20
21
22
# File 'lib/generators/cacheable_flash/install/install_generator.rb', line 15

def copy_files
  # Also raise this deprecation in rails 4
  if (::Rails::VERSION::MAJOR == 3 && ::Rails::VERSION::MINOR >= 1) || ::Rails::VERSION::MAJOR > 3
    ActiveSupport::Deprecation.warn("Rails 3.1 has the asset pipeline, so you only need to copy javascript files if you aren't using it.")
  end
  template 'flash.js',     'public/javascripts/flash.js'
  template 'js.cookie.js', 'public/javascripts/js.cookie.js'
end