I've seen some similar questions on stack but I don't think this is a duplicate as each answer I've gottent has been specific to one underlying problem.
Ill keep it simple. I'd like to know how to click a link, have it take the user to one page but execute a def from another. This is in a rails application of a web crawler and Its something I thought would be quite simple but turned nasty on me.
At the moment I have:
<td><%= link_to 'Crawl!', crawl_path :controller => :crawl, :action => :crawl %>
This takes the user to the crawler's index page after its done running. What I would like to do is redirect them to a different page. Namely jobs_path which shows a list of the crawlers sites and status (this is working fine, I just want to included it for relevance). If I try it like this:
<td><%= link_to 'Crawl!', jobs_path, :controller => :crawl, :action => :crawl %>
The user is directed to the jobs page but the crawler script never ran and thus the jobs list was never update. For the record, each job is just a url and the depth that it lies at.
Is this just a syntactical error or am I miles off the mark?
Any help appreciated.
What have you set your redirect_to
in crawl#crawl
as? Perhaps set it to redirect to jobs_path
upon completion?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.