Hi Bob,

I have never used "inverse_of" or auto_actions_for with :index, so I've tried to do something similar in a different way:

User model:
has_many :tech_tickets, :class_name => "Ticket", :foreign_key => "technician_id" has_many :tickets, :class_name => "Ticket", :foreign_key => "submitted_by_id"

Ticket model:
attr_accessible :code, :technician, :technician_id, :submitted_by, :submitted_by_id
  belongs_to :technician, :class_name => 'User'
  belongs_to :submitted_by, :class_name => "User", :creator => true

I tried adding "auto_actions_for :technician, :index" to the tickets controller, but hobo_routes seems to expect a "TechTicketsController". This is what "rake routes" says:

technician_tech_tickets GET /users/:technician_id/tech_tickets(.:format) tech_tickets#index_for_technician

I think a possible workaround would be to create a custom action, I tested this in front/index.dryml and it seems to work:

  <collection with="&current_user.tickets"/>

It's not probably what you are looking for but it might help ;).

Regards,
Ignacio


El 11/11/12 22:03, Bob Sleys escribió:
I understand what the router error in the subject is trying to tell me
but I don't see what I've done wrong

In my Ticket model I have

   belongs_to :technician, :class_name => 'User', :inverse_of =>
:tech_tickets, :conditions => ['employee = ?', true]
   belongs_to :submitted_by, :class_name => "User", :creator => true,
:inverse_of => :tickets

In my User model I have the following

   has_many :tech_tickets, :class_name => "Ticket", :inverse_of =>
:technician
   has_many :tickets, :inverse_of => :submitted_by

However when I add the following in my Ticket controller I get the error
in the subject line

   auto_actions_for :technician, :index
   def index_for_technician
     params[:sort] ||= "problem"
     params[:search] ||= ""
     hobo_index_for :technician, :scope => [[:search, params[:search],
[problem]], [:order, parse_sort_param(:problem).join(' ')]]
   end

--
You received this message because you are subscribed to the Google
Groups "Hobo Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/hobousers/-/8BYBwu-zpHMJ.
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/hobousers?hl=en.

--
Ignacio Huerta Arteche
http://www.ihuerta.net
Teléfono: 0034 645 70 77 35
Email realizado con software libre

--
You received this message because you are subscribed to the Google Groups "Hobo 
Users" 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/hobousers?hl=en.

Reply via email to