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.

355 questions
3
votes
1 answer

Add api_key on every request with Rack middleware

I work with Devise token_authentication service and ActiveResource client. I wish set automatically :auth_token params in every requests ! I tried this, but this doesn't work... class AuthApp def initialize(app) @app = app end …
Joel AZEMAR
  • 2,506
  • 25
  • 31
3
votes
1 answer

custom parameter for activeresource

I wanna create a new customer through activeresource. without authentication_key its not a big deal. i'm using devise authentication and cancan. customer = Customer.create(:fname=>'sampath , :last_name=>'munasinghe'…
3
votes
2 answers

Has anyone written a plugin to add the final polish to ActiveResource?

I have been using ActiveResource in my Ruby on Rails applications for some time, and I am starting to really feel that it needs a final polish to make it go from "pretty nice" to "beautiful". I would like to be able to use an ActiveResource as if it…
MiniQuark
  • 46,633
  • 36
  • 147
  • 183
3
votes
1 answer

How Can I Make ActiveResource XML Parsing More Consistent?

I'm using ActiveResource to consume a REST webservice provided by Redmine (a bug-tracking tool). That webservice produces XML like the following: Fred Fake
machineghost
  • 33,529
  • 30
  • 159
  • 234
3
votes
1 answer

ActiveRecord::ConnectionTimeoutError: could not obtain a connection from the pool within 5.000 seconds. all pooled connections were in use

I am trying to use multiple databases in single rails application. I have created a model ReportUser to access report_users table defined in different database which has been specified in config/support_database.yml . Normal models activeRecord…
3
votes
1 answer

Authenticating requests using ActiveResource and session tokens

I have a rails API and a rails client app that communicate with each other via ActiveResource. This works great until I need to pass a unique token with each ActiveResource request to authenticate the user. From what I understand, the ActiveResource…
Alec Sanger
  • 4,442
  • 1
  • 33
  • 53
3
votes
0 answers

accepts_nested_attributes_for and Active Resource

I'd like to use accepts_nested_attributes_for with Active Resource. Is this possible? I have been experimenting in console and passing in nested attributes works, however the nested models fail to create because the foreign_key is never set. For…
Eric M.
  • 5,399
  • 6
  • 41
  • 67
3
votes
0 answers

CarrierWave with ActiveResource - custom storage engine

I need help figuring out how to get CarrierWave to work with an ActiveResource object. I am working on a project that currently uses CarrierWave on a standard ActiveRecord object which works very nicely. However, we are migrating toward a remote…
louism2
  • 350
  • 4
  • 18
3
votes
1 answer

Customize the URL hit from ActiveResource

I have an application App2 to which I am sending a POST request from App1 using ActiveResource. On the App1, I have module App2 class Iteeem # Purposely misspelled here def self.edit_item self.prefix "/api/editing_item/" …
Garfield
  • 1,247
  • 4
  • 15
  • 33
3
votes
1 answer

How to set user password dynamically for resource invocation

How to set user password dynamically for resource invocation. Person Resource could be invoked using John's password or Joe's password. How should I change this code, so that I can make this dynamic in nature. class PersonResource <…
Rpj
  • 5,348
  • 16
  • 62
  • 122
3
votes
3 answers

Best way to add logger for ActiveResource

What is the best way to add a logger for all the ActiveResource in rails? In my application i have some methods which call the API through ActiveResource which sometimes gives TimeOut error. So, i just want to log the url, method(get/post) and some…
Salil
  • 46,566
  • 21
  • 122
  • 156
3
votes
1 answer

Make ActiveResource models generate hashes for nested objects

In my application, I‘m using ActiveResource to manage the data that I receive from a remote API. Say, one of my models is called Account and it has a field called settings, which is documented in the API as a “freeform hash”, meaning it can store…
Arnold
  • 2,390
  • 1
  • 26
  • 45
3
votes
2 answers

Is There an Example of Using ActiveResource and XMLRPC for Rails?

I've seen a ton of examples with ActionWebService and XMLRPC, but they're 3 years old and from what I understand, ActiveResource is supposed to replace ActionWebService. I'm familiar with how ActiveResource can use XML to "talk" to other web sites…
user1151
3
votes
1 answer

ActiveResource NoMethodError when using 'new' action without schema in RoR

I'm unable to add 'new' RESTful entities without defining a schema in my RoR ActiveResource model, even though I've read this is optional. When omitting the schema (I've included it in the code below for clarity), I receive the following…
codinghands
  • 1,741
  • 2
  • 18
  • 31
3
votes
1 answer

Rails ActiveResource detecting a HTTP 206 response code

How can I detect that an active resource find() call returned HTTP 206 instead of a typical HTTP 200? I know ActiveResource throws various exceptions for HTTP 3xx-5xx response codes, but how can you figure out what 200-level response code you…
Oleksi
  • 12,947
  • 4
  • 56
  • 80