class Sidebar < ActiveRecord::Base serialize :config class Field attr_accessor :key attr_accessor :options attr_accessor :default include ApplicationHelper include ActionView::Helpers::TagHelper include ActionView::Helpers::FormTagHelper include ActionView::Helpers::FormOptionsHelper def initialize(key, default, options = { }) @key, @default, @options = key.to_s, default, options end class SelectField < self def input_html(sidebar) select_tag(input_name(sidebar), options_for_select(options[:choices], sidebar.config[key]), options) end end class TextAreaField < self def input_html(sidebar) html_options = { "rows" => "10", "cols" => "30", "style" => "width:255px"}.update(options.stringify_keys) text_area_tag(input_name(sidebar), h(sidebar.config[key]), html_options) end end end =some code on typo My silly question is when do we need nest class? the nested class good for? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---