app/controllers/blogs_controller.rb in wheels-0.0.32 vs app/controllers/blogs_controller.rb in wheels-0.0.33

- old
+ new

@@ -1,17 +1,22 @@ class BlogsController < InheritedResources::Base respond_to :html, :xml - before_filter + before_filter :load_maybe has_scope :tagged_with, :as => :tag belongs_to :user, :optional => true + def load_maybe + unless params[:user_id] + @user = (current_user || User.root) + end + end + def collection @blogs ||= end_of_association_chain. paginate(:page => params[:page], :order => 'created_at DESC' ) end def begin_of_association_chain - @user ||= (current_user || User.root) @tags = Blog.where(:user_id=>@user.id).tag_counts.sort{|t, u| t.count <=> u.count} return @user end end