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
1
vote
2 answers

ActiveResource, a model, and Form_Tag

I am trying to use form_tag to pass the params captured by the form to my users controller. I am attempting to communicate with a Sinatra server, and so I do not have a database on the client. My view is as follows: <% form_tag(@user) do %>
Lior
  • 60
  • 10
1
vote
1 answer

(Ruby/ Rails) undefined method when I'm trying to reference a variable

So continuing on my adventure of active resource and active record I'm trying to do a simple get method within an active resource but everytime I try to reference the variable, It throws a method undefined exception. Perhaps Its better to explain it…
OVERTONE
  • 11,797
  • 20
  • 71
  • 87
1
vote
2 answers

Calling active record method from active resource (Ruby/Rails)

Apologies for the very broadly title question. Basically this follows on from my earlier question about defs and how they are called on instantiated methods. Basically the way I have it now: I set up an active resource on client side and post it…
OVERTONE
  • 11,797
  • 20
  • 71
  • 87
1
vote
1 answer

Method not found in instantiated class (Ruby/Rails)

So I come from a background in Java where you can create a class as such. TestClass x = new TextClass(); and call its method like x.shout(); I'm attempting to do something similar in ruby with no such look. This could be syntactical or it…
OVERTONE
  • 11,797
  • 20
  • 71
  • 87
1
vote
1 answer

Rails3 ActiveResource Post Call delivers an empty Parameter Hash

I am trying to create a new "Person" in a Sinatra API app from a Rails3 app using ActiveResource and Json. In Rails3, I created a "Person" model and using ActiveResource I correctly call the API, which correctly reads the URL, but no parameters…
1
vote
1 answer

Wrong URL when consuming existing Java REST API using rails ActiveResource

I am new to ruby on rails.I am trying to consume my existing Java REST api using Rails, ActiveResource class, but every time resource URL hit, is wrong (https://myapp/resource/**apis**/responce.json), where the correct url is…
happy To help
  • 95
  • 1
  • 8
1
vote
1 answer

ActiveResource "NoMethodError (undefined method `path' for nil:NilClass):" intermittent error

I'm encountering an intermittent error where an ActiveResource resource call like: Cart.where(session_id: get_guid, status: 1) Raises an error: NoMethodError (undefined method `path' for nil:NilClass) But only intermittently. Restarting the Rails…
taylorthurlow
  • 2,953
  • 3
  • 28
  • 42
1
vote
1 answer

ActiveResource : Polymorphic Routes

Using ActiveResource, Ruby on Rails, Is there a clean way to do the following: I have house ActiveResource model and chair ActiveResource model, and both can have comments. I want to reuse the comment ActiveResource model for both. # ActiveResource…
1
vote
0 answers

ActiveResource multiple nested routes for model

I'm using ActiveResource to pull objects from an internal API This API has the following(simplified): class Project < ApplicationRecord has_many :contributions ... end class Contribution < ApplicationRecord belongs_to :project belongs_to…
aelosada
  • 21
  • 3
1
vote
2 answers

In which case is it advisable to use ActiveResource? and in which case is it not?

I am using Ruby on Rails 3 and I am considering to use ActiveResource in order to trasmit information from a RoR service application to a RoR client application. In general, in which case is it advisable to use ActiveResource? and in which case is…
user502052
  • 14,803
  • 30
  • 109
  • 188
1
vote
1 answer

Active Resource in Rails 3.0, nested resource with non standard ID

I have a rails application that needs to refer to another rails application to populate some of it's models, and am using Active Resource to do it. When I need to hit a route like: /channels.xml There is no problem at all, I can use the automatic…
J.R.
  • 5,789
  • 11
  • 55
  • 78
1
vote
1 answer

Rails - ActiveResource returning hash instead of an object

I've got the following code u = Client.get(:show_by_username, :username => username.downcase) When a valid user is returned, they seem to be getting returned as a hash instead of an object that I can call methods on e.g. I have to access values…
Jon Morgan
  • 55
  • 4
1
vote
2 answers

Rails: ActiveResource and Apache Redirect

I have rails applications, which communicate with each other using ActiveResource. I have setup the VHOSTs to redirect every HTTP request to HTTPS. This is the VHOST for one application: Redirect permanent /…
Saim
  • 2,471
  • 5
  • 30
  • 43
1
vote
1 answer

Rails3 to separate apps or not

I'm quite new at Rails but can find my way around for the time being. We are working on moving our old legacy PHP app to rails3. There is a Management system which handles transactions/contact/reports. Then a few extra 'modules' such as: Campaigns,…
rogmir
  • 13
  • 2
1
vote
1 answer

Rails ActiveResource with custom REST collection schema?

I am trying to set up some Rails model working on top of the active_resource gem (ActiveResource) module Core class RestResource < ActiveResource::Base self.format = :json end end module Core module API class BaseModel…
nakwa
  • 1,157
  • 1
  • 13
  • 25