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 :
<form accept-charset="UTF-8" action="/en/backoffice/places/search"
data-remote="true" id="searchplaceForm" method="post">
... input fields
<input id="searchplace" name="commit" type="submit" value="Search" />
</form>

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 )






--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/V9FLq_7zJBUJ.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Colin Law at Nov 29, 2012 at 2:59 pm

    On 29 November 2012 14:27, Erwin wrote:
    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 :
    <form accept-charset="UTF-8" action="/en/backoffice/places/search"
    data-remote="true" id="searchplaceForm" method="post">
    ... input fields
    <input id="searchplace" name="commit" type="submit" value="Search" />
    </form>

    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 )
    Can you post the full log for the action (as in log/development.log).

    Colin

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Erwin at Nov 29, 2012 at 4:07 pm
    [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 Law a écrit :
    On 29 November 2012 14:27, Erwin <yves_...@mac.com <javascript:>> wrote:
    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 :
    <form accept-charset="UTF-8" action="/en/backoffice/places/search"
    data-remote="true" id="searchplaceForm" method="post">
    ... input fields
    <input id="searchplace" name="commit" type="submit" value="Search" />
    </form>

    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 )
    Can you post the full log for the action (as in log/development.log).

    Colin
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/syeiG-MHNKkJ.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedNov 29, '12 at 2:27p
activeNov 29, '12 at 4:07p
posts3
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Erwin: 2 posts Colin Law: 1 post

People

Translate

site design / logo © 2021 Grokbase