enju_export 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -64,6 +64,7 @@ class ExportFilesController < ApplicationController
64
64
  # POST /export_files.json
65
65
  def create
66
66
  @export_file = ExportFile.new(params[:export_file])
67
+ @export_file.user = current_user
67
68
 
68
69
  respond_to do |format|
69
70
  if @export_file.save
@@ -1,6 +1,9 @@
1
1
  class ExportFile < ActiveRecord::Base
2
2
  attr_accessible :export_content_type, :export_file_name, :export_file_size, :state
3
3
 
4
+ belongs_to :user
5
+ validates_associated :user_id
6
+
4
7
  has_attached_file :export
5
8
 
6
9
  state_machine :initial => :pending do
@@ -0,0 +1,7 @@
1
+ class PatronExportQueue
2
+ @queue = :patron_export
3
+
4
+ def self.perform(result_ids, columns, export_file_id)
5
+ Patron.generate_csv(result_ids, columns, ExportFile.find(export_file_id))
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ class AddUserIdToExportFile < ActiveRecord::Migration
2
+ def change
3
+ add_column :export_files, :user_id, :integer
4
+ add_index :export_files, :user_id
5
+ end
6
+ end
@@ -2,6 +2,7 @@ require 'state_machine'
2
2
  require 'paperclip'
3
3
  require 'simple_form'
4
4
  require 'will_paginate/array'
5
+ require 'enju_core'
5
6
 
6
7
  module EnjuExport
7
8
  class Engine < ::Rails::Engine
@@ -1,3 +1,3 @@
1
1
  module EnjuExport
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended to check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(:version => 20120610075759) do
14
+ ActiveRecord::Schema.define(:version => 20120621224846) do
15
15
 
16
16
  create_table "export_files", :force => true do |t|
17
17
  t.string "export_file_name"
@@ -20,8 +20,11 @@ ActiveRecord::Schema.define(:version => 20120610075759) do
20
20
  t.string "state"
21
21
  t.datetime "created_at", :null => false
22
22
  t.datetime "updated_at", :null => false
23
+ t.integer "user_id"
23
24
  end
24
25
 
26
+ add_index "export_files", ["user_id"], :name => "index_export_files_on_user_id"
27
+
25
28
  create_table "roles", :force => true do |t|
26
29
  t.string "name"
27
30
  t.text "display_name"
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enju_export
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-19 00:00:00.000000000 Z
12
+ date: 2012-06-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -75,6 +75,22 @@ dependencies:
75
75
  - - ! '>='
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: enju_core
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
78
94
  - !ruby/object:Gem::Dependency
79
95
  name: sqlite3
80
96
  requirement: !ruby/object:Gem::Requirement
@@ -129,10 +145,12 @@ files:
129
145
  - app/views/page/404.html.erb
130
146
  - app/views/page/404.mobile.erb
131
147
  - app/views/page/404.xml.erb
148
+ - app/workers/patron_export_queue.rb
132
149
  - config/locales/translation_en.yml
133
150
  - config/locales/translation_ja.yml
134
151
  - config/routes.rb
135
152
  - db/migrate/20120610075759_create_export_files.rb
153
+ - db/migrate/20120621224846_add_user_id_to_export_file.rb
136
154
  - lib/enju_export/engine.rb
137
155
  - lib/enju_export/version.rb
138
156
  - lib/enju_export.rb