Sha256: 1a7bfa8a05f7ed40bcb97bb5eed8e46cbf5d54d1e1d14204d202751b32d7e4a8
Contents?: true
Size: 1.78 KB
Versions: 318
Compression:
Stored size: 1.78 KB
Contents
Description: The first argument must be a Model. Next comes a list of name:form_element pairs that describe the model and it's database. We will generate a model, a migration, a controller and a route. Please do check the migration and the model because they will likely need tweaking. Example: rails generate inline_forms Thing name:text_field description:text_area yesno:check_box gender:boolean_with_values This will create: create app/models/thing.rb create app/controllers/things_controller.rb route resources :things create db/migrate/20110204074707_inline_forms_create_things.rb app/models/thing.rb: class Thing < ActiveRecord::Base def _presentation #define your presentation here end def inline_forms_field_list [ [ :name, 'name', :text_field ], [ :description, 'description', :text_area ], [ :yesno, 'yesno', :check_box ], [ :gender, 'gender', :boolean_with_values ], ] end end app/controllers/things_controller.rb class ThingsController < InlineFormsController end config/routes.rb: ... resources :things ... db/migrate/20111015234500_inline_forms_create_things.rb class InlineFormsCreateThings < ActiveRecord::Migration def self.up create_table :things do |t| t.string :name t.text :description t.boolean :yesno t.boolean :gender t.timestamps end end def self.down drop_table :things end end
Version data entries
318 entries across 318 versions & 1 rubygems