Forum: Ruby on Rails read-only access to database?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A2a651597cb2d30b81d1ea56ae472062?d=identicon&s=25 cal (Guest)
on 2006-02-11 09:12
(Received via mailing list)
I have a model (Query) which I use to, of all things, query the
database.  This
is to enable raw SQL access.  I want to ensure that db access using this
model
is read-only.  Short of checking the sql query for 'insert' and 'drop'
and
'update', is there a more rails-like way of doing this in my
app/models/query.rb
itself?

Thanks in advance,

cal
119af50160cabfe1fb6f2f05f5018c64?d=identicon&s=25 James Ludlow (Guest)
on 2006-02-11 15:56
(Received via mailing list)
On 2/10/06, cal <charles@lesburg.com> wrote:
> I have a model (Query) which I use to, of all things, query the database.  This
> is to enable raw SQL access.  I want to ensure that db access using this model
> is read-only.  Short of checking the sql query for 'insert' and 'drop' and
> 'update', is there a more rails-like way of doing this in my app/models/query.rb
> itself?

You could have it use a separate database connection that logs in as a
user with read-only access in your database.
45e815356bbcbb7bc165235679cd160d?d=identicon&s=25 Tirta K. Untario (Guest)
on 2006-02-13 07:23
(Received via mailing list)
How can we use seperate db connection since there's only 1 account per
environment? Does anyone already try this?

--
Tirta K. Untario
Af93ba6b6b59f22a8f37e8de5702ef98?d=identicon&s=25 Bob Silva (Guest)
on 2006-02-13 07:28
(Received via mailing list)
Models can be set to readonly. View the docs.

Bob Silva
http://www.railtie.net/
This topic is locked and can not be replied to.