Sha256: 51b31a9cf86d903e591f2890c06147808c0f95f60eaa2e30e66a6cbac3dd50ec
Contents?: true
Size: 1.06 KB
Versions: 13
Compression:
Stored size: 1.06 KB
Contents
require 'rubygems' require 'ramaze' require 'sequel' require 'scaffolding_extensions' # More information on Scaffolding Extensions here: http://scaffolding-ext.rubyforge.org/ DB = Sequel.sqlite # Sequel::Model doesn't support schema creation by default # So we have to load it as a plugin Sequel::Model.plugin :schema class User < Sequel::Model(:user) set_schema do primary_key :id varchar :name text :description end create_table unless table_exists? # Add a couple of users to our database create(:name => 'manveru', :description => 'The first user!') create(:name => 'injekt', :description => 'Just another user') end ScaffoldingExtensions.all_models = [User] class UserController < Ramaze::Controller map '/user' scaffold_all_models :only => [User] end class MainController < Ramaze::Controller def index %{Scaffolding extension enabled for <a href="http://sequel.rubyforge.org/classes/Sequel/Model.html"> Sequel::Model </a> User. You can access the scaffolded Model at #{a('/user')}} end end Ramaze.start
Version data entries
13 entries across 13 versions & 1 rubygems