customize 0.0.1 → 0.0.2

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.
data/README.rdoc CHANGED
@@ -4,22 +4,27 @@
4
4
 
5
5
  customize is an rails engine intend to easy customize rails models with activerecord.
6
6
 
7
+ == Features
8
+
9
+ * characters
10
+ * inherited
11
+ * formula
12
+
7
13
  == Install
8
14
 
9
15
  customize is designed for rails 3.0+
10
16
 
11
17
  to use it, add to Gemfile:
12
18
 
13
- gem 'customize'
19
+ gem 'customize'
14
20
 
15
21
  install bundle:
16
22
 
17
- bundle install
23
+ bundle install
18
24
 
19
25
  generate migrations and other resources:
20
26
 
21
- rails g customize
22
-
27
+ rails g customize
23
28
 
24
29
  = Copyright
25
30
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
data/customize.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "customize"
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ryan Wong"]
@@ -13,7 +13,6 @@ Gem::Specification.new do |s|
13
13
  s.description = "\n\t\teasy customize your domain model, including:\n\t\tcharacterize;\n\t\tinherit;\n\t\tformula\n\t"
14
14
  s.email = "ryan@idolgo.com"
15
15
  s.extra_rdoc_files = [
16
- "README.markdown",
17
16
  "README.rdoc"
18
17
  ]
19
18
  s.files = [
@@ -22,7 +21,6 @@ Gem::Specification.new do |s|
22
21
  "Gemfile",
23
22
  "Gemfile.lock",
24
23
  "MIT-LICENSE",
25
- "README.markdown",
26
24
  "README.rdoc",
27
25
  "Rakefile",
28
26
  "VERSION",
@@ -1,4 +1,4 @@
1
- class Customize:: Character < ActiveRecord::Base
1
+ class Customize::Character < ActiveRecord::Base
2
2
  self.table_name = "customize_characters"
3
3
  serialize :value
4
4
  belongs_to :related, :polymorphic => true
@@ -29,12 +29,13 @@ module Customize
29
29
  end
30
30
 
31
31
  def ascent_ids
32
- @ascent_ids ||=
33
- InheritNode.where("left < :left and right > :right and node_type = :type",
34
- :left=>inherit_node.left, :right=>inherit_node.right, :type=>self.class.name).pluck(:node_id)
32
+ return [] if self.new_record?
33
+ r = InheritNode.where("left < :left and right > :right and node_type = :type",:left=>inherit_node.left, :right=>inherit_node.right, :type=>self.class.name)
34
+ r.pluck(:node_id)
35
35
  end
36
36
 
37
37
  def descent_ids
38
+ return [] if self.new_record?
38
39
  r = InheritNode.where("left > :left and right < :right and node_type = :type",
39
40
  :left=>inherit_node.left, :right=>inherit_node.right, :type=>self.class.name)
40
41
  r.pluck(:node_id)
@@ -1,8 +1,8 @@
1
1
  Description:
2
- Explain the generator
2
+ generate migration and other resource for customize
3
3
 
4
4
  Example:
5
- rails generate customize Thing
5
+ rails generate customize
6
6
 
7
7
  This will create:
8
- what/will/it/create
8
+ migrations
@@ -1,6 +1,6 @@
1
1
  class CreateCustomize < ActiveRecord::Migration
2
2
 
3
- def self.change
3
+ def change
4
4
  create_table :customize_characters do |t|
5
5
  t.string :key
6
6
  t.string :type
@@ -47,6 +47,18 @@ describe Customize::Inherited do
47
47
  @child.ascents.should have(1).items
48
48
  end
49
49
 
50
+ context "new node" do
51
+ subject { Product.new }
52
+
53
+ it "should have [] ascent_ids" do
54
+ subject.ascent_ids.should == []
55
+ end
56
+ it "should have [] descent_ids" do
57
+ subject.descent_ids.should == []
58
+ end
59
+
60
+ end
61
+
50
62
  context "destroy node" do
51
63
  before :each do
52
64
  Product.create.inherit @parent
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: customize
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:
@@ -192,7 +192,6 @@ email: ryan@idolgo.com
192
192
  executables: []
193
193
  extensions: []
194
194
  extra_rdoc_files:
195
- - README.markdown
196
195
  - README.rdoc
197
196
  files:
198
197
  - .rspec
@@ -200,7 +199,6 @@ files:
200
199
  - Gemfile
201
200
  - Gemfile.lock
202
201
  - MIT-LICENSE
203
- - README.markdown
204
202
  - README.rdoc
205
203
  - Rakefile
206
204
  - VERSION
@@ -267,7 +265,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
267
265
  version: '0'
268
266
  segments:
269
267
  - 0
270
- hash: 896325393
268
+ hash: 921921299
271
269
  required_rubygems_version: !ruby/object:Gem::Requirement
272
270
  none: false
273
271
  requirements:
data/README.markdown DELETED
@@ -1,3 +0,0 @@
1
- = Customize
2
-
3
- This project rocks and uses MIT-LICENSE.