On Feb 20, 2011, at 12:03 AM, Moon Moon wrote:
Hi all
I am using form_tag helper and everything is sent by the get method.
In the url looks like :
http://localhost:3000/posts?utf8=%E2%9C%93&search=rails
The utf8 attributes is pretty much ugly.
Is there a way (in Rails 3) the url looks like something like :
http://localhost:3000/posts/search/rails
If yes what do I need to change in my code ?
Here is my code
<% form_tag posts_path, :method => 'get', :class => "mainsearch" do %>
<%= text_field_tag :search, params[:search], :class => "keyword" %>
<%= submit_tag '',:class => "submit" %>
<% end %>
Just change :method => 'get' to :method => 'post' and you'll have a
cleaner search. But using GET for a search is actually a good idea,
because it allows the results to be bookmarked or shared. Ugly,
perhaps. But still useful.
Walter
Cheers
Moon
--
Posted via http://www.ruby-forum.com/.
--
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-
[email protected].
To unsubscribe from this group, send email to [email protected]
.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
.
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.