ticketable 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,12 +2,13 @@ class CreateTickets < ActiveRecord::Migration
|
|
2
2
|
def change
|
3
3
|
create_table :tickets do |t|
|
4
4
|
t.references :<%= name.singularize.downcase %>
|
5
|
-
t.integer :status
|
5
|
+
t.integer :status, default: 0
|
6
6
|
t.text :content
|
7
7
|
t.references :ticketable, polymorphic: true
|
8
8
|
|
9
9
|
t.timestamps
|
10
10
|
end
|
11
11
|
add_index :tickets, :<%= name.singularize.downcase %>_id
|
12
|
+
add_index :tickets, :status
|
12
13
|
end
|
13
14
|
end
|
@@ -2,4 +2,17 @@ class Ticket < ActiveRecord::Base
|
|
2
2
|
belongs_to :<%= name.singularize.downcase %>
|
3
3
|
belongs_to :ticketable, polymorphic: true
|
4
4
|
attr_accessible :status, :content, :ticketable
|
5
|
+
attr_accessible :<%= name.singularize.downcase %>_id
|
6
|
+
|
7
|
+
[:open, :in_progress, :close].each_with_index do |status, i|
|
8
|
+
define_method "is_#{status.to_s}?" do
|
9
|
+
self.status == i
|
10
|
+
end
|
11
|
+
|
12
|
+
define_method "#{status}!" do
|
13
|
+
self.update_attribute :status, i
|
14
|
+
end
|
15
|
+
|
16
|
+
scope status.to_s.pluralize.to_sym, -> { where(status: i) }
|
17
|
+
end
|
5
18
|
end
|
data/lib/ticketable/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ticketable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
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: 2013-01-
|
12
|
+
date: 2013-01-28 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Make every ressource as a ticket with a status and a brief
|
15
15
|
email:
|