I created a Rails application normally. Then created the scaffold for an event class. Then tried the following code. When run it complains about a InvalidAuthenticityToken when the destroy method is executed. How do I authenticate to avoid this response?
require 'rubygems'
require 'activeresource'
class Event < ActiveResource::Base
s...
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 to store Articles for each Person:
class Article < ActiveRecord::Base
belongs_to :...
I am trying to debug an ActiveResource call that is not working.
What's the best way to view the HTTP response to the request ActiveResource is making?
...
When I use link_to :method=>:delete, what rails has generated is a javascript click, which is not nice if you do come across situation your client just have javascript disabled. That seems a bad idea to me. Any chance to get around this?
...
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 this with ActiveResource. Also, I'm having some concerns since I've read somewhere that AR ...
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 User. I know that in the client app I can do stuff like user.save and it will perform a ...
I have been using ActiveResource in my Ruby on Rails applications for some time, and I am starting to really feel that it needs a final polish to make it go from "pretty nice" to "beautiful".
I would like to be able to use an ActiveResource as if it were an ActiveRecord. If I could use has\_many, belongs\_to and other niceties with Act...
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 than maintain a different field.
Unfortunately I have not been able to get this working as...
I have two models: Company and User they have a has_and_belongs_to_many relationship.
I'm using active resource with a method to get all users of a company:
def users
@company = Company.find( params[:id], :include => [:users] )
render :xml => @company.users.to_xml(:include =>[:companies])
end
The only problem is, on the other...
I am making an activeresource call to a service, and I'd like some custom error messages as feedback. I have some validations that aren't normal model validations, so I can't just return @object.errors.
So, for instance, one of my validations is this. Two objects have a many to many relationship, but I want to restrict one object to o...
ActiveRecord introduced a change to its default JSON output format. It went from
{ "user": { some_junk } }
to
{ some_junk }
ActiveResource has apparently followed their lead, expecting to consume JSON as
{ some_junk }
I am trying desperately to consume a RESTful web service which emits
{ "user": { some_junk } }
Is there a w...
I have a quick question about active resource. If I have a User resource, when I do a call like
User.find(1).put(:promote, :position => 'manager')
According to the api it translates into this call /users/1/promote.xml?position=manager
My question is this. Is activeresource actually making two calls here? find doing a get, then put...
I asked something similar to this before and never got an answer, here's a shortened version
I have a User activeresource model. I make a simple call on my client to the service
response = User.find(id).put(:activate, :activation_code => activation_code)
If there were errors on the service (ie. activation_code didn't match) I return...
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 better way.
...
I'm trying to get my head around nested associations in Rails using ActiveResource.
My example is as follows:
What I have is an airport with many runways.
My show action in airports controller contains:
@airport = Airport.find(params[:id])
When I call http://localhost/airports/2.xml I get that piece of XML:
<airport>
<code>DUS</...
I'm trying to create ActiveResource objects for three objects in an internal application.
There are Tags, Taggings, and Taggables:
http://tagservice/tags/:tag
http://tagservice/taggings/:id
http://tagservice/taggables/:type/:key
Tag's :tag is the URL-encoded literal tag text. Tagging's :id is an autoincremented integer. Taggable's ...
I have a Rails application that has a Company resource with a nested resource Employee. I'm using shallow routing, so to manipulate Employee, my routes are:
GET /employees/1
PUT /employees/1
DELETE /employees/1
POST /companies/1/employees
How can I create, read, update, and destroy Employees using ActiveResource?
To creat...
Hi,
I'm working on a cc.rb plugin and need activeresource support. as cc.rb runs on rails 1.2.3, there is no activeresource support. is there a way to use activeresource on rails 1.2.3, since i don't want to upgrade cc.rb to rails 2.3.2?
thx
...
Here are the entire contents of activeresource.rb:
require 'active_resource'
Could someone explain the logic of this?
Why not simply have activeresource.rb contain what active_resource.rb contains and forget about the additional require statement?
...
I'm trying to consume a RESTful WCF service in a Rails app using ActiveResource.
My ActiveResource class is:
class PartReferenceService < ActiveResource::Base
self.site = "http://localhost:1234/"
end
The WCF URL is
http://localhost:1234/PartReferenceService.svc/
and it returns XML like:
<ArrayOfReferenceDataModel xmlns="http...