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
6
votes
2 answers

Rails: ActiveResource - Can I set the ID explicitly?

I am using ActiveResource in Rails to manage entities in a separate database over REST. I have been trying to explicitly manage the IDs of the remote resources, as for the current case it is simplest to just re-use the local resource's ID, rather…
DanSingerman
  • 36,066
  • 13
  • 81
  • 92
6
votes
1 answer

ActiveResource adds an extra class when running rails console in development

We have 2 Models: Valuation and Document. Both are in a microservice so we use ActiveResource to access them. class Valuation < ActiveResource::Base self.site = "#{config.valuation_service.base_url}/valuations" self.include_root_in_json =…
jvnill
  • 29,479
  • 4
  • 83
  • 86
6
votes
3 answers

Shopify API: Retrieve multiple records via id in a single call

I noticed that in the Shopify API documentation, they mention the possibility to retrieve multiple orders in a single call using "A comma-separated list of order ids" as a parameter called "ids". Link to section of docs I'm referring to:…
6
votes
1 answer

Rails ActiveResource Associations

I have some ARes models (see below) that I'm trying to use associations with (which seems to be wholly undocumented and maybe not possible but I thought I'd give it a try) So on my service side, my ActiveRecord object will render something…
brad
  • 31,987
  • 28
  • 102
  • 155
6
votes
2 answers

How do I define a relationship between activerecord and activeresource using foreign keys?

I have a local user model which uses activerecord. The user has an email field. I also have an activeresource model called tasks which has a created_by field which stores the submitting users email address. I'd like to link the two but I'm…
6
votes
1 answer

Nested forms fail when using an ActiveResource model, Rails 4

I have problem with creating a form for my ActiveResource models but I can't seem to find a solution. The problem is that the model does not know the fields, and throws an error when I try to create a text field: undefined method `firstname' for…
Chris
  • 1,068
  • 2
  • 14
  • 30
6
votes
2 answers

Active resource complaining about expects an hash

I am using active resource to get data from an api and display it, My controller model.rb has class Thr::Vol::Dom < ActiveResource::Base class << self def element_path(id, prefix_options = {}, query_options = nil) prefix_options,…
sorabh
  • 297
  • 1
  • 3
  • 11
6
votes
1 answer

Formatting of Rails logs when using ActiveRecord

So I have an application that earlier did not need ActiveRecord - thus we removed ActiveRecord from the application and formatted our logging as such: In application.rb: class DreamLogFormatter < Logger::Formatter SEVERITY_TO_COLOR_MAP =…
6
votes
2 answers

Rails 3.2 - ActiveResource - Using POST/PUT with JSON

I have been looking at this for a while, and am currently at a loss. I have narrowed the problem down to being related to JSON, and that the JSON does not appear to be being sent in a legible format. We were previously using Rails 3.0.7 (where the…
Krista
  • 895
  • 1
  • 6
  • 16
5
votes
1 answer

Internal REST API

We currently have three sites in our network. One written in Ruby on Rails and the other two written in PHP. All of the sites tend to share a lot of the same data and logic. I find myself having to repeat a lot of the work I do on the rails side on…
Dan
  • 119
  • 8
5
votes
0 answers

Set site/username field ActiveResource based highrise gem

I am building a sinatra app that will use Highrise CRM gem to access Highrise data. The example code to use this gem from the wiki, require 'highrise' Highrise::Base.site = 'https://your_site.highrisehq.com' Highrise::Base.user = 'api-auth-token'…
5
votes
2 answers

Connect to ActiveResource/ActiveRecord with a Delphi client

I've been looking for some way to let a Delphi program communicate with a RoR service. I could use any of the SOAP libraries out there e.g.: ActionWebService to offer a SOAP service, which I could then use in the Delphi program. However, this…
Alessandro Vermeulen
  • 1,321
  • 1
  • 9
  • 28
5
votes
1 answer

Measuring outbound requests per second?

I have a web app that is using ActiveResource to talk to another server that has a rate limit on the connection. I'm curious how I can best monitor that from the host my web app is running on - that is, from a bash prompt on linux from my server,…
David Bock
  • 681
  • 4
  • 8
5
votes
2 answers

Proper way to add a non-restful custom method to Active Resource class

I have route that looks like this: /orders/preview It returns something like: 100 I want to add this method to an active resource class. What is the best way to do this? I started doing something like this: class…
5
votes
1 answer

Ruby on Rails: Session with ActiveResource?

By default, ActiveResource client sends username/password in each http request to restful api. Can we configure it to interact using session id so that session is maintained between client and restful server.
1 2
3
23 24