I am fairly new to Rails.
I want to track how often a post is read in order to rank them in order of popularity. Therefore, I will have a database column read_cou
One of the below answers is probably a better way, but to answer your question of how to pass extra params. You can just add them to the end of your url helper, so if your existing link looks like:
link_to 'Show', post_path(id)
just change it to:
link_to 'Show', post_path(id) + '?preview=true'
What about doing something like:
@post.read_count.increment! unless user_signed_in? && current_user.admin?
Why not instead of sending a param you do it through the controller action itself? If it is hit and is not admin then increment the count, seems like a simpler solution.