Rails - how can I query the db w/o touching the sessions table
Posted
by sa125
on Stack Overflow
See other posts from Stack Overflow
or by sa125
Published on 2010-05-17T11:06:13Z
Indexed on
2010/05/17
11:10 UTC
Read the original article
Hit count: 386
ruby-on-rails
|sessions
Hi -
I'm trying to provide a HTTP api to my app that queries a db that's read-only (for replication purposes). I find that my app crashes repeatedly when making a request b/c the call is trying to update the sessions table whenever I query the db. This doesn't happen when I return some text without hitting the database for info.
class APIController < AplicationController
def view
data = Product.find(params[:id]).to_json # will fail
data = { :one => 1, :two => 2 }.to_json # will succeed
respond_to do |format|
format.html { render :json => data }
end
end
end
How do I restrict it from touching the sessions table on this request (it's currently issuing an UPDATE on the updated_at field for that session). thanks.
© Stack Overflow or respective owner