How much scaffold code survives to production?


#1

Hi,

I’m just curious how much scaffold code survives into production. It
seems
to me like a trick to show how quickly a rails app can be developed but
that
it all needs to be replaced along the way. I played with scaffold code a
bit
at the beginning but am not using it anymore.

Any thoughts?

Peter


#2

Peter M. wrote:

Hi,

I’m just curious how much scaffold code survives into production. It
seems to me like a trick to show how quickly a rails app can be developed

Hi, Peter,

yes, but why would one want to call this a “trick”? It’s a great way to
have something functional in no time and develop more (and replacing)
functionality around it. While it is sold as this and nothing more
nobody is tricked IMHO

Regards
Jan


#3

I use scaffold code in production sometimes, but the real advantage is
this:

  1. Write scaffold :yourmodel
  2. Start browser
  3. Insert data into database
  4. Code part of application
  5. Check what it does in your browser, say you’ve coded the “new”
    action, you can check the scaffold “list” action whether it worked or
    not
  6. goto step 4

vs:

  1. Open your database manage application
  2. Insert data into database
  3. Code part of application
  4. Check what it does in your database manager
  5. Check what it does in your browser
  6. goto step 3

The scaffold way saves you time because you don’t need a database
manager. With scaffold you don’t have to do 2 steps every time you code
something.


#4

Of course if you’re writing tests, you don’t need to go through these
steps :slight_smile:

  1. Write tests
  2. Write code that makes tests pass
  3. Rinse and repeat

Pat


#5

I thought the same thing. I don’t use scaffold since I want to customize
the HTML, the fields
displayed, and/or the view methods available.

Is it possible to change the default HTML code for scaffolds and have it
apply to a single Rails
directory and not get overwritten by upgrades?

csn

— Peter M. removed_email_address@domain.invalid wrote:


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


#6

— Jeremy E. removed_email_address@domain.invalid wrote:

On 12/4/05, Peter M. removed_email_address@domain.invalid wrote:

I’m just curious how much scaffold code survives into production. It seems
to me like a trick to show how quickly a rails app can be developed but that
it all needs to be replaced along the way. I played with scaffold code a bit
at the beginning but am not using it anymore.

I use scaffolding extensively in production, but I’ve modified Rails’
default scaffolding to add more features and customization options. I
can’t imagine using the default scaffolds for anything but the
simplest schema.

What file(s) do you edit?

thanks
csn


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


#7

On 12/4/05, Peter M. removed_email_address@domain.invalid wrote:

I’m just curious how much scaffold code survives into production. It seems
to me like a trick to show how quickly a rails app can be developed but that
it all needs to be replaced along the way. I played with scaffold code a bit
at the beginning but am not using it anymore.

I use scaffolding extensively in production, but I’ve modified Rails’
default scaffolding to add more features and customization options. I
can’t imagine using the default scaffolds for anything but the
simplest schema.


#8

Jeremy,

what have you added?

  • Peter

#9

Peter:

I just built a site that had two parts. A public viewable part and an
admin part. The public viewable part all got changed but with the
admin part, the client was happy to save the money and just go direct
with scaffold generated pages. They did everything the client needed
for this simple application and it saved me time and them money.

I think many people use the scaffolding just to get underway. I
think it works fine for that and a bit more than that. For instance,
I put a website together for me to track my time spent on client
projects. I don’t need anything fancy for adding clients, adding
tasks and adding projects, so I use the scaffolding for that.

BUT…to quote from the Agile Web Dev book - “scaffolding is not
meant to be the shake and bake of website design”.

Just my two cents worth.

bruce

PS. Just developed another website this weekend and have to say that
Rails is a marvel. I was drawn into rails through that video you
refer to, but since I have met the product in more depth, I am more
impressed rather than less. Rails is a thing of beauty and
scaffolding is a useful tool.


#10

On 12/4/05, Peter M. removed_email_address@domain.invalid wrote:

what have you added?

These are the main features I added:

Choose which fields are displayed in the scaffold and in which order
Choose which methods are added by the scaffold function
Handle belongs_to associations with select boxes in the new/edit forms
Add HABTM association scaffolding using two select boxes
Add simple search scaffolding (using all fields from new/edit form)
Add scaffolding for merging records (combining two records into one by
updating all associated tables)
Show associated data instead of foreign key integer in show/search
results scaffold
Set the css class of scaffolded tables per ActiveRecord class
Override the input widget type and widget options per attribute
Override the directory of the scaffolded forms per controller


#11

On my system they are in
C:\ruby\lib\ruby\gems\1.8\gems\rails-
0.13.1\lib\rails_generator\generators\components\scaffold\templates
I have a backup copy of my customizations so that when I get around to
updating rails my customizations won’t be overwritten.

Search for these files on your system:
controller.rb
form.rhtml
form_scaffolding.rhtml
functional_test.rb
helper.rb
layout.rhtml
style.css
view_edit.rhtml
view_list.rhtml
view_new.rhtml
view_show.rhtml

~Jason


#12

On 4-dec-2005, at 18:48, Peter M. wrote:

Hi,

I’m just curious how much scaffold code survives into production.
It seems to me like a trick to show how quickly a rails app can be
developed but that it all needs to be replaced along the way. I
played with scaffold code a bit at the beginning but am not using
it anymore.

Little to none.

I want a port of meta and meta.Admin from Django (without Django),
looks like technoweenie is working on it (but I can’t get to
installing darcs which is obviously very lame of me)


Julian ‘Julik’ Tarkhanov
me at julik.nl