On 31.10.2005, at 18.28, Neeraj Kumar wrote:
> Login to edit an existing page.
> Select a page to edit.
> At the bottom of the page, I get a drop down for
''textfilter'' which
> works just fine . I am wondering how this drop down is actually
> workign. I rightly shows the value from the database as pre
> selected but I didn''t find that the value from database was being
> passed as an argument.
>
> Followings is the code:
>
> In _form.rhtml
>
> <label for="page_text_filter">Textfilter: </label>
> <%= select ''page'', ''text_filter'',
text_filter_options %>
select helper assumes that there is an object called @page with a
method called text_filter at hand. The pre-selected value will by
default be what that method for that particular object returns. This
happens automagically, you don''t have to pass the selected value
explicitly.
//jarkko
>
>
> In base_helper.rb
>
> def text_filter_options
> text_filter_options = Array.new
> text_filter_options << [ ''None'',
''none'' ]
> text_filter_options << [ ''Textile'',
''textile'' ] if defined?
> (RedCloth)
> text_filter_options << [ ''Markdown'',
''markdown'' ] if defined?
> (BlueCloth)
> text_filter_options << [ ''SmartyPants'',
''smartypants'' ] if
> defined?(RubyPants)
> text_filter_options << [ ''Markdown with
SmartyPants'', ''markdown
> smartypants'' ] if defined?(RubyPants) and defined?(BlueCloth)
> text_filter_options
> end
>
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
--
Jarkko Laine
http://jlaine.net
http://odesign.fi
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails