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
5
votes
1 answer

How do I use the current Basecamp API with ActiveResource?

I'm trying to use the Basecamp Classic API (http://developer.37signals.com/basecamp/comments.shtml). The current basecamp-wrapper version was giving me fits, one of the things was because the json responses include pagination output, while the xml…
excid3
  • 1,658
  • 15
  • 31
5
votes
1 answer

Get a member URL action with ActiveResource

I have a route in my application that is like this: /deployments/:id/logs.json It is used to retrieve logs for a specific deployment. On my client code, based in ActiveResource I have this: logs = Deployment.find(deployment.id).get(:logs,…
kolrie
  • 12,562
  • 14
  • 64
  • 98
5
votes
2 answers

How to convert rails active resource object to hash?

Let's say I have some active resource object fetched as the following: x = Resource.find(some_id) And x in the remote server has some field h as a complex nested hashes which is represented here as nested active resource objects, but then accessing…
user1011792
5
votes
3 answers

Rails active resource: how to send post parameters in the request body and not as query strings?

I am calling some post request using rails activeresource, however all the parameters are sent as query string and the result is that the called url is too long and I get WEBrick::HTTPStatus::RequestURITooLarge exception. So I need to send the…
user1011792
5
votes
0 answers

Active resource error "ArgumentError at expected an attributes Hash, got "

I have configured my rails app to consume Redmine api using Active resource. In my model redmine.rb, i put the following code require 'active_resource' class Redmine < ActiveResource::Base self.site = "http://localhost:9000/" self.format =…
sukanta
  • 541
  • 6
  • 18
5
votes
3 answers

How do I create an ActiveRecord relationship to an ActiveResource object?

Let's say I'm writing a Library application for a publishing company who already has a People application. So in my Library application I have class Person < ActiveResource::Base self.site = "http://api.people.mypublisher.com/" end and now I want…
James A. Rosen
  • 64,193
  • 61
  • 179
  • 261
5
votes
2 answers

How can I specify prefix parameters when saving a nested ActiveResource?

I have a nested ActiveResource model (i.e. it's within another model's namespace). Trying to call save raises: ActiveResource::MissingPrefixParam: client_id prefix_option is missing How do I supply the needed prefix? Here's my class: class Foo::Bar…
JellicleCat
  • 28,480
  • 24
  • 109
  • 162
5
votes
2 answers

Avoid symbolication of keys for ActiveResource

I am using an ActiveResource model named "Setting" to connect to an external web service which delivers some response like the following example: {"setting" => {"id" => 10, :details => {"10a" => 7, "10b" => 8}}} The problem is, that ActiveResource…
anka
  • 3,817
  • 1
  • 30
  • 36
4
votes
2 answers

Why is there no ActiveRecord REST adapter

We've been working on various projects using ActiveResource for a couple years now. It seems that ActiveResource is great to use if you are using Rails on both the client and server sides. Problems with ActiveResource We're using Scala on the server…
JohnMetta
  • 18,782
  • 5
  • 31
  • 57
4
votes
3 answers

Rails, ActiveResource, and Pagination

What's the best way to implement pagination in a REST API so that an ActiveResource client can easily navigate paginated results? There have been some proposals, for example here and here, but being new to ActiveResource I'm wondering if there's a…
Rich Apodaca
  • 28,316
  • 16
  • 103
  • 129
4
votes
1 answer

CarrierWave with ActiveResource

Does anyone have any insights into using CarrierWave with an ActiveResource model (in Rails 3)? I've got an ActiveResource model with field for the filename, and I want to save the file to the remote filesystem. I've tried a few things without much…
tmo256
  • 936
  • 8
  • 15
4
votes
0 answers

ActiveResource ArgumentError (expected attributes to be able to convert to Hash

I'm getting this error when ActiveResource is attempting to decode a response from an API: ArgumentError (expected attributes to be able to convert to Hash, got ["menu_items", ... Important gem versions: Rails: 5.1.6 ActiveResource:…
Peter B.
  • 41
  • 3
4
votes
2 answers

Can ActiveResource models integrate with ActiveRecord models?

I'm working on a Rails app that will serve as an authentication system for other Rails apps through Rails's ActiveResource functionality. The authentication app has an ActiveRecord model called User. The client app has an ActiveResource model called…
Ethan
  • 57,819
  • 63
  • 187
  • 237
4
votes
1 answer

Ruby On Rails: ActiveResource and file uploads

Does anyone have experience with ActiveResource and file uploads? I have an Adobe Air desktop application which communicates with my Rails driven website's web services. I'd like to post files to the server but I'm not entirely sure if I could do…
Attila Györffy
  • 759
  • 7
  • 13
4
votes
3 answers

Error using ActiveResource with Rails 3 and REST API

I have a REST API that I am trying to access using Rails 3.0.1 that returns: This is a sample title ...Misc Another Title ...Misc …
Steve Wright
  • 2,481
  • 3
  • 26
  • 35