Started GET "/users/index" for 127.0.0.1 at Thu Oct 18 23:01:19 +0200 2012Processing by UsersController#index as HTMLRendered users/index.html.erb within layouts/application (0.6ms)Completed 500 Internal Server Error in 140msActionView::Template::Error (undefined method `each' for nil:NilClass):1: <% @users.each do |user| %>2: <h1><%= user.username %></h1>3:4: <% end %>app/views/users/index.html.erb:1:in `_app_views_users_index_html_erb___162613411_2191123680'
Yes, it's for a project in my university. I know that the we need to specify the format in the header and the server can handle json and xml format.
Here is the documentation :
Read only resources:
|
- SportsResource / - Get list of all sports [GET, public] |
|
- UsersResource /users/ - Get list of all users [GET, public] |
|
- PartnershipsResource /partnerships/ - Get list of all partnerships [GET, public] |
|
- SportResource /sports/{sportname} - Get sport entity and its list of subscriptions [GET, public] |
|
"Public" write resources: |
|
- UserResource /users/{username} - Get user entity [GET, public*] - Create new user [PUT, public] - Update user profile [PUT, private] - Delete user [DELETE, private] |
|
Private write resources: |
|
- PartnershipResource /partnerships/{username1};{username2}/ - Get partnership entity [GET, public*] - Delete (or decline** proposed) partnership [DELETE, private] |
|
- SubscriptionResource /users/{username}/{sportname} - Get subscription entity [GET, public*] /partnerships/{username1};{username2}/{sportname}/ - Subscribe (as user or partnership) to a sport [PUT, private] - Update subscription [PUT, private] |
|
- EntryResource /[uri of subscription]/{entityid} - Get entry entity [GET, public*] - Update entry data [PUT, private] - Delete entry [DELETE, private] |
* = Read accessability depends on the privacy settings for the respective entities ** = A partnership is created/deleted in the following way:
PUT by user1 proposes a new partnership. PUT by user2 confirmes the proposal and the partnership becomes "operational"
DELETE on an operational partnership results in a proposed partnership. DELETE on a proposed partnership deletes it.
def collection_path(prefix_options = {}, query_options = nil)check_prefix_options(prefix_options)prefix_options, query_options = split_options(prefix_options) if query_options.nil?"#{prefix(prefix_options)}#{collection_name}.#{format.extension}#{query_string(query_options)}"endbydef collection_path(prefix_options = {}, query_options = nil)check_prefix_options(prefix_options)prefix_options, query_options = split_options(prefix_options) if query_options.nil?"#{prefix(prefix_options)}#{collection_name}#{query_string(query_options)}"endAnd now it's OK :)GET http://diufvm31.unifr.ch:8090/CyberCoachServer/resources/users --> 200 OK 1260 (1735.7ms)...But :(I have an other error now :NoMethodError (undefined method `collect!' for #<Hash:0x1030aeed0>):
app/controllers/users_controller.rb:6:in `index'Anyone has an ideaThanks a lot for your support!