- Provide the models required
- Each article can be related to many articles (or none).Provide code
for making @article.related_articles work - Clean up the code according to rails conventions
class ArticleController < ApplicationController
def show
@article = Article.find(params[:id])
if current_user.roles.map {|r| r.to_s}.include?(‘admin’)
@info = Info.find(:first, :conditions => “article_id =
#{@article.id}”)
else
@info = nil
end
if params[:show_comments] && params[:show_comments] != ‘’
@comments = Comment.find(:first, :conditions => “article_id =
#{@article.id}”)
end
if !(params[:hide_related] && params[:hide_related] != ‘’)
@related_articles = @article.related_articles
end
end
end
What will be the solution for the above issue?