Displaying 2 results from an estimated 2 matches for "array_of_object".
Did you mean:
array_of_objects
2006 May 26
4
shouldn''t this work? - session[:array_of_objects].delete_if {|x| x.id == params[:id]}
I am saving an array of active record objects (college courses) in the
session as session[:course_list]. This is the cart for a registration
controller.
If a student chooses to delete the course from the list I get the :id
as params[:id].
However if I do
session[:course_list].delete_if {|x| x.id ==params[:id]}
does not work.
session[:course_list].delete_at(idx)
works. Ocourse to do this I have
2007 Aug 08
1
Failed to pass arguments to controller method
...apply_settings(arg1, arg2) #where arg1 is a hash, and arg2 is an
array of object
#do some coding
end
In the controller spec:
before(:each) do
@controller = Controller.new
end
it "should test the apply_settings" do
@controller.apply_settings(Hash.new, array_of_object) #where the
arguments are exactly some format
#as required
end
However, it yielded "wrong number of arguments(0 for 1)" error after I ran
the spec. It there anything wrong in my spec?
Cheers!
-...