Questions tagged [respond-to]

112 questions
1
vote
1 answer

Rails error on respond_to

i have create a simple user authentication for learning Rails: class UsersController < ApplicationController def new @user = User.new end def create respond_to do |format| if @user.save format.hmtl {redirect_to…
Tom
  • 4,007
  • 24
  • 69
  • 105
1
vote
2 answers

XML Parsing Error: junk after document element. Rails builder

I am trying to send send an xml Doc from an action The XML is created by the following method def media_xml x = Builder::XmlMarkup.new x.instruct! x.declare! :DOCTYPE, :html, :PUBLIC, "-//W3C//DTD XHTML 1.0 Strict//EN",…
stellard
  • 5,162
  • 9
  • 40
  • 62
1
vote
1 answer

set a rails controller's response type to xml

i'm quite new to rails. i'm trying to set a rails controller's response type to xml, but not having much luck. i could certainly afford to better understand how respond_to and respond_with work. here's what my controller looks like: class…
dougiebuckets
  • 2,383
  • 3
  • 27
  • 37
1
vote
1 answer

Sinatra + Rack routing

I have an app file that looks like this ws_app.rb: require 'rubygems' require 'sinatra' require 'sinatra/respond_to' require 'dm-core' require 'dm-migrations' require 'dm-timestamps' require 'json' require 'csv' load…
Dimitri
  • 23
  • 5
1
vote
1 answer

Rails 3 how to force response type when request type is */*

I have a before_filter which wants to default the response type depending on various aspects of the request and parameters. E.g., request.format = ( params.format ||= 'html' ) if ... # an HTML-only request/client request.format = ( params.format…
tribalvibes
  • 2,097
  • 3
  • 25
  • 30
0
votes
1 answer

void respond_to format.html Only should works with format.js

I want void format.html response in controller in ruby on rails 3. e.g. in my comments_controller.rb def new @comment = Comment.new respond_to do |format| #format.html # new.html.erb avoid this output #format.json { render json: @board }…
hyperrjas
  • 10,666
  • 25
  • 99
  • 198
0
votes
1 answer

How to make a respond_to by AJAX in Rails 3?

I have a form, that I send with using AJAX. The form is in the FirstsController. I need the form send to SecondsController. The form is sent and data saved. Then I wanna change the form by a text, I try to do by this way: def create …
user984621
  • 46,344
  • 73
  • 224
  • 412
0
votes
0 answers

Tkinter window says not responding but code is running

I am trying to make an antivirus application but I met some issue. And Tkinter window says (not responding) but code is running. I wanted to use threading, but firstly it's not convenient, secondly it doesn't work.I don’t know how to make it so that…
Pythoner
  • 11
  • 2
0
votes
0 answers

Ruby On Rails - Redirect_to |format| not working

I have a problem when I click a button to run some js file, rails throws an error saying: ActionController::UnknownFormat. and respond_to do |format| is highlighted I have these 3 file paths views -> file -> file1 -> create.js.erb controllers ->…
Ese10
  • 17
  • 6
0
votes
1 answer

UrllinksController#create is missing a template for this request format and variant. request.formats: ["text/html"] request.variant: []

I have a controller for urllinks and home and have a view for create.js.erb. Showing error when I click on Create Short Link. Controllers/UrllinksController class UrllinksController < ApplicationController # is looking for instant variables that…
Pav
  • 19
  • 1
  • 4
0
votes
1 answer

How to render a common JS from every action of controller?

For example, I have a controller named Organizations, which includes basic CRUD actions and all the actions respond_to JS, so I wrote the respond_to block at the beginning of the controller respond_to :js, { only: %i[index destroy create] } and…
0
votes
1 answer

On Ruby-on-Rails it's possible to pass variables from controller to view through respond_to?

I want to submit a message and after that to show a message and open a popup window. The message is saved properly on DataBase, but the message don't show up , instead I receive this NoMethodError in Private::Conversations#create Showing…
Gabriela Dan
  • 61
  • 1
  • 4
0
votes
1 answer

respond_to from child controller

Im currently modding an open source rails project and i want to do some exports in the project after following many tutorials and recomendations i keep getting the UnknownFormat error, then i realize that in parent controller for all the project…
Strife86
  • 1,135
  • 1
  • 10
  • 18
0
votes
1 answer

My remote form submission is trying to render the pages/_page.js.haml file, but I want it to be pages/_page.html.haml

I'm using haml so hopefully you can understand the html going on here. It's easier to read in my opinion but some people don't like it :p I have a form on my edit page that looks like this: .center_col -# I got into this weird habit of using…
nzifnab
  • 15,876
  • 3
  • 50
  • 65
0
votes
2 answers

Controller action respond_to format error ActionController::UnknownFormat

I have an issue with controller action respond in Ruby on rails app. So, I have two actions in my taskasset_controller with simple code: def destroy if params[:id].present? @asset = TaskAsset.find(params[:id]) authorize @asset,…
Nezir
  • 6,727
  • 12
  • 54
  • 78