0

I was wondering if there was a "proper" way to use RoR's MVC for doing all CRUD actions through something like rest_client. I won't have access to the DB but rather rest requests to do all CRUD actions.

Is there any way to define a model that contains all of the json data that would be returned on a get and put that into a model that can use Model.Save, Model.Create etc like a regular RoR application?

Would creating new methods def save, def create inside the ApplicationController work for this or not?

Edit: rest_client isn't required, just the ability to send json in post, get, delete and put with basic auth at the same time.

Edit 2: The only other idea I had was to use Active Model but those don't have save, delete etc methods. Would creating those that somehow tie into the ActionController::Base for wiring do this or not?

Craig
  • 3,043
  • 8
  • 24
  • 25
  • http://www.prestonlee.com/2007/12/29/rails-20-validations-without-extending-activerecordbase/ – Sully Jun 06 '12 at 18:41

1 Answers1

0

take a look at activeresource http://api.rubyonrails.org/classes/ActiveResource/Base.html

Yuriy Goldshtrakh
  • 2,014
  • 1
  • 11
  • 7