Posted on 2nd November 20092 Responses
ActiveScaffold: How to get started

When I took a first peek at , I had no idea into how much trouble I’d run before creating beautiful AND working backends for my applications. I had LOTS of research to do to get around some rather nasty issues and I want to provide you with some info on how to get stuff done.

Some prerequisites:
I use 2.3.4 at the time this is posted and my gem list shows:

actionmailer (2.3.4)
actionpack (2.3.4)
activerecord (2.3.4)
activeresource (2.3.4)
activesupport (2.3.4)
flickraw (0.7.1)
json (1.1.9)
locale (2.0.4)
locale_rails (2.0.4)
mime-types (1.16)
mysql (2.8.1)
rack (1.0.0)
railroad (0.5.0)
(2.3.4)
rake (0.8.7)
thoughtbot-paperclip (2.3.1)

Installation:
To AS, open a shell and type:
ruby script/plugin git://github.com//active_scaffold.git
Installs AS and all the necessary stuff
ruby script/plugin git://github.com//in_place_editing.git
Ooops, in place editing was missing – so let’s it.
ruby script/plugin --force git://github.com/lackac/render_component.git -r -edge'
Ooops again, render_component was taken out of so subforms wouldn’t work – let’s get around this by installing lackac’s plugin (thanks!)

OK, basically, you are set. What now?
The website (www..com) and especially their API docs are your bible. So read them, re-read them and re-re-read them while building stuff with AS – you will need the (rudimentary) tipps included there.
Ok, now let’s start with integrating AS into our app. Let’s say you have a basic application which already has a master layout. Put this tag into the of your layout:

<%= active_scaffold_includes %>

It includes all the magic needed for AS. To continue, you should have a we can work on, in this case I created a named “customer” to store some customer info in it and work on it with AS:

ruby script/generate customer name:string phone:string email:string description:string is_active:boolean

Migrate the data now:

rake db:migrate

Edit your customers_controller.rb in app/controllers and put

active_scaffold :customer do |config|
end

right after

class CustomerController < ApplicationController

to make AS aware that it should take care of our customers. Now open config/routes.rb and add :active_scaffold => true right after the customer . When you start your server and call /customers, you now should see AS in action. Congratulations, this was the first part ;)

Share this on:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Add to favorites
  • email
  • MisterWong
  • MySpace
  • Reddit
  • RSS
  • Yahoo! Bookmarks

Related posts

Comments
comment by t.morgan
Posted on 05.11.2009 at 18:41

Well written, thank you for this

comment by Stefan Schuchlenz
Posted on 05.11.2009 at 18:49

thanks for commenting!

Leave a Response
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <img src="">