teja

Joined

50 Experience
0 Lessons Completed
0 Questions Solved

Activity

Posted in How do I do the following in a better way?

How can I write the following code in better way

if author.present?
    Article.where(category:  params[:category], author_id: author.id)
else
    Article.where(category:  params[:category])
end
logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2021 GoRails, LLC. All rights reserved.