how keep activerecord organization dry?
i have an emanate perplexing keep ar finders dry application. i have combined blogging concentration fetches associated pages,posts,links,tags categories blog user initial views it. illustration arrangement movement blog controller shown below:
def show
#find blog user name
@user= user.find_by_login(params[:id])
@blog= @user.blog
@posts = post.status("publish",@user).find(:all, :order => "created_at desc")
@tags = @user.tags
@pages = page.status("publish",@user).find(:all, :order => "created_at desc")
@links = @user.links.public_link.find(:all, :order => 'created_at desc')
@archives = @posts.group_by(&:month)
@categories = @user.categories.group_by(&:name)
session[:found_user]=@user.login
news :layout=>false
end
as unequivocally dry there actions on same instance variables such @tags etc offer controller.
how i some-more dry? i attempted relocating blog denote nonetheless i still need several instance variables such @tags etc controller.
is there proceed store variables blog initial called re-use opposing controllers actions?
thank any advice. i'm controlling rails 2.1
Comments
Post a Comment