Questions tagged [activeresource]

ActiveResource is the main class for mapping RESTful resources as models in a Rails application

Active Resource objects represent your RESTful resources as manipulatable Ruby objects. To map resources to Ruby objects, Active Resource only needs a class name that corresponds to the resource name (e.g., the class Person maps to the resources people, very similarly to Active Record) and a site value, which holds the URI of the resources.

357 questions
77
votes
6 answers

Connecting Rails 3.1 with Multiple Databases

At ShowNearby we have been doing a very big migration to RoR 3.1 from PHP and we are facing several problems that may be some of you have solved before. We have big amounts of data and we decided to segregate our DB into several DBs that we can…
62
votes
3 answers

Difference between Active Model, Active Record and Active Resource

Is there anyone who can help me by defining the exact difference between Active Model, Active Record and Active Resource. I have done enough googling in order to find the exact difference, but didn't get anything concrete which can tell the exact…
23
votes
3 answers

How do you log the URL ActiveResource uses?

Rails ActiveResource is awesome ... except for one thing: as far as I can tell, there is no way to see what URL it is using behind the scenes. For instance, let's say I have an ActiveResource called Issue, for a webservice at…
machineghost
  • 28,573
  • 26
  • 128
  • 197
20
votes
7 answers

Add api key to every request in ActiveResource

I have 2 RESTful Rails apps I'm trying to make talk to each other. Both are written in Rails 3 (beta3 at the moment). The requests to the service will require the use an api key which is just a param that needs to be on every request. I can't seem…
Jared
  • 2,358
  • 1
  • 18
  • 33
19
votes
2 answers

Is ActiveResource fundamentally flawed?

Several developers from different teams have independently told me that ActiveResource was a flawed idea. The most common criticism I hear is that it was a mistake to design it to have an ActiveRecord-like interface. I also hear complaints about the…
Eben Geer
  • 3,516
  • 3
  • 28
  • 33
16
votes
4 answers

How to Use ActiveResource with Shallow Nested Routes?

I have a Rails application that has a Company resource with a nested resource Employee. I'm using shallow routing, so to manipulate Employee, my routes are: GET /employees/1 PUT /employees/1 DELETE /employees/1 POST …
Rich Apodaca
  • 25,799
  • 16
  • 92
  • 115
14
votes
4 answers

Remove .xml extension from ActiveResource request

I am trying to use ActiveResource to consume xml data from a third party API. I can use the RESTClient app to successfully authenticate and make requests. I coded my app and when I make a request I get a 404 error. I…
Matt
  • 1,399
  • 1
  • 10
  • 16
13
votes
2 answers

How to consume JSON formatting with ruby's ActiveResource?

ActiveRecord introduced a change to its default JSON output format. It went from { "user": { some_junk } } to { some_junk } ActiveResource has apparently followed their lead, expecting to consume JSON as { some_junk } I am trying desperately to…
Michael Gundlach
  • 94,522
  • 11
  • 34
  • 39
13
votes
3 answers

Rails can't save a nested resource via ActiveResource

I'm having a problem using ActiveResource to save a model with a nested resource: I can load and save a non-nested resource with no problems, and I can load a resource plus its nested resources fine, but saving the resource fails. This problem…
Eric Dennis
  • 2,116
  • 1
  • 15
  • 10
12
votes
1 answer

Best way to share ActiveRecord models and data between different Rails Apps?

I have several rails applications that will use the same core set of Models and data, for example: Apps Developers Categories Each app builds on top of this core data and uses it in different ways. For example, I might have something like this in…
12
votes
3 answers

RESTful frameworks for Android, iOS...?

My company is reworking its API and wants to make everything RIGHT for this time ;) Thats the setup... We are delivering data to clients over the internet. Clients are mobile handsets like iPhone, Androids, J2ME, Blackberry... The server is coded…
OneWorld
  • 16,782
  • 18
  • 79
  • 130
11
votes
3 answers

ActiveResource error handling

I have been searching for a while and yet I am not able to find a satisfactory answer as yet. I have two apps. FrontApp and BackApp. FrontApp has an active-resource which mimics a model in BackApp. All the model level validations live in BackApp and…
Priyank
  • 13,663
  • 17
  • 69
  • 105
10
votes
1 answer

Singleton can't be dumped - cached_resource gem

Using cached_resource gem for caching active resources. User model class User < ActiveResource::Base cached_resource class teachers < SimpleDelegator attr_accessor :teacher_id def initialize(attributes = {}, _persisted = true) …
9
votes
2 answers

Is it thread safe to set Active Resource HTTP authentication on a per-user basis?

Active Resource can make use of HTTP authentication set at the class level. For instance: class Resource < ActiveResource::Base end Resource.user = 'user' Resource.password = 'password' or Resource.site = "http://user:password@site.com/" But what…
Nick Urban
  • 3,518
  • 1
  • 20
  • 35
9
votes
3 answers

ActiveResource model is not getting initialized

I am looking at using ActiveResource but is now facing a problem that I am unable to figure out myself (was searching the net for a couple of days for the solution by now). So I have an authentication app sitting at http://localhost:80 and a client…
Dmitry Matveev
  • 4,820
  • 26
  • 39
1
2 3
23 24