Posted By: Todd
Date: 2007-04-05 02:16
Summary: Example site released
Project: Flexible Rails= flex_scaffold RESTfully

Welcome to Example Site for Flexible Rails Scaffolding

Flexible Rails approach is to scaffold REST controllers and generate Flex (swf) views from models including validations.
Use generators to create the .mxml and .as code. Use Rake to compile .swf and publish assets.

see more specifics. To run this example read on ...

Getting started

1. Create a new database: mysql -u root > create database "example-site_development". This example
assumes MySql with root@example-site_development and no password. Change config/database.yml as needed.
2. Change directory into myapp and start the web server: <tt>script/server</tt> (run with --help for options)
3. Go to http://localhost:3000/contacts and get the scaffolded site.
4. Create, edit and delete records - Note the field level validations on the client that have come from the model

Trying new fields and validations

You can change the model and its validations.

Update model

1. Update the model with new fields - change 001.create_contacts.rb (or create a new migration changing the existing table!)
2. rake db:migrate VERSION=0 (to downgrade)
3. rake db:migrate (upgrade)

Add validations

1. Update the validations on the model in /app/models/contact.rb

Now, recompile the client swf

1. rake flex:app mxml=contacts

Go and view the changes at http://localhost:3000/contacts

Description of contents

app/flex This is a new area for creating flex views/projects. These are the current autogenerated files
/contacts from the generator. Other assets are copied into this area ready for compilation. There
/-contacts.mxml rake commands to aid this process (eg rake flex:app and rake flex:compile)

/contacts_controller.rb This controller has the flex_scaffold which scaffolds the REST services.

/model.rb Has sample model validations

/contacts Empty but can be used to override view/flex_scaffold/index.rhtml
/layouts/flex_scaffold.rhtml The template layout for all scaffolded controllers
/flex_scaffold/index.rhtml The basic view that displays the swf files across all scaffolds

/routes.rb Has been updated to include REST routes on controller (as per resource scaffolding)

/001_create_contacts.rb Contains the database schema

/flex_scaffold Contains generate assets needed for Flex (eg crossdomain.xml, playerProductInstall.swf)

/contact_controller_test.rb Generated test

/flex_scaffold This functionality is already loaded

Latest News
TZInfo::Data v1.2014.2 Released
    Philip Ross - 2014-03-25 22:32
TZInfo v0.3.39 Released
    Philip Ross - 2014-03-09 20:23
TZInfo::Data v1.2014.1 Released
    Philip Ross - 2014-03-09 20:00
Automatic Ruby 14.2.0 has been released!
    id 774 - 2014-02-26 06:23
kramdown 1.3.2 released
    Thomas Leitner - 2014-02-16 08:35


Forums | Admin

Discussion Forums: example-site-released

Start New Thread Start New Thread


Topic Topic Starter Replies Last Post