Erik Terpstra
2006-Feb-10 13:50 UTC
[Rails] How do I test actionview helpers in the console?
I would like to see the output of actionview helper methods, to be able to play with it. When I do the following in the console: collection_select("job", "client_id" , @clients, "id", "name") I get: NoMethodError: undefined method `collection_select'' for #<Object:0xb7cf1970> I''d like to get something like: <select name="job[client_id]"> <option value="1">Francisco Hernandez</option> <option value="2">James Earl</option> </select> Is this possible? TIA, Erik.
Rick Bradley
2006-Feb-10 14:00 UTC
[Rails] How do I test actionview helpers in the console?
* Erik Terpstra (erik@terpnet.nl) [060210 08:54]:> When I do the following in the console: > > collection_select("job", "client_id" , @clients, "id", "name") > > I get: > > NoMethodError: undefined method `collection_select'' for > #<Object:0xb7cf1970> > > I''d like to get something like: > > <select name="job[client_id]"> > <option value="1">Francisco Hernandez</option> > <option value="2">James Earl</option> > </select> > > Is this possible?To my knowledge (I had a recent question about testing helper that call ActionView helper methods) you have to do some includes to get things visible. IIRC: include ActionView::Helpers::TagHelper include ActionView::Helpers::UrlHelper Not sure if more are needed or not. Rick -- http://www.rickbradley.com MUPRN: 988 | at times when the random email haiku | search indexer isn''t running | (which was my first guess).
Craig White
2006-Feb-10 14:01 UTC
[Rails] How do I test actionview helpers in the console?
On Fri, 2006-02-10 at 13:18 +0100, Erik Terpstra wrote:> I would like to see the output of actionview helper methods, to be able > to play with it. > > When I do the following in the console: > > collection_select("job", "client_id" , @clients, "id", "name") > > I get: > > NoMethodError: undefined method `collection_select'' for > #<Object:0xb7cf1970> > > I''d like to get something like: > > <select name="job[client_id]"> > <option value="1">Francisco Hernandez</option> > <option value="2">James Earl</option> > </select> > > Is this possible?---- http://rails.rubyonrails.com/classes/ActionView/Helpers/FormOptionsHelper.html#M000352 (hint - click ''show source'') hey...I''m starting to learn these things Craig