Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updated use of friendly_id to 4.x

  • Loading branch information...
commit b8c1f23acb9bab4232c8a4d886d6b141b2fe4ace 1 parent 16fac60
Kristian Mandrup kristianmandrup authored
2  Gemfile
View
@@ -37,7 +37,7 @@ group :test do
# Integration testing
gem 'decent_exposure'
- gem "friendly_id"
+ gem "friendly_id", "~> 4.0.1"
gem "devise", '>= 1.4'
# Rails
6 spec/devise-dummy/app/models/article.rb
View
@@ -1,6 +1,8 @@
class Article < ActiveRecord::Base
- belongs_to :author, :foreign_key => 'user_id', :class_name => "User"
+ extend FriendlyId
- has_friendly_id :title
+ belongs_to :author, :foreign_key => 'user_id', :class_name => "User"
+
+ friendly_id :title #, :use => :slugged
end
4 spec/devise-dummy/app/models/concerto.rb
View
@@ -1,6 +1,8 @@
class Concerto < ActiveRecord::Base
+ extend FriendlyId
+
belongs_to :author, :foreign_key => 'user_id', :class_name => "User"
- has_friendly_id :title
+ friendly_id :title
end
4 spec/devise-dummy/app/models/user.rb
View
@@ -1,4 +1,6 @@
class User < ActiveRecord::Base
+ extend FriendlyId
+
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
@@ -13,7 +15,7 @@ class User < ActiveRecord::Base
tango_user # see macros
- has_friendly_id :name
+ friendly_id :name
has_many :articles
has_many :comments
4 spec/dummy/app/models/article.rb
View
@@ -1,6 +1,8 @@
class Article < ActiveRecord::Base
+ extend FriendlyId
+
belongs_to :author, :foreign_key => 'user_id', :class_name => "User"
- has_friendly_id :title
+ friendly_id :title
end
4 spec/dummy/app/models/concerto.rb
View
@@ -1,6 +1,8 @@
class Concerto < ActiveRecord::Base
+ extend FriendlyId
+
belongs_to :author, :foreign_key => 'user_id', :class_name => "User"
- has_friendly_id :title
+ friendly_id :title
end
4 spec/dummy/app/models/user.rb
View
@@ -1,10 +1,12 @@
class User < ActiveRecord::Base
+ extend FriendlyId
+
include_and_extend SimpleRoles
tango_user # see macros
masquerader
- has_friendly_id :name
+ friendly_id :name
has_many :articles
has_many :comments
Please sign in to comment.
Something went wrong with that request. Please try again.