Tagged Questions
1
vote
1answer
27 views
Errors creating a button to delete an active record
Having trouble deleting an active record for my model of workers.
Workers has a belongs_to relationship with Users
My routes
workers_update PUT /workers/update(.:format) ...
1
vote
1answer
21 views
How to authenticate Titanium client
I've got a Rails app with the devise gem for user authentication.
What is the best way to authenticate an user on a Titanium app? I would like the user enters his credentials on the Titanium app and ...
0
votes
1answer
23 views
REST API's for an existing rails app
I am creating RESTful API's for my existing rails app. In most of the examples I saw, I see that a new set of controllers are being created for API's. I was wondering if this is the best practice, ...
1
vote
0answers
28 views
REST client, for working with HTTP streaming in Ruby
I have added async responses on my server more info here
And I am looking for good REST client to handle these http streaming responses on client side. There is an option of using EM client ...
1
vote
0answers
25 views
Uploading image to rails app using carrierwave, android, and HTTPpost
I am still learning a lot about Rails and Android development, so forgive me if my question is a bit unclear.
Fundamentally, what I'd like to do is uploading photos to my rails app using an android ...
0
votes
0answers
38 views
current_user nil when running a POST REST call from REST Client
I use Devise for authentication in my rails app.
I use a REST client to call
/user/sign_in.json with required parameters to login to the app
Then I make POST call in the same REST client with ...
0
votes
0answers
39 views
How to limit duplicate objects in JSON response [closed]
I've though of this for a while but can't come up with a great solution. Basically I have a list of ~100+ objects that all have a "creator" relationship. In that list the same creator could be ...
0
votes
1answer
40 views
Rails - Validate model in another controller and persist errors
I have two models User and Want. A User has_many: Wants.
The Want model has a single property besides user_id, that's name.
In the edit action view in the UsersController there are two forms. One ...
1
vote
1answer
25 views
RESTful route for company in country/state
I am trying to find a RESTful route for the following:
-> I have a resource that is Company, and a company is in a particular country and state.
I would like to be able to fetch the following:
-> ...
0
votes
0answers
21 views
Cucumber not working with rest API
our rails application (along with cucumber tests associated with it) make a call/request to an external rest API. The rails server dev environment works fine with this when it is supposed to, but ...
0
votes
0answers
19 views
How to implement some process'es steps in controller actions staying restful?
Webapp (RoR) I'm working on now need to guide user through some process steps. It needs to be implemented with ajax requests so I can change only the part of a form.
I want to create custom actions in ...
0
votes
0answers
38 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
14 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
41 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
17 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
26 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
41 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
27 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
71 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
81 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
48 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
33 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
33 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
23 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
57 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
28 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
24 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
41 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
36 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
45 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
37 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
70 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
154 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
130 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
24 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
41 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
200 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
32 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
95 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
39 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
64 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
53 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
136 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
103 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
90 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
48 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
88 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, ...