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

Why does ActiveResource Post not Send Any Parameters?

I am trying to create a new "User" in a MongoDB/Sinatra Server from a Rails3 Client using ActiveResource and Json and the object body or hash that is sent is empty. In Rails3, I created a "User" model and using the Rails Console I make an…
Scott
  • 330
  • 3
  • 15
2
votes
1 answer

:has_many, :through with ActiveResource models

Three models on a UserService backend Rails app: class User < ActiveRecord::Base has_many :services has_many :members has_many :groups, :through => :members has_many :managed_groups, :class_name => "Group" accepts_nested_attributes_for…
JohnMetta
  • 18,782
  • 5
  • 31
  • 57
2
votes
1 answer

ActiveResource Suffix

With ActiveResource, a call to MyObject.find(id) gets "[self.site]/[self.prefix]/:id.[self.format]". However, the API we're accessing is configured slightly differently. Instead of id.file_type we need to access…
Brad Herman
  • 9,665
  • 7
  • 28
  • 30
2
votes
1 answer

How to make ActiveResource integration test case?

I'm developing an internal API using Rails and I'm thinking to use ActiceResource to access it. I want to make integration test cases (ie. making http requests to the controllers in test environment) using ActiveResource but can't figure out how to…
talakoski
  • 131
  • 1
  • 8
2
votes
2 answers

Rails 3: ActiveResource custom method call - ClientError 414 - Work around?

I'm currently creating both the client and server app using ActiveResource for web servicing. The client has a long string (:history) that needs a conversion process done by the server. Here, the client calls the post method on my object which…
omgwot
  • 89
  • 1
  • 8
2
votes
1 answer

Is there a nice way to use url_for with ActiveResource?

I'm using ActiveResource in my rails app to talk to another rails app (both are version 2.3.5). I'd like to link to the page for a particular resource object, but there doesn't seem to be any nice way to do that. The ugly way I've figured out is to…
carpeliam
  • 6,691
  • 2
  • 38
  • 42
2
votes
0 answers

LoadError: cannot load such file -- active_resource

I have two applications named as 'Book' and 'Inventory' respectively. My 'Book' app is running on 3000 port & 'Inventory' app is running on 4000 port. I have 'book' model in 'Book' app and 'inventory' model in 'Inventory' app. In my 'Book' app I…
2
votes
2 answers

Active Resource Nested Routes

Im currently trying to integrate with a third party API using active resource. Ive completed a large amount of the work but am struggling with a single nested resource. /company/:company_id/users/:id I can retrieve the users from the company using…
David Lyod
  • 1,438
  • 12
  • 14
2
votes
1 answer

ActiveResource::BadRequest error when trying to save after one update to a primitive attribute

I am currently working with a REST API that has an object with an attribute "name." item = person.find(id) I can loop through the item's attributes without any problem and one attribute is, indeed, "name." However, when I try the…
2
votes
0 answers

Encoding characters in restful resource path with ActiveResource

I've created a Rest API for a existing system utilizing Rails and am attempting to consume it in an external system via ActiveResource. Unfortunately the primary key of one of the core tables is an arbitrary string defined by the user so many…
Neil
  • 21
  • 2
2
votes
1 answer

Activeresource prefix_option missing when doing models association

Can anyone point me to how to add the prefix_option when dealing with active resource association? I have done the following but with no success: class League < ActiveResource::Base has_many: teams self.site = "http://api-yyy.com/" end class…
2
votes
1 answer

Rails + Devise Nested Registration form undefined method 'build_address'

Hi this question is basically the same as this one, which had no responses. I'm trying to combine the Devise registration form to include fields that produce not only a "user", but a "customer" object, an "account" object for that customer, and an…
B. Bulpett
  • 814
  • 12
  • 27
2
votes
0 answers

Fetching collections of books using ActiveResource returns an error

Fetching collections of books using activeresource. I have a class extending from active resource as follows: class BookResource < ActiveResource::Base self.site = "http://api.book.com:3000/" end Here is my books_controller.rb class…
diya
  • 6,938
  • 9
  • 39
  • 55
2
votes
5 answers

Exchange data between 2 Rails apps (preferably offline) on the same server

I have 2 Ruby on Rails 4 apps on the same server (they do not - and should not - share database): deploy@Ubuntu-1404-trusty-64-minimal:~/applications$ ls app1 app2 How do I exchange data between app1 and app2? My current implementation is unstable…
Cjoerg
  • 1,271
  • 3
  • 21
  • 63
2
votes
3 answers

How do I search for a product based on the SKU using the Shopify API?

I'm using the Ruby wrapper for Shopify's API and I want to search for products based on the SKU's. Here's what I'm currently trying: ShopifyAPI::Product.find(sku: 'wi196217') # => ActiveResource::ResourceNotFound: Failed. Response code = 404. …
narzero
  • 2,199
  • 5
  • 40
  • 73