djanowski-permalink_fu 0.1.3 → 0.1.4

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.
@@ -0,0 +1,3 @@
1
+ Dir[File.join(File.dirname(__FILE__), '/../../tasks/**/*.rake')].each do |f|
2
+ load f
3
+ end
data/lib/permalink_fu.rb CHANGED
@@ -99,9 +99,13 @@ protected
99
99
  if send(self.class.read_inheritable_attribute(:permalink_field)).to_s.empty?
100
100
  send("#{self.class.read_inheritable_attribute(:permalink_field)}=", create_permalink_for(self.class.read_inheritable_attribute(:permalink_attributes)))
101
101
  end
102
+
102
103
  limit = self.class.columns_hash[self.class.read_inheritable_attribute(:permalink_field)].limit
103
104
  base = send("#{self.class.read_inheritable_attribute(:permalink_field)}=",
104
105
  send(self.class.read_inheritable_attribute(:permalink_field))[0..limit - 1])
106
+
107
+ return unless self.class.read_inheritable_attribute(:permalink_options)[:param]
108
+
105
109
  counter = 1
106
110
  # oh how i wish i could use a hash for conditions
107
111
  conditions = ["#{self.class.read_inheritable_attribute(:permalink_field)} = ?", base]
@@ -118,6 +122,7 @@ protected
118
122
  conditions[1] = "#{base[0..limit-suffix.size-1]}#{suffix}"
119
123
  send("#{self.class.read_inheritable_attribute(:permalink_field)}=", conditions[1])
120
124
  end
125
+ send("#{self.class.read_inheritable_attribute(:permalink_field)}")
121
126
  end
122
127
 
123
128
  def create_permalink_for(attr_names)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: djanowski-permalink_fu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damian Janowski
@@ -22,6 +22,7 @@ extensions: []
22
22
  extra_rdoc_files:
23
23
  - README.textile
24
24
  files:
25
+ - lib/permalink_fu/rake/tasks.rb
25
26
  - lib/permalink_fu/spec/matchers.rb
26
27
  - lib/permalink_fu.rb
27
28
  - init.rb