Displaying 3 results from an estimated 3 matches for "template_object".
2009 Oct 15
4
Getting the object in fields_for
I''m using the fields_for helper with accepts_nested_attributes_for
The System model has_many children.
If I do this in my haml template:
-form_for @system do |s|
=s.text_field :name
-s.fields_for :children do |child_fields|
=child_fields.text_field :name
all is fine. The fields_for iterates over all children and puts the
correct data in the fields.
But...what I
2006 Mar 25
0
in_place_collection_editor
...; options[:action].to_s if options and options[:action]
url
end
end
@controller = @controller.new
end
But I''m not able to use this setup as ActionView::Helpers::InstanceTag
uses a method of CGI to get to the instance variable set on the controller:
def object
@object || @template_object.instance_variable_get("@#{@object_name}")
end
Also the structs don''t seem to behave as I expected them to (they don''t
seem to respond to .send, nor am I able to access properties), weird
thing is that ActiveRecord objects do behave.
I''d like to be able to de...
2005 Mar 09
9
Unit testing + instance variables
After *much* digging and playing around, I finally figured out how to
unit test instance variables that are created by actions. It was
more difficult than I expected. It seems like there should have been
a more straight forward way to do this. Can someone enlighten me? A
simplified and somewhat contrived example of what I am current doing:
Thanks.
Matt
>>
# My Controller of interest