我正在尝试清理我的控制器,我认为最好将此逻辑保留在模型中:
@current_issue = Issue.order(:id).last
@doc = Doc.new do |n|
n.user_id = current_user.ftp
n.season = Date::MONTHNAMES[Time.now.month].to_s + " " + Time.now.year.to_s
n.article1_body = @current_issue.articles[0].body
n.article2_body = @current_issue.articles[1].body
n.article3_body = @current_issue.articles[2].body
n.cover = @current_issue.cover
n.message = @current_issue.message
n.issue_code = @current_issue.issue_code
end
@issues = Issue.get_em_boys
这样做的最佳方法是什么?