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

ActiveResource::Collection is giving NameError

I am trying to run ActiveResource::Collection on console, but its giving name error. Kindly give me a solution to solve this. NameError: uninitialized constant ActiveResource::Collection from (irb):10 from…
Can Can
  • 3,644
  • 5
  • 32
  • 56
0
votes
1 answer

Redmine REST: Name and Identifier cannot be empty

I'm using ActiveResource to add new projects via PHP to my redmine. Editing/fetching projects works perfectly fine. But adding a new one doesn't seem to work. The REST api returns:
CaptainCarl
  • 3,411
  • 6
  • 38
  • 71
0
votes
1 answer

Delete an element from ActiveResource::Collection relationship

I have many-to-many relationship (HABTM) in a file service: class Album < ActiveRecord::Base has_and_belongs_to_many :media, join_table: 'albums_media' end class Medium < ActiveRecord::Base has_and_belongs_to_many :albums, join_table:…
Midwire
  • 1,090
  • 8
  • 25
0
votes
1 answer

ActiveResource for Gitlab CI API in Rails 4.2.4

Sorry for my english. I develop Ruby On Rails app (4.2.4) which interacts with Gitlab CI API ( using ActiveResource). I have list of projects on my remote resource and want to get it. I created model GitlabResource: require 'active_resource' class…
McCauley
  • 15
  • 5
0
votes
0 answers

Unknown attribute :attribute name active resource rails

I have a rails application that interacts with third party application and this third party application saves and to their database. Hence I am using Activeresource module. class User < ActiveResource::Base self.site = "API URL" end In my view…
rubyist
  • 3,074
  • 8
  • 37
  • 69
0
votes
1 answer

Uprgading Rails 3 ActiveResource App to Rails 4

We have a rails 3 app that makes heavy use of active resource and we are looking to upgrade to rails 4. From what I've read it sounds like active resource was removed from rails 4 because of it's threading model. ActiveResource has some really nice…
0
votes
1 answer

Force ActiveResource to not convert complex object from JSON

The ActiveResource docs states that: Any complex element (one that contains other elements) becomes its own object: # With this response: # {"id":1,"first":"Tyler","address":{"street":"Paper St.","state":"CA"}} # # for GET…
GregPK
  • 1,232
  • 11
  • 17
0
votes
1 answer

Using ActiveResource::Base to send get requests to API

I am pretty new to Rails so please bear with me. We are building a Rails 4 app for the Dutch market. During registration processes, it's pretty common to ask the user to fill in their postcode and the address is automatically generated. This works…
DonKoko
  • 105
  • 1
  • 11
0
votes
1 answer

Rendering images from API

The products API gives me name, price, and images keys. It's easy to display name and price since they are not nested. However, to display images, I have to target their urls which are nested. How can I display these images? They have a normal url,…
Roland Jegorov
  • 789
  • 1
  • 11
  • 27
0
votes
1 answer

How to add headers to ActiveResource to create API request

I have a rails app that I need to connect to an external RESTful API (not another rails app) and I got the basic get request to work in js which is the following:

JavaScript in Body

A Paragraph.

0
votes
1 answer

High level definition for ActionController, ActiveSupport, ActiveRecord, ActiveResource

What is the main role of the followings on a high level note ActionController ActiveSupport ActiveRecord ActiveResource I want to know in which context they are used. As of now, I know that ActionController is used for inheriting controllers and…
0
votes
1 answer

Active record model with remote data storage

I want to implement a model "Contact", whose data is not stored in database, but remotely. The operations on data are done via web service. The model Contact is related to other models, whose data is stored locally. Is there any plugin/gem which can…
Pankaj
  • 2,538
  • 3
  • 26
  • 39
0
votes
1 answer

How to couple activeresource object with activerecord 'same' object?

I'm wondering if there's an efficient and elegant way to 'link' an activeresource object with an activerecord object. I'm installing a payment system for my application, it works with an API that contains user table, wallet table, ... I want to…
0
votes
1 answer

Problem Unit Testing ActiveResource Model with HttpMock

I'm working on unit testing an ActiveResource model in my Rails application. I have my ActiveResource::HttpMock code in my test file as follows: ActiveResource::HttpMock.respond_to do |mock| mock.get "/audience/42/people/1.xml", {"Authorization"…
jxpx777
  • 3,632
  • 4
  • 27
  • 43
0
votes
1 answer

ActiveResource post raises an error, while doing the post in my browser succeeds

I have a very strange problem which I am not able to tackle. Two Rails apps, one is an API that has an entity Mongo::Enrollment, and the other one is a client that has the entity Enrollment connected to the API with ActiveResource. I defined my…
Chris
  • 1,068
  • 2
  • 14
  • 30