Hi all,

I've got a feeling this is a quite simple question, but after searching
for an answer don't know where to start!

What I'd like in my app is to have a button, that the user can press,
which then runs a function, and then refreshes the page. The function
itself will go off and look at another url, and possibly save some data,
but I haven't got that far yet, I cant even get it to run a function.

my view code (index) looks like this

...
<%= button_to("BAnd Name", :action => 'search_url') %>
...

my controller code has the 'search_url' function

def search_url

  render 'index'

end

loading the page gives the error

No route matches {:action=>"search_url", :controller=>"edinburgh"}


which suggests it's trying to go to the page edinburgh/search_url, I
dont want it to do this, just run the function, then render index again,
is this possible?

Should I be using a different function to search_url?

Or am I missing something very basic about how websites receive
commands, does every function I execute have to be run from a url
address?

What if I want to pass in arguments to the function, such as
{:action=>"search_url(:bandName => 'The Beatles')"} is this possible??

so many questions, sorry just don't know where to begin!?

-- 
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 [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.

Reply via email to