[Rails 3.2] form_tag w :remote => true doesn't fire up the js format

I have a form_tag written like this :

= form_tag search_backoffice_places_path, {:remote =>“true”, :id =>
:searchplaceForm } do
… input fields
= submit_tag t(:search)

generated html is correct :

... input fields

upon submit, params received in backoffice/places_controller#search
{“utf8”=>“✓”, “country”=>“United”, “city”=>"", “street_address”=>"",
“wording”=>"*", “commit”=>“Search”, “action”=>“search”,
“controller”=>“backoffice/places”, “locale”=>“en”}

backoffice/places_controller.rb
respond_to :html, :js

def search
… params received
@places = Place.in_country_like(@country).in_city_like(@city)…

@places found 1

respond_to do |format|
  format.html { render :index }
  format.js { }   <=  should render  search.js.erb BUT not ...
end

end

what’s could be wrong ? thanks for feedback ( using asset pipeline )

On 29 November 2012 14:27, Erwin [email protected] wrote:

… input fields

what’s could be wrong ? thanks for feedback ( using asset pipeline )

Can you post the full log for the action (as in log/development.log).

Colin

[SOLVED] Thanks Colin for pointing me to the log …
( test.log… as I am testing integration w Capybara + Selenium… => my
eyes were looking at something else …)

I was looking the old way … => a :format js … parameter…
in non obtrusive way , the log clearly state “Processing… as JS”
and rendering search.js.erb at the bottom …
so my Selenium driver is working fine … which was not so easy to fix
when
working with subdomains…

Started POST “/en/backoffice/places/search” for 127.0.0.1 at 2012-11-29
15:12:05 +0100
Processing by Backoffice::PlacesController#search as JS
Parameters: {“utf8”=>“✓”, “country”=>“United”, “city”=>"",
“street_address”=>"
", “wording”=>"", “commit”=>“Search”,
“locale”=>“en”}

[1m [35mSubdomain Load (0.5ms) [0m SELECT subdomains.
FROM
subdomains WHERE subdomains.name = ‘www’ AND subdomains.locale

‘en’ LIMIT 1
[1m [36mCACHE (0.0ms) [0m [1mSELECT places.* FROM places INNER
JOIN geolocations ON geolocations.place_id = places.id WHERE
(geolocations.country LIKE ‘%United%’) ORDER BY created_at DESC LIMIT 5
OFFSET 0 [0m
[1m [35m (153.3ms) [0m SELECT DATABASE() as db
[1m [36mGeolocation Load (0.5ms) [0m [1mSELECT geolocations.*
FROM
geolocations WHERE geolocations.place_id = 1 LIMIT 1 [0m

Rendered backoffice/places/_place.html.haml (20.7ms)
Rendered backoffice/places/_list.html.haml (199.2ms)
Rendered backoffice/places/search.js.erb (202.7ms)
Completed 200 OK in 43689ms (Views: 5584.8ms | ActiveRecord: 8.1ms)

Le jeudi 29 novembre 2012 15:59:02 UTC+1, Colin L. a écrit :

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs