I have been able to list all jobs for a user with the following code:
In application_helper.rb:
def userjobs
userid = current_user.id
@jobs = Job.find(:all, :conditions => { :user_id => userid })
return(@jobs)
end
In application.rb:
helper :application
In qalayout.html.erb:
<% if logged_in? %>
<a href="javascript:;"
onmousedown="toggleDiv(''viewjobs'');">View your
jobs</a>
<div id="viewjobs" style="display:none">
<% @jobs = userjobs() %>
<% for job in @jobs %>
<%=h job.status %>
<%=h job.filename %>
<%=h job.created_at %>
<%=h job.updated_at %>
<br>
<% end %>
If you are reading this and this is not the best way to do this,
please let me know.
Thanks,
Amrita
--~--~---------~--~----~------------~-------~--~----~
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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---