Displaying 20 results from an estimated 3000 matches similar to: "submit_form for Ajax via 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
2007 Feb 16
13
negate the regexp in validates_format_of
Railsters:
ActiveRecord''s validation system puts other database systems to shame.
However, the newbies might not know how to write a regexp that
excludes a match, instead of tests for it. Understand - I''m just
asking this question to help them. I have been using Regexps since
''grep'' on Xenix! But the newbies here might not know how to do this:
2007 Feb 14
5
FormTestHelper should change hidden fields
Railsoids:
FormTestHelper rules. It tests your response.body form at the same
time as it triggers your action, with all the parameters in that form.
This obviously improves quality.
But it took issue with this:
submit_form ''validate_stuff'' do |form|
form[''IBhidden''] = ''validate''
end
The field IBhidden is a hidden field. To be
2012 Feb 21
1
link_to 'Frob', '/thang/frob', :remote => true
Railsters:
I have finally gotten back to Rails, and I''m having the usual "a
little bit too flexible for your own good" problems.
Specifically, the above in my Haml renders this:
<a href="/thang/frob" data-remote="true">Frob</a>
I need href=''#'' and an Ajax call.
What did I do wrong? (Besides, ahem, attempt to read the fine
2007 Sep 21
1
Do fixture_scenarios and RSpec peacibly coexist?
Railsters:
I just installed fixture_scenarios ...
http://fixture-scenarios.googlecode.com/svn/trunk/fixture_scenarios
...into a project with some RSpec specifications. They all went kablooey.
I didn''t even create a scenario; the system just started calling its version
of fixtures(). The normal tests pass and the RSpec ones unanimously emit:
TypeError in ''Context (verbose
2006 Nov 04
2
how to use LabellingFormBuilder
Railsers:
As usual for a product written very rapidly, most of its documentation
assumes some other documentation told you something critical.
For example, the file form_helper.rb tempts me with this documentation:
# <% form_for :person, @person, :url => { :action => "update" },
:builder => LabellingFormBuilder do |f| %>
That''s beautiful. Now what do I
2007 Apr 04
2
unit tests?
Ezra et al:
I have this problem:
http://rubyforge.org/pipermail/backgroundrb-devel/2006-December/000578.html
Any progress on it? Or are unit tests simply impossible for now?
--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!
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 Oct 30
1
domain language?
RSpeckers:
I went with RSpec instead of Systir because I downloaded and installed
the former first.
(I know that''s not exactly a ringing endorsement! ;-)
I want to compete with FIT and Fitnesse, like this:
http://www.zeroplayer.com/cgi-bin/wiki?TestFlea#tropism
(Click on a Green Bar to distend one test case.)
I want a domain-specific language in the parchment-colored area on the
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
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
2006 Aug 15
5
Set up a default route
Phlip wrote:
> Can I fix it by adding a view called ''inventories''?
That worked, because I have a sufficiently late version of MySQL.
Next question. What does "Set up a default route" mean?
When I read...
http://wiki.rubyonrails.com/rails/pages/Routes
...it reminds me of the Apache documentation for mod_rewrite. I hope
someone appreciates the candor of my
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
2009 Jul 06
8
how to make ZenTest autotest run whenever my tests change
Railsters:
Despite Rails being the only Web platform designed for TDD, a lot of its test
infrastructure is still "cargo cult" - imitating other test rigs instead of
understanding their principles.
Most importantly, tests should run instantly. There''s no excuse for breaking
this rule, and if you invent a platform that can''t obey it then you are doing
something
2008 Feb 18
0
is assert_select indicated for XML?
Railsers:
I''m playing with the Beast, and this test fails:
def test_should_show_topic_as_rss
get :show, :forum_id => forums(:rails).id, :id => topics(:pdi).id,
:format => ''rss''
assert_response :success
assert_select ''channel''
end
It emits "ignoring attempt to close channel with link".
So why are
2006 Nov 21
1
RXML vs form_tag etc
Railsers:
The documentation for *.rhtml views invariably mentions *.rxml views.
They sound like a Good Thing, because some of my generating code mixes
Ruby and HTML so densely that the code is full of %><% markers.
Dropping down to only one language would be a blessing.
However, this documentation invariably avoids mentioning one tiny,
insignificant detail:
How do you inject raw HTML
2007 Feb 04
1
dispatch.cgi -> Anonymous modules have no name
I upgraded to Rails 1.2.1 and deployed to my ISP, who has 1.2.1 ready
and waiting.
The site disappeared into an HTTP 500 error.
So I get into the site, run public/dispatch.cgi or dispatch.rb, and get this:
# ./dispatch.rb
Status: 400 Bad Request
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:405:in
`to_constant_name'': Anonymous modules have no
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
2007 Jan 23
1
assert_select issue
I''d like to do an assert_select where only ONE of the matching elements
needs to match the :text.
It seems counterintuitive to me to require them *all* to match, which
precludes me from testing the existence of a particular tag (h1) with
some particular text if other instances of the same tag exist.
I know that I can narrow down the field by using more detailed
selectors, but it sure
2006 Nov 17
1
SQLite3 put a parse error in my schema.rb for timestamps
Railsers:
I switched from MySQL to Sqlite3 for Test-Driven Development. It meant
the difference between
(Long term, I want to understand the db:migrate system well enough
that I can run a long test, occassionally, that migrates everything to
MySQL and retests it there. That will prevent nasty surprises at
deployment time. But that''s not the current question!)
Because I don''t