Displaying 1 result from an estimated 1 matches for "remove_subject".
2008 Mar 26
0
Removing an element from an array
...ubjects = find_added_subjects
@added_subjects << Subject.find(params[:id])
render :partial => ''added_subjects'', :layout => false
end
I tried this for the remove,
View
<%= link_to_remote ''Remove'',
:url => { :action => ''remove_subject'', :id => subject },
:update => ''added_subjects'' %>
Controller
def remove_subject
@added_subjects = find_added_subjects
@added_subjects.reject! { |subject| subject.id == params[:id] }
render :partial => ''added_subjects'', :l...