I'm trying to use the onclick event to redirect the user via a ruby
function. The code is within a "view" html.erb file. The original
table has an entry that works perfectly fine:
...but I'd like for the user to be able to click anywhere on that row
and be directed to the "show" page. If you're feeling generous, can you
also explain why, in this case, "project" suffices, while in this case:
I'm trying to use the onclick event to redirect the user via a ruby
function. The code is within a "view" html.erb file. The original
table has an entry that works perfectly fine:
...but I'd like for the user to be able to click anywhere on that row
and be directed to the "show" page. If you're feeling generous, can you
also explain why, in this case, "project" suffices, while in this case:
I say "edit_project_path(project)"? Where would this method be located?
This method is created for you by rails, based on your routes. There
is another helper, project_path that gives the path for the show
action, but you don't have to use that as link_to assumes that's what
you want to do if you just pass it an active record object.
The ChangeColor methods are defined and function properly, but clicking
the row does nothing :(.
What does your controller code look like ? Is the request made ? does
this product syntactically correct html (eg it wouldn't if the output
from remote_function contained a " ) ?
What does your controller code look like ? Is the request made ? does
this product syntactically correct html (eg it wouldn't if the output
from remote_function contained a " ) ?
My controller code does contain a "show" def, which is requested in the
":action =>" declaration. When the working link is clicked, the "show"
def does the following correctly:
def show
@project = Project.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @project }
end
end