hi all,
now i am facing problem with button_to , it shows the path like http://localhost:3000/art/151470;edit instead of
http://localhost:3000/art/edit/151470
the path is not displaying problem, so i got the error , no route found.
in application_helper :
def button_to(name, options = {}, html_options = nil) html_options = html_options.stringify_keys convert_boolean_attributes!(html_options, %w( disabled ))
method_tag = '' if (method = html_options.delete('method')) && %w{put delete}.include?(method.to_s) method_tag = tag('input', :type => 'hidden', :name => '_method', :value => method.to_s) end
form_method = method.to_s == 'get' ? 'get' : 'post'
if confirm = html_options.delete("confirm") html_options["onclick"] = "return #{confirm_javascript_function(confirm)};" end
url = options.is_a?(String) ? options : self.url_for(options) # url = url_for(options) name ||= url
html_options.merge!("type" => "submit", "value" => name)
"<form method=\"#{form_method}\" action=\"#{url}\" class=\"button-to\"><div>" + method_tag + tag("input", html_options) + "</div></form>"
end
rhtml file
<%= button_to ('UPDATE LISTING', {:action => 'edit', :id => @location},{:class=>"native115 blue"}) %>
please let me know, where is my mistake , thanks in advance.