Forum: Ruby on Rails How do I test actionview helpers in the console?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
23e54f005052ce3e25e18fb3b70725e8?d=identicon&s=25 Erik Terpstra (Guest)
on 2006-02-10 14:50
(Received via mailing list)
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.
A44d5abad6e86cff4e34d9f0839535c9?d=identicon&s=25 Rick Bradley (Guest)
on 2006-02-10 15:00
(Received via mailing list)
* Erik Terpstra (erik@terpnet.nl) [060210 08:54]:
>
> <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).
C1e5a9e9344b6d31b9df7303e6dc378a?d=identicon&s=25 Craig White (Guest)
on 2006-02-10 15:01
(Received via mailing list)
On Fri, 2006-02-10 at 13:18 +0100, Erik Terpstra wrote:
> #<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/He...

(hint - click 'show source')

hey...I'm starting to learn these things

Craig
This topic is locked and can not be replied to.