friendly urls

This commit is contained in:
jomo
2014-09-22 06:46:08 +02:00
parent e767ec729c
commit 0f0a5c42b9
8 changed files with 37 additions and 2 deletions

View File

@@ -26,6 +26,10 @@ class Blogpost < ActiveRecord::Base
!!user_editor_id
end
def to_s
title
end
def send_new_mention_mail(old_content = "")
new_mentions = mentions(content) - mentions(old_content)
mails = []
@@ -42,4 +46,7 @@ class Blogpost < ActiveRecord::Base
background_mailer(mails)
end
def to_param
[id, to_s.parameterize].join("-")
end
end

View File

@@ -23,4 +23,8 @@ class Forum < ActiveRecord::Base
def can_write?(user)
group.can_write?(user) && can_read?(user) && (role_write.nil? || (!user.nil? && user.role >= role_write))
end
def to_param
[id, to_s.parameterize].join("-")
end
end

View File

@@ -20,4 +20,8 @@ class Forumgroup < ActiveRecord::Base
def can_write?(user)
!user.nil? && can_read?(user) && user.confirmed? && (role_write.nil? || user.role >= role_write)
end
def to_param
[id, to_s.parameterize].join("-")
end
end

View File

@@ -57,4 +57,8 @@ class Forumthread < ActiveRecord::Base
end
background_mailer(mails)
end
def to_param
[id, to_s.parameterize].join("-")
end
end

View File

@@ -3,4 +3,12 @@ class Info < ActiveRecord::Base
validates_presence_of :title, :content
def to_s
title
end
def to_param
[id, to_s.parameterize].join("-")
end
end

View File

@@ -80,6 +80,10 @@ class User < ActiveRecord::Base
return image_tag("https://minotar.net/helm/#{CGI.escape(self.ign)}/#{CGI.escape(size.to_s)}", options)
end
def to_s
ign
end
#check if this user is an idiot and uses their mc password.
@@ -176,6 +180,10 @@ class User < ActiveRecord::Base
end
def to_param
[id, to_s.parameterize].join("-")
end