Displaying 20 results from an estimated 4000 matches similar to: "automatic 'verify :xhr => true' for methods ending with _xhr"
2007 Apr 26
2
assert_select with respond_to JS or xhr?
Hi everyone,
I am a bit confused with xhr? and respond_to.
I have the folloing code in my view to update the ''emails'' ID
link_to_remote(image_tag("refresh"), :update => "emails",
:url => { :action => "list_emails" })
in the controller side i have somthing like :
[..]
respond_to do |type|
type.html { render :action
2006 Jun 24
5
request.xhr? vs. respond_to
Searched around this forum, but didn''t find an answer for this question.
Can you help this newbie understand any overlap and/or difference
between request.xhr? and respond_to?
If request.xhr? is true, should I expect it wants.js below?
respond_to do |wants|
wants.html { redirect_to(person_list_url) }
wants.js
wants.xml { render :xml => @person.to_xml(:include
2008 Mar 31
1
How to make a ajax (xhr) redirect?
Hi all,
In my application, I want seamless degradability so I use request.xhr?
to check whether a request is an ajax call. However here and there, I
need to use redirect_to - in this case the request is not xhr anymore,
and the check doesn''t work as expected. Is there a way to make xhr-
like redirect (which allow to get to another controller+action)?
Thanks,
- Chuong
2006 Jul 12
3
request.xhr? is false after redirecting an AJAX request?
Dear everybody
I''m trying to develop a web application that makes use of AJAX, but also works
if a user has no (or doesn''t want to use) JS. For normal requests, this is
pretty easy. Almost every action ends with
render blahblah, :layout => !request.xhr?
This way, I can use the same action to render a full page (with layout) as
well as rendering an AJAX request (only the
2006 Jul 06
1
multiple xhr requests
Hi I have a window that looks like this
--------------------
| | Enter
--------------------
That box will take a command that the user enters and runs it on a
server in the background loading a new window for the user to view the
results. Is there a way to take multiple xhr requests so that the next
request the user enters , a new window will pop up right away, instead
of
2008 Jun 05
2
xhr :post giving wrong number of arguments on rails 2.1?
Getting a strange error.
In a story I have the following step:
When "I submit a search name" do
xhr :post, ''/searches'', {:search => {:given_name => "bob", :family_name =>
"smith"}}
end
I am getting:
ArgumentError: wrong number of arguments (4 for 3)
stories/searching_story_spec.rb:45 in "I submit a search name"
But I only
2006 Jul 26
4
How to Firebug XHR/AJAX requests
Saw a lot of recommendations for Firebug
(http://www.joehewitt.com/software/firebug/) on this list. I''ve scanned
its docs and tried it--many useful features. But I''m so dense that I
can''t get it to spy XHR/AJAX requests and their response on FC5 running
Firefox 1.5.0.4 and Firebug 0.4.
Can someone tell me how to get to
2006 May 31
0
Help with xhr request in integration tests
Hello,
The documentation at api.rubyonrails.com for
ActionController::TestProcess#xhr or xml_http_reponse gives method as
the first parameter and action as the second parameter folled by the
parameters hash, etc. But ActionController::Integration::Session#xhr
has a path, followed by the parametes hash, and apparently no alias
for xhr. Of course, the documentation in the AWDwR book would tend to
2005 Dec 15
2
link_to_remote and browser compatibility
link_to_remote generates the javascript: new Ajax.Updater(...). Have I
missed something or doesn''t this handle browsers with javascript support
but without XHR support?
What I''d like to do is:
1. If the browser supports XHR, use XHR
2. If the browser supports javascript (and perhaps even if the XHR
request fails) do a POST via javascript
3. If the browser doesn''t
2006 Mar 22
3
Parent-Child Tables Help
can someone help me with this
i have a table
cars
(
id int
model_id int
make_id int
color_id int
description text
constraint fk_cars_carmake foreign key(make_id) references
carmakes(id),
constraint fk_cars_carmodel foreign key(model_id) references
carmodels(id),
constraint fk_cars_color foreign key(color_id) references colors(id)
)
carmakes
(
id int
carmake varchar
)
carmodels
(
id
2012 Mar 07
1
link_to with :remote=>true works when bound to "click" but not "ajax:beforeSend"
Hi. I am trying to do an ajax link in Rails 3.2.1 and jQuery. I am
loading jquery.js and jquery_ujs.js. In my document ready, if I bind
to the event "click," clicking the link fires an event, but if I click
to ajax:beforeSend, it doesn''t. Nothing happens when you click the
link in JQuery. The event does go to the controller, though.
Works:
$(document).ready(function(){
2006 Jul 24
0
Redirect/rendering out of xhr
Hi,
I have a link_to_remote to an action in my controller, which has an rjs file
associated with it. In the action (where @request.xhr? is true), I have
tried to redirect to another page or render to another page. When I do this,
the log says all the redirections/renders were successful, but I remain on
the same page. My rjs file at least does not execute though, which is good.
Any ideas on
2007 Jan 03
0
submit_form for Ajax via xhr
Railsters:
The assert_select system has a submit_form method that reads your
current page''s form, and submits all its fields with their data. This
works great for Test Driven Development because it tests your current
page''s form and your controller''s action at the same time.
Is there a submit_form that calls xhr, to submit a FORM thru Ajax? How
easy would that be to
2010 Oct 18
0
Ajax call-request.xhr? = false Rails 3
I have the following tag in a view:-
<%= form_tag url_for({:controller => params[:area], :action
=> :search, :area => params[:area] }), :method => :get, :remote =>
true do %>
<%= label_tag(:query, "Search for:") %>
<%= text_field_tag("query", params[:query], :autocomplete =>
"off", :onKeyPress=>"return
2007 Jun 27
2
Controller specs not shareable?
Hi
I just wondered if there was a reason why Rails controller specs are
not shareable? eg
describe "All XHR POSTs to /gap/calculate_quote", :shared => true do
controller_name :gap
# ...
end
describe "XHR POST /gap/calculate_quote with valid details" do
it_should_behave_like "All XHR POSTs to /gap/calculate_quote"
# ...
end
blows up with
2009 Oct 14
6
Reinstantiate controller during functional testing
... ok, I may be going about this the wrong way, or perhaps, a less
efficient way than is optimal, but I would like to test a little bit
of AJAX on one of my web pages. When I test this by hand, I bring up
the page which shows a select box, I select an item from the drop down
list, see another select box show up, go back to the first select box,
select a different item, and see something
2010 Sep 21
7
Ajax CSRF in Rails3
I''m using rails3. It does not seem to check the authenticity_token
when doing a POST using Ajax. I traced this to:
module ActionDispatch
class Request < Rack::Request
.....
def forgery_whitelisted?
get? || xhr? || content_mime_type.nil? || !
content_mime_type.verify_request?
end
end
so you don''t check if its a get? or a xhr? (ie ajax request). Is this
correct?
--
2009 Jun 17
4
Serverside AjaxRequest or AjaxUpdater detections
Hi all,
This question might be a long shot, but I''m going to ask it anyway. In
my application, I''ve created a before_filter that does some magic. It
looks like this:
if request.xhr? then
render :update do |page|
page.redirect_to url_for_thingy
end
else
redirect_to redirect_to url_for_thingy
end
This works perfectly, however, I have one annoyance. On the server side,
2006 Jan 05
1
unicode hacks - fixes for webrick and Safari
Hello!
First, thank you Julian for the useful plugin ''unicode_hacks'' <
http://julik.textdriven.com/svn/tools/rails_plugins/unicode_hacks/>.
I have found some problems running my app in development on Webrick
and looking at it with Safari (MacOS X 10.4.3, Safari 2.0.2). Some
files are sent with different sizes (e.g. default css example, or
controls.js ), and it
2008 Feb 21
1
Using Really Simple History on Rails
Hello all,
I am getting Really Simple History working in rails.
I''ve got this history content up etc, but I am a bit lost on how to
capture the XHR response data from the Rails app to insert into the
history.
My understanding would be to have some way of grabbing the response
data from the Rails app, inserting that into the history with
dhtmlHistory.add(''PageName'',