respond-with Questions

1

Solved

I have a simple angular rails app that I am trying to get wired up. Here is my rails controller: class ItemsController < ApplicationController respond_to :json, :html def index @items = I...
Recovery asked 28/12, 2014 at 1:52

4

Solved

It seems that when returning an object containing a "type" attribute as JSON from a Rails 3.1 application, the "type" attribute is not included. Assume I have the following: A model with correspon...
Demandant asked 20/1, 2012 at 18:3

2

Solved

I have a pretty standard authenticate method private def authenticate_user @current_user = User.find_by_authentication_token(params[:token]) unless @current_user error = { :error => "Inva...
Toothwort asked 20/10, 2011 at 6:30

2

I'm having the following problem with a simple Rails 3 app I'm creating. It is driving me batty. My model: class Vehicle < ActiveRecord::Base has_many :vehicle_pictures, :dependent => :des...
Coercive asked 8/4, 2011 at 15:22

2

Solved

Preamble: I investigated how to version an API and found several ways to do it. I decided to try peter williams' suggestion and created new vendor mime types to specify version and format. I coul...
Lalita asked 20/1, 2011 at 23:50

1

Solved

using ruby 1.9.2 and rails 3, i would like to limit the fields returned when a record is accessed as json or xml (the only two formats allowed). this very useful post introduced me to respond_wit...
Caroche asked 13/1, 2011 at 21:47

1

Solved

I'm encountering a strange behavior in my controllers. They seem to occasionally want to redirect instead of render a json response. respond_to :json, :html, :js def create @favorite = current_u...
Ryals asked 2/4, 2011 at 22:31

5

Solved

I'm trying to create a JSONP API for my Rails 3 application. Right now in my controllers, I have a lot of actions which follow this pattern: # This is from my users_controller.rb, as an example d...
Laforge asked 17/12, 2010 at 3:53

1

I'm trying to DRY up a controller by incorporating respond_with. When I do, following some instructions in a Railscast, I get things mostly working. The problem lies in the redirect after deleting ...
Darendaresay asked 15/2, 2011 at 4:35

3

Solved

I am using respond_with and everything is hooked up right to get data correctly. I want to customize the returned json, xml and foobar formats in a DRY way, but I cannot figure out how to do so usi...
Interlace asked 15/9, 2010 at 15:13

1

Solved

Utilizing ActionController's new respond_with method...how does it determine what to render when action (save) is successful and when it's not? I ask because I'm trying to get a scaffold generate...
Dalhousie asked 15/12, 2010 at 3:15
1

© 2022 - 2024 — McMap. All rights reserved.