friendly_id 3.3.0.alpha1 → 3.3.0.alpha2

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.
@@ -10,6 +10,9 @@ suggestions, ideas and improvements to FriendlyId.
10
10
 
11
11
  * Compatibility with Active Record 3.1 ([Andrew White](https://github.com/pixeltrix))
12
12
  * Gemspec compatibility with RubyGems 1.7 ([Philip Arndt](https://github.com/parndt))
13
+ * Fixed generators for Rails 3.1 ([Matt Burke](https://github.com/spraints))
14
+ * Rake task fix for models with primary keys not named "id" ([Danny Hawkins](https://github.com/danhawkins))
15
+
13
16
 
14
17
  ## 3.2.1 (2011-02-03)
15
18
 
@@ -46,8 +46,9 @@ module FriendlyId
46
46
  # Build the new slug using the generated friendly id.
47
47
  def build_a_slug
48
48
  return unless new_slug_needed?
49
- self.slug = slugs.build(:name => slug_text.to_s, :scope => friendly_id_config.scope_for(self), :sluggable => self)
50
- @new_friendly_id = slug.to_friendly_id
49
+ self.slug = slugs.build :name => slug_text.to_s, :scope => friendly_id_config.scope_for(self),
50
+ :sluggable => self
51
+ @new_friendly_id = self.slug.to_friendly_id
51
52
  end
52
53
 
53
54
  # Reset the cached friendly_id?
@@ -107,4 +108,4 @@ module FriendlyId
107
108
  end
108
109
  end
109
110
  end
110
- end
111
+ end
@@ -30,7 +30,7 @@ module FriendlyId
30
30
  :include => :slug,
31
31
  :limit => (ENV["LIMIT"] || 100).to_i,
32
32
  :offset => 0,
33
- :order => ENV["ORDER"] || "#{klass.table_name}.id ASC",
33
+ :order => ENV["ORDER"] || "#{klass.table_name}.#{klass.primary_key} ASC",
34
34
  }.merge(task_options || {})
35
35
 
36
36
  while records = find(:all, options) do
@@ -3,7 +3,7 @@ module FriendlyId
3
3
  MAJOR = 3
4
4
  MINOR = 3
5
5
  TINY = 0
6
- BUILD = 'alpha1'
6
+ BUILD = 'alpha2'
7
7
  STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.')
8
8
  end
9
9
  end
@@ -5,12 +5,12 @@ class FriendlyIdGenerator < Rails::Generators::Base
5
5
 
6
6
  include Rails::Generators::Migration
7
7
 
8
- MIGRATIONS_FILE = File.join(File.dirname(__FILE__), "..", "..", "generators", "friendly_id", "templates", "create_slugs.rb")
8
+ source_root File.expand_path('../../../generators/friendly_id/templates', __FILE__)
9
9
 
10
10
  class_option :"skip-migration", :type => :boolean, :desc => "Don't generate a migration for the slugs table"
11
11
 
12
12
  def copy_files(*args)
13
- migration_template MIGRATIONS_FILE, "db/migrate/create_slugs.rb" unless options["skip-migration"]
13
+ migration_template 'create_slugs.rb', "db/migrate/create_slugs.rb" unless options["skip-migration"]
14
14
  end
15
15
 
16
16
  # Taken from ActiveRecord's migration generator
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: friendly_id
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: 6
5
- version: 3.3.0.alpha1
5
+ version: 3.3.0.alpha2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Norman Clarke
@@ -12,7 +12,7 @@ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
 
15
- date: 2011-05-13 00:00:00 -03:00
15
+ date: 2011-05-31 00:00:00 -03:00
16
16
  default_executable:
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
@@ -144,7 +144,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
144
144
  requirements:
145
145
  - - ">="
146
146
  - !ruby/object:Gem::Version
147
- hash: 1894634640096086793
147
+ hash: -2814415105810569687
148
148
  segments:
149
149
  - 0
150
150
  version: "0"