I have a service_ticket model that has_many :activities. Each of those
activities habtm :employees. My goal is to have a single page for the
service ticket model where one could add the activites and then specify
the employees attached. However when trying to do this, the nested
link_to_function for the employees doesn’t seem to escape the partial
properly. Is there a function floating around in the ruby docs to help
here?
the helpers…
def add_activity_link(name)
link_to_function name do |page|
page.insert_html :bottom, :activity_items, :partial => ‘activity’,
:object => Activity.new
end
end
def add_employee_link
link_to_function ‘Add Employee’ do |page|
page.insert_html :bottom,
“$(this).up(‘tr’).down(’.crew_of_employees’)”, :partial => ‘activity’,
:object => Employee.new
end
end
the partials…
Employee:
Activity:
<% new_or_existing = activity.new_record? ? ‘new’ : ‘existing’ %>
<% prefix = “service_ticket[#{new_or_existing}_activity_attributes][]”
%>
<% fields_for prefix, activity do |f| -%>
<% end -%>
and finally the error…
Error: missing } after property list
Source File: http://localhost:3000/service_tickets/137/edit#
Line: 2, Column: 106
Source Code:
‘).down(\’.crew_of_employees\’), { bottom:
any ideas?
Thanks.