respond-to Questions

7

Solved

In my rails app I have a ajax request to the server, to store some data. This used to work without any problem, but now I get an error: ActionController::UnknownFormat (ActionController::UnknownFo...
Libretto asked 8/4, 2014 at 17:15

12

Solved

I know in Ruby that I can use respond_to? to check if an object has a certain method. But, given the class, how can I check if the instance has a certain method? i.e, something like Foo.new.resp...
Francinefrancis asked 21/7, 2010 at 20:4

2

Solved

In a rails controller action with the following code: respond_to do |format| format.json{ render :json=> {:status => 200, :response=>@some_resource} } format.html { redirect_to(some_res...
Algebraist asked 22/6, 2012 at 13:34

4

Solved

I have two actions in my controller : def find @item = Item.find(params[:id]) render 'result', :id => @item.id end def result @item = Item.find(params[:id]) respond_to do |format| format....
Gobelin asked 31/3, 2012 at 20:14

3

Solved

I have a controller "UserController" that should respond to normal and ajax requests to http://localhost:3000/user/3. When it is a normal request, I want to render my view. When it is an AJAX requ...
Zymogenesis asked 25/11, 2013 at 8:42

2

Solved

In respond_to you can set flash[:notice] like this respond_to do |format| format.html { redirect_to photo_path(photo), :notice => 'The photos was saved') } format.xml { render :xml => phot...
Teraterai asked 18/12, 2012 at 15:30

3

Solved

This is a question "why does it work this way", not "how do I make this work". My app is calling a third party REST API that returns JSON, and returning the result as part of my own JSON API. I w...
Hahn asked 19/6, 2012 at 20:25

2

Solved

I have an action in a controller concern, which gets included in a controller. This action does not render a js.erb file as specified under a respond_to block. How do I properly get an action in a ...

1

Solved

I have a set of reports that are displayed in various formats using the Rails call "respond_to", such that if the URL ends in CSV or JSON, the report is generated in that format. I had a request t...
Falbala asked 18/4, 2014 at 18:23

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 am using Ruby on Rails 3 and I would like to know what the :location => ... and head :ok statements mean in following code, how they work and how I can\should use those. respond_to do |format...
Spectrogram asked 6/3, 2011 at 22:35

1

Solved

I have a controller that has if-condition: def update @contact_email = ContactEmail.find(params[:id]) if @contact_email.update_attributes(params[:contact_email]) flash[:notice] = "Successfull...
Raveaux asked 10/6, 2010 at 4:49

2

Solved

If I have a block of code like this: def show @post = Post.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @post } end end How do I add...
Fi asked 2/4, 2010 at 13:4
1

© 2022 - 2024 — McMap. All rights reserved.