Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* Clean up Rails 3 specific deprecation warnings.

  • Loading branch information...
commit 26a6f2ee71ff1e09dc27ab5cc759d3f74be9ce25 1 parent 6cfe38e
@peakpg peakpg authored
View
2  app/models/blog.rb
@@ -8,7 +8,7 @@ class Blog < ActiveRecord::Base
validates_presence_of :name
validates_uniqueness_of :name
- named_scope :editable_by, lambda { |user|
+ scope :editable_by, lambda { |user|
if user.able_to?(:administrate)
{ }
else
View
4 app/models/blog_comment.rb
@@ -4,7 +4,9 @@ class BlogComment < ActiveRecord::Base
validates_presence_of :post_id, :author, :body
- def before_create
+ before_create :publish_if_comments_are_enabled
+
+ def publish_if_comments_are_enabled
self.published = true unless post.blog.moderate_comments?
end
View
4 app/models/blog_post.rb
@@ -26,13 +26,13 @@ def set_attachment_section
before_validation :set_slug
validates_presence_of :name, :slug, :blog_id, :author_id
- named_scope :published_between, lambda { |start, finish|
+ scope :published_between, lambda { |start, finish|
{ :conditions => [
"blog_posts.published_at >= ? AND blog_posts.published_at < ?",
start, finish ] }
}
- named_scope :not_tagged_with, lambda { |tag| {
+ scope :not_tagged_with, lambda { |tag| {
:conditions => [
"blog_posts.id not in (
SELECT taggings.taggable_id FROM taggings
View
5 app/portlets/blog_posts_portlet.rb
@@ -1,5 +1,8 @@
class BlogPostsPortlet < Portlet
- def after_initialize
+
+ after_initialize :build_permalink_code
+
+ def build_permalink_code
self.render_blog_post_code ||= 'truncate(blog_post.name, 30)'
end
Please sign in to comment.
Something went wrong with that request. Please try again.