0
votes
0answers
15 views

How should I build this Rails REST JSON API for mobile phone access? [closed]

Assume I have to build a blog with REST JSON API with these entities: - Category (with name and description). - Blog entry (with title, content and published). - Comment (with content). Constraints: ...
0
votes
0answers
10 views

Multiple IDs show action with CanCan authorization

CanCan has worked great for me thus far with standard RESTful resources such as /users, /users/:id, /users/:id/pictures. However, we have a requirement that we allow multiple ids be passed in. For ...
1
vote
2answers
36 views

Rails validating post request

Is there a gem or easy way to validate a API post request? For example I am always expecting a field to be either present or always a string and if it is not to ignore the request all together. Or ...
0
votes
1answer
13 views

Extra Edit screens for the same resource

I have a resource "Providers" that has a settings screen. I want to break that out into several screens for usability / design reasons. How should I manage that in my controllers to maintain good ...
0
votes
1answer
19 views

Is there a Rails plugin to help me build an API for ember-data's RESTAdapter?

So I'm going to embark on a project using ember-data, which tells me The REST adapter assumes that the URLs and JSON associated with each model are conventional; this means that, if you follow the ...
0
votes
0answers
17 views

How make “ActionView::Helpers::UrlHelper#current_page?” works with request method?

I have menu with current page highlighting items, implemented via current_page? method def cp(*paths) 'current' if paths.any? { |path| current_page?(path) } end Menu items look like this ...
1
vote
1answer
29 views

How to post array values via curl?

I like to test an API backend which is designed as shown in the following example: http://localhost:3000/api/v1/shops/1.json The JSON response: { id: 1, name: "Supermarket", products: [ ...
0
votes
1answer
24 views

What should I render when destroying a record?

I have an API that lets you destroy an object. The part I'm not sure on is what JSON should be rendered after the record has been destroyed. Here are a couple options, but I'm not sure what the best ...
1
vote
3answers
64 views

How to write a duplicate record method in Ruby on Rails?

In my Rails app I have an invoices_controller.rb with these actions: def new @invoice = current_user.invoices.build(:project_id => params[:project_id]) @invoice.build_item(current_user) ...
5
votes
2answers
77 views

Rails RESTful routes with a composite key

I have an atypical Rails application that needs a table to be indexed by a composite key of two values. Which is the correct way using a RESTful service to add a composite key of two values? If ...
2
votes
1answer
47 views

Maintaining REST with namespaced models in Rails

I'm building an online store and thought it best to namespace the various composite parts. Products, Orders, Users etc... I currently have the Product Module defined and laid out as follows ...
0
votes
2answers
26 views

How to Route Multiple Pages to 'Edit' a Users Account Information (Rails)

I currently have a Ruby on Rails application with a typical User model. I would like to allow users to edit their own account information, and change their email or password. However, I would like to ...
0
votes
0answers
30 views

Industrial System using Ruby on Rails for management and automation, is it possible? [closed]

The idea is to develop a system to an industry that perform services on products. (for example painting and polishing) The service order of every product is created when the client arrives on the ...
0
votes
1answer
15 views

Clear up some concepts to provide a RESTful Web service with Rails 3

I want to build a Rails application that expose a RESTful web service used by a mobile application. I wanna create something maintainable and scalable, but I'm a little bit confused about best ...
0
votes
1answer
49 views

Internal server error when adding HTTP Basic Authentication to rails with Devise

I am adding a REST interface to a working RAILS 3.2 app that uses Devise. I enabled HTTP Basic Authentication and have my app sending the correct email and password. Using PUTS statements I see the ...
0
votes
1answer
25 views

RESTful method for representing a has_one relationship with no identifier

I currently have a service with a REST API which is pretty standard: show: GET /users/1 update: PUT /users/1 ...and some has_many relationships which follow the same convention: show: GET ...
0
votes
1answer
21 views

Keeping REST on nested resource in Rails

I'm currently torturing myself with an implementation conundrum. I have a structure akin to a simple Post -> Comments nested resource relationship. I have the facility for showing context specific ...
0
votes
2answers
30 views

GET request inside POST API endpoint interferes with 'respond_with'

After reading Stored Android Accounts for Authentication of Rails + Devise Accounts I'm trying to setup a Rails 3 API endpoint that can verify an OAuth obtained token through a GET request to Google. ...
0
votes
1answer
29 views

Routing with regex condition in Rails 2

In my routes.rb file, I've defined these routes: map.with_options(:controller => "review") do |review| review.review_index "/review/:page", :action => "index", :defaults => {:page ...
0
votes
1answer
24 views

Rails - Creating a model and its nested resources

I'm trying to create a Gallery model and its has_many associations by passing the following to create. [ { "title":"Some Titler", "description":"", "date":"18-3-2012", ...
0
votes
2answers
42 views

Breaking the Rails-flavored REST

Rails beginner here. I'm trying to create a web application dashboard that shows system statistics like CPU, memory, disk usage, etc. No databases will be used, so I suppose models won't be ...
0
votes
1answer
35 views

How can I query active record models in context of a nested route, DRY style

I like my controller to use all ids that the request URL contains without making the controller route specific. My route: ... resources :users do resources :properties end ... My ...
0
votes
1answer
51 views

Rails route accetping http and json requests

I'm creating a REST api using rails, and I have a simple question related to Routes and how to accept requests for my api. In my routes file I have the following code: namespace :api do namespace ...
0
votes
0answers
137 views

Rails service objects

I have a rails application in which I want to achieve the following: a) Create a data access layer/service that hides the ORM models and exposes higher level methods (instead of ORM specific methods ...
0
votes
1answer
116 views

Rails json request from RESTful api how to render for view

I have another rails app serving up a RESTful JSON API. I'm able to test the response via the curl request below (you can also see an example of the first item it returns). I can figure out how ...
0
votes
1answer
23 views

Restful route design for adding item to container

My cart can have many folders. Those can be nested, but are always displayed as a whole. I want to design an interface to add new item to the folder. My plan is to have a button for folder, after ...
0
votes
1answer
38 views

Rails respond to restful input via html

We have a Rails app where we are adding Workorders via the Restful interface. This is the controller code: # POST /workorders # POST /workorders.json def create @workorder = ...
-2
votes
2answers
171 views

rails, implementing a master detail yet staying RESTful

Say that I have a Customers and an Orders tables, where each Customer may have many Orders. Since in rails we are encouraged to represent these resources in a RESTful style, each of our resources, ...
0
votes
1answer
31 views

Access REST response data

I'm receiving a string response using the rest-client gem and semrush api. How do I access specific data from a string? Response: keyword;Position;Previous Position;Search Volume;CPC;Url;Traffic ...
0
votes
1answer
82 views

Rails rest put HTTP/1.0 501 Not Implemented

I need to use RESTful input to my Rails app. First I'm trying to just understand REST and I'm using WizTools RestClient on my MAC for testing. I have a table called priorities and I'm trying to ...
0
votes
2answers
36 views

Calling REST index action from Dashboard

Hello Everyone I have a model 'Project' in my rails application which is a REST resource. I also have a non REST controller 'home' with a method 'dashboard'. I want the dashboard to render all the ...
0
votes
1answer
63 views

How do i do POST in rails?

The following is my controller code and the view code . The view displays a list of games and i would like to add a game to the existing table in the same view. I'm having some issues with the post ...
0
votes
2answers
49 views

Rails routes not matching 'new' pattern with RESTFul routes

I got this error: No route matches {:action=>"show", :controller=>"video_publications", :campaign_id=[...] With this url: /campaigns/514be3834413790249000025/video_publications/new I have ...
0
votes
2answers
21 views

Trying to make urls of the form <base_url>/boards/<name> in ruby on rails and getting errors

I am using ruby on rails to make a simple social networking site that includes different message boards for each committee of a student group. I want the url structure for each board to look like ...
0
votes
1answer
117 views

Angular and Rails shallow resources

Rails offers a :shallow option to nested resources, which I rely on, because otherwise I'd have 4 or 5 nested resources, which would be very bad. Shallow resources look like this: resources :posts ...
1
vote
1answer
86 views

Rails and BackboneJS destroy model backbone misinterprets response

I am destroying a model in backbone and it sends the correct DELETE request. Everything is fine with the request; I even check in the chrome debugger and under network it says the request has status ...
0
votes
0answers
86 views

Rails Integration with CMS - REST/JSON capabilities/stability of Drupal/Wordpress/BrowserCMS?

We are planning a member directory app in rails that will interface with user accounts and recent posts within a CMS (primarily pulling posts to attach to their directory listing(s)). We are deciding ...
0
votes
0answers
45 views

ActiveResource Double Nesting Issue

I'm using ActiveResource in Rails 3.2.13 to update an object with nested attributes on a remote REST server. My form on the client side looks like this: = form_for @user, :url => ...
0
votes
0answers
84 views

Custom active_model_serializers with non-standard structure

I have objects, which need to be serialized as JSON. So instead of this: [ {"id": 1, "category": "books", "title": "Bible"}, {"id": 2, "category": "books", "title": "HHGTTG"}, {"id": 3, ...
1
vote
2answers
97 views

rails POST on /objects calling index method

Normally in rails, sending a POST to a RESTful controller, say, /orders, calls the #create action. This is what I want to happen. Instead, the #index method gets called. How do I fix this? The server ...
0
votes
2answers
114 views

How to delete a join table association between two models?

I have the following setup of models and controllers: Models: class Company < ActiveRecord::Base has_many :follow_companies, dependent: :destroy has_many :followers, through: ...
-1
votes
3answers
100 views

RESTful API in rails

I am very new to rails and following a tutorial for RESTful API so let me excuse if it is of not very good quality as I am equally a starter for these kind of terminologies as well. I created a ...
0
votes
0answers
253 views

Rails rest-client put getting 400 bad request

In a Rails app, I need to read a seed number from another application and then update the seed by 1 using a REST interface. I'm using the gem 'rest-client'. I can read the seed number OK using this: ...
0
votes
1answer
61 views

Rails REST use url to filter an index

I'm trying to extract JSON records from a Rails app via the REST interface. I'm using RABL to create the JSON. I would like records that are greater than a specified created_at. In the worequests ...
0
votes
0answers
43 views

Can parameter names in Ruby on Rails be simplified for a REST API?

I am working with a web site created with Ruby on Rails. I am doing the client-side while another developer is working with RoR, for the first time. I am seeing parameter names which include brackets ...
1
vote
2answers
84 views

Rails, 404 or 422?

I have a Rails applicantion whit the next resource: /images. All images have one owner. For create new image, I do next request to /images: image_info = { owner_id: '1234', name: 'img1' } post ...
1
vote
1answer
28 views

Which action to use: PUT or POST

I have resources in routes file: resources :forwardings And I need to add the action which will save settings to all items in collection. The question is which method should I use to implement ...
1
vote
0answers
82 views

Download a file with HTTP “Authorization” header set

I am providing a file upload to a resource in my RESTful API (made with Rails). When you GET /resource/123/attachment the file with corresponding MIME type is sent to the browser. (can be anything .. ...
0
votes
1answer
228 views

Get Content Type of Request

To find the incoming content type, docs say: request.headers["Content-Type"] # => "text/plain" But I found by trial-and-error, that doesn't work, but this does: ...
2
votes
1answer
865 views

Extend AngularJS $resource to map to Rails RESTful Routes (particularly $save to create AND update)

I'd like to map the default AngularJS $resource actions: 'get': {method:'GET'} 'save': {method:'POST'} 'query': {method:'GET', isArray:true} 'remove': {method:'DELETE'} 'delete': ...

1 2 3 4 5 16
15 30 50 per page