Static scaffolding in Rails2

0 views
Skip to first unread message

Harry Seldon

unread,
Feb 7, 2008, 2:27:30 PM2/7/08
to rubyonra...@googlegroups.com
Hi,

I am looking for a replacement for the static scaffolding of Rails
1.2.x.
Rails 2.x has stopped proving the scaffolding.

Specifically I want to generate a controller from an existing model and
I want to have and freeze the code. Basically I just want to generate a
scaffold on which I am going to build my app (back and frontend). It is
also an example of code (I am still a newbie).
In 1.2.x the command was :
script/generate scaffold post blog/post

I quickly checked active_scaffold and streamlined. But I am not sure
they allow accessing the actual view code (rhtml/rjs/ruby), do they ?

Is static scaffolding completely deprecated, for everybody ?

H
--
Posted via http://www.ruby-forum.com/.

Harry Seldon

unread,
Feb 7, 2008, 2:55:54 PM2/7/08
to rubyonra...@googlegroups.com
And speaking of Active_Scaffold and Streamlined, do they support
polymorphism ?

longint

unread,
Feb 7, 2008, 4:11:27 PM2/7/08
to Ruby on Rails: Talk
You can type: ruby script/generate scaffold --help in your rails
application directory and you'll get the information on scaffolding.
Only dynamic
scaffolding is gone in 2.0 to my knowledge, not static.

On Feb 7, 2:27 pm, Harry Seldon <rails-mailing-l...@andreas-s.net>
wrote:

Michael Slater

unread,
Feb 8, 2008, 12:03:02 PM2/8/08
to Ruby on Rails: Talk
scaffold in Rails 2.0 is what was called scaffold_resource in Rails
1.2.x. It generates a static scaffold using RESTful design.

Michael Slater
www.BuildingWebApps.com

Harry Seldon

unread,
Feb 9, 2008, 7:01:33 AM2/9/08
to rubyonra...@googlegroups.com
OK but can you generate a restful controller from an already existing
model ?

From what I understood it is not possible but I want to be sure.

H

Michael Slater wrote:
> scaffold in Rails 2.0 is what was called scaffold_resource in Rails
> 1.2.x. It generates a static scaffold using RESTful design.
>
> Michael Slater
> www.BuildingWebApps.com

--
Posted via http://www.ruby-forum.com/.

AndyV

unread,
Feb 10, 2008, 3:49:23 PM2/10/08
to Ruby on Rails: Talk
Yes, you can. script/generate scaffold MyModel --skip-migration

Include --skip-migration to bypass the migration generation (you won't
need it since you've already got the model). This will give you the
scaffold but the views themselves may not auto-populate with the
fields.

You could also "script/generate controller MyModelsController index
show new create edit update delete" This definitely will not get the
auto-layout stuff, but it will stub things out for you. If you do
this you'll need to add your own map.resources statement to routes.rb.


HTH,
AndyV

On Feb 9, 7:01 am, Harry Seldon <rails-mailing-l...@andreas-s.net>
wrote:

Harry Seldon

unread,
Feb 10, 2008, 5:22:16 PM2/10/08
to rubyonra...@googlegroups.com
Thx for the answer, I gonna check that. But the part I liked in the
controller generation was in fact the form generation. It helps a lot
the newbies (newbie even in html) like me. I am surprised it has been
deprecated.
I am still looking for it in AS or streamlined.

H


AndyV wrote:
> Yes, you can. script/generate scaffold MyModel --skip-migration
>
> Include --skip-migration to bypass the migration generation (you won't
> need it since you've already got the model). This will give you the
> scaffold but the views themselves may not auto-populate with the
> fields.
>
> You could also "script/generate controller MyModelsController index
> show new create edit update delete" This definitely will not get the
> auto-layout stuff, but it will stub things out for you. If you do
> this you'll need to add your own map.resources statement to routes.rb.
>
>
> HTH,
> AndyV
>
> On Feb 9, 7:01 am, Harry Seldon <rails-mailing-l...@andreas-s.net>

--
Posted via http://www.ruby-forum.com/.

Brian Hogan

unread,
Feb 10, 2008, 11:35:50 PM2/10/08
to rubyonra...@googlegroups.com
Well, if you just want the forms, I made a generator to make that available in Rails 2.0

gem install scaffold_form_generator

See this for more info:

http://scaffoldform.rubyforge.org/

It does NOT generate controllers... just the views for new and edit, along with the partial.

Harry Seldon

unread,
Feb 11, 2008, 1:56:51 PM2/11/08
to rubyonra...@googlegroups.com
That looks like what I was looking for !

Thanks a lot.
H

Brian Hogan wrote:
> Well, if you just want the forms, I made a generator to make that
> available
> in Rails 2.0
>
> gem install scaffold_form_generator
>
> See this for more info:
>
> http://scaffoldform.rubyforge.org/
>
> It does NOT generate controllers... just the views for new and edit,
> along
> with the partial.
>
> On Sun, Feb 10, 2008 at 4:22 PM, Harry Seldon <

--
Posted via http://www.ruby-forum.com/.

Reply all
Reply to author
Forward
0 new messages