Jump to content

The ultimate community for Ruby on Rails developers.


Photo

Settings a rails application to read only through MYSQL

mysql

  • Please log in to reply
3 replies to this topic

#1 Vell

Vell

    Dispatcher

  • Members
  • 42 posts
  • LocationWashington, DC

Posted 05 February 2014 - 07:37 PM

Hello all,

 

I am looking to figure out how I can set a rails application to read only only through MYSQL. I know that rails needs to write somethings to the DB to function. Is there a place that lists what that is so that I have rails only write to those but not allow the user to enter any data to the rest of the system?



#2 Adam21e

Adam21e

    Passenger

  • Members
  • 1 posts

Posted 10 February 2014 - 09:48 PM

It depends on your app, a simple enough app would never need to write to the DB until a specific action was called that required data to be changed (create/update/delete).

 

Typically an gem like Devise for user management will always be updating the user tables as users log in/out.

 

Though if you remove any create/update/delete actions in your controllers and anything you have in your models, then users won't be able to create anything so effectively it makes the app 'read only' which would also protect the DB.

 

Another alternative is to backup the mysqldb and have it restored and overwrite the existing db so that any changes that are made won't last and will be wiped.



#3 Vell

Vell

    Dispatcher

  • Members
  • 42 posts
  • LocationWashington, DC

Posted 11 February 2014 - 02:50 PM

Thanks Adam21e. I was hoping there was a way to do this just in the DB so that way I didn't have to modify any code. Was hoping to take the easy way out :). But your logic makes sense and we do use Devise so that is probably what is causing the writes to the system. I thought rails even in its Vanilla form might have been writing a small something to the DB that I might have missed.



#4 DavidPlant

DavidPlant

    Passenger

  • Members
  • 2 posts

Posted 24 February 2014 - 01:17 PM

Using MySQL views in a Ruby on Rails app to improve performance ....tables as far as you only use them to read the records.......

 

Wholesale Branded Clothing

 

Wholesale Clothing Suppliers





Also tagged with one or more of these keywords: mysql

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users