forked from ewildgoose/active_scaffold_export
-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.rb
executable file
·26 lines (22 loc) · 1.04 KB
/
init.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Make sure that ActiveScaffold has already been included
ActiveScaffold rescue throw "should have included ActiveScaffold plug in first. Please make sure that this plug-in comes alphabetically after the ActiveScaffold plug-in"
# Load our overrides
require "#{File.dirname(__FILE__)}/lib/active_scaffold/config/core.rb"
require "#{File.dirname(__FILE__)}/lib/active_scaffold/config/export.rb"
require "#{File.dirname(__FILE__)}/lib/active_scaffold/actions/export.rb"
require "#{File.dirname(__FILE__)}/lib/active_scaffold/helpers/view_helpers_override.rb"
require "#{File.dirname(__FILE__)}/lib/active_scaffold/helpers/export_helpers.rb"
##
## Run the install script, too, just to make sure
## But at least rescue the action in production
##
begin
require File.dirname(__FILE__) + '/install'
rescue
raise $! unless RAILS_ENV == 'production'
end
# Add the csv mime type
Mime::Type.register 'text/csv', :csv
Mime::Type.register 'application/vnd.ms-excel', :xls
# Register our helper methods
ActionView::Base.send(:include, ActiveScaffold::Helpers::ExportHelpers)