I do feel scaffold is a bit broken

2 views
Skip to first unread message

goodwill

unread,
Apr 8, 2008, 12:02:24 PM4/8/08
to Ruby on Rails: Talk
I come across this thread when I try to share my point of view about
the new Rails 2.0 scaffold.

Again like most of us, we dont disagree with the RESTful approach,
despite the fact I haven't even totally understand that yet.

There are a few issues involved from this new scaffold. From the
different thinking approach direction- I personally think about the
data setup first before I generate the scaffold, so usually I would
just do a model generation first, then scaffold. The approach really
has nothing wrong IMHO. So demolish this original way to work and then
use the new one obviously would cause quite a bit people disappointed.

Furthermore, indeed this new scaffold really have some issues one the
URL handling. While the new active_resource approach creates great
looking URL (especially when you look at the Akita On Rails tutorial
on how the has_many thing works together on Post/Comments), but for
example, to move the scaffold from root to a subfolder (i.e.
namespace) would cost significant amount of work.

I have listed the work required in my blog, you may have a look:
http://bugthis.blogspot.com/2008/04/rails-20-hurts-on-scaffold.html

I only hope there would have a more balanced solution patched in
future version of rails.

goodwill

unread,
Apr 9, 2008, 9:57:51 AM4/9/08
to Ruby on Rails: Talk
Guys I wonder if you ever come across a guy called RSL. He keeps
telling ppl the first rule of programming is Its All Your Fault, with
the codinghorror page enclosed. I am very alleged by him as he doesn't
present solution to people, and indeed just try to insult people with
this ITS ALL YOUR FAULT MAN. Even the comment which I think I have put
reasonable effort to discuss about scaffold problem, I am being
insulted on my blog. I feel disappointed about such member in rails,
despite he did finally help on fixing a weird problem on my leopard
rails (for some reason the gem source for rubyonrails is being
added).

Sorry if I try to write something a bit personal here, but I just feel
I should voice it out.

Russell Norris

unread,
Apr 9, 2008, 10:10:05 AM4/9/08
to rubyonra...@googlegroups.com
You mean the one who helped you sort out the fact that you added gems.rubyonrails.org to yr rubygems sources the other day and showed you how to remove it? That guy? Yes, I've run into him. You have a little song called "gimmegimmegimme, it's never my fault, fix my problems for free, and make sure you stroke my ego too". It's really catchy apparently as a lot of people sing it. I still stand by my assertion that the first rule of programming _is_ that it's your fault. When you come whining into help forums, chat rooms, and other places asserting that a tool that works for other people is broken... You're showing a hubris that far surpasses the good kind advocated by Larry Wall [http://c2.com/cgi/wiki?LazinessImpatienceHubris]. Code does not magically change itself. Programming is science not sorcery. It's always the programmer's fault. Especially when 1. you're an admitted new user stuck on the "hard" parts of scaffolding and 2. the problem isn't universal.

RSL

Ryan Bigg (Radar)

unread,
Apr 9, 2008, 10:10:20 AM4/9/08
to rubyonra...@googlegroups.com
On Wed, Apr 9, 2008 at 11:27 PM, goodwill <william....@gmail.com> wrote:

Guys I wonder if you ever come across a guy called RSL.

Yes.
 
He keeps
telling ppl the first rule of programming is Its All Your Fault,

That's because it is.
with
the codinghorror page enclosed.

And with good reason.
I am very alleged

Correct word is "offended"
by him as he doesn't
present solution to people,

He does. As long as if you can't google it or it's something incredibly simple.
 
and indeed just try to insult people with
this ITS ALL YOUR FAULT MAN.

That's because it is.

Even the comment which I think I have put
reasonable effort to discuss about scaffold problem, I am being
insulted on my blog.
The comments on your blog are subject to your approval. Delete them. It should be the button on the right. If you can't find it, google it.
 
I feel disappointed about such member in rails,

I don't. rsl is a smart guy. He's not helping you because what you're asking can be googled.

despite he did finally help on fixing a weird problem on my leopard
rails (for some reason the gem source for rubyonrails is being
added).

Sorry if I try to write something a bit personal here, but I just feel
I should voice it out.

No problem dude.

Goodwill, I already posted the "Life Cycle of a Problem" as a comment to your blog, but I'll repost it here:

1. Encounter the problem.
2. Google.
3. Google better.
4. Google harder, changing/removing keywords to get better results. Don't paste the whole damn error, just perhaps the class name such as ActiveRecord::RecordInvalid.
5. Ask somebody. Format your sentences properly using correct english (not that you haven't done this, just that some people's english skills are not all that great)
6. Ask somebody else.
7. Post about it somewhere in detailed format. Don't say "omg it's broken!1!!!" Explain what "it" is, how it's broken and what you were doing before it was broken.
8. Never get angry. Angry makes you unreasonable and makes you do silly things, such as formatting a hard drive or destroying a suburb.
9. Rejoice when it's fixed.


For those of you who don't know, goodwill runs a blog: http://bugthis.blogspot.com/. He posts stuff on this blog, as all good bloggers do.
 


On Apr 9, 12:02 am, goodwill <william.yeung...@gmail.com> wrote:
> I come across this thread when I try to share my point of view about
> the new Rails 2.0 scaffold.
>
> Again like most of us, we dont disagree with the RESTful approach,
> despite the fact I haven't even totally understand that yet.
>
> There are a few issues involved from this new scaffold. From the
> different thinking approach direction- I personally think about the
> data setup first before I generate the scaffold, so usually I would
> just do a model generation first, then scaffold. The approach really
> has nothing wrong IMHO. So demolish this original way to work and then
> use the new one obviously would cause quite a bit people disappointed.
>
> Furthermore, indeed this new scaffold really have some issues one the
> URL handling. While the new active_resource approach creates great
> looking URL (especially when you look at the Akita On Rails tutorial
> on how the has_many thing works together on Post/Comments), but for
> example, to move the scaffold from root to a subfolder (i.e.
> namespace) would cost significant amount of work.
>
> I have listed the work required in my blog, you may have a look:http://bugthis.blogspot.com/2008/04/rails-20-hurts-on-scaffold.html
>
> I only hope there would have a more balanced solution patched in
> future version of rails.




--
Ryan Bigg
http://www.frozenplague.net
Feel free to add me to MSN and/or GTalk as this email.

Brian Hogan

unread,
Apr 9, 2008, 10:57:49 AM4/9/08
to rubyonra...@googlegroups.com
The answer is simple - scaffolding in Rails 2.0 is what it is, and it's not going to change. The main reason it won't is that very few people actually use it. It's not really designed for production, it makes BDD or TDD near impossible, and it often generates more than you need. 

Some people like the form generation that you got with the old scaffolding. I know I did, it was the only part of scaffolding I really liked because I find form generation to be tedious when I am working with existing databases. My solution was to develop a gem called scaffold_form_generator


sudo gem install scaffold_form_generator

Then given an existing model

ruby script/generate scaffold_form User users

Generates
app/views/users/_form.html.erb
app/views/users/new.html.erb
app/views/users/edit.html.erb

This has been useful to a few people and solved their pain points.  My point here is that if you see something that Rails does that you disagree with, you have the power to change how it works, or use something different. Rails is opinionated and sometimes the opinions of the core team differ from mine.   95% of the time, we agree, but when we don't, I just build something myself.

goodwill

unread,
Apr 9, 2008, 11:20:47 AM4/9/08
to Ruby on Rails: Talk
No I never feel its a good thing to delete somebody's msg unless its
some really dirty one. I don't understand why you say its googling
going to fix that viewpoint difference. I agree with you I have some
misunderstanding on the namespace problem. But as Brian commented, I
think he kinda feels what I am missing- sometimes some simple entity
scaffold just save me some time (I know it may not be a lot). And if
they do intend to push RESTful with the new scaffold, I think my
comments worth consideration to patch it properly. so its going to be
more useful.

And for that problem I have asked, I just found its being asked in
RubyonRails Talk but its not being answered, thats why I would start
to seek help for #rubyonrails. Tried to google with ruby on rails mac
os x time_zone error with no luck. Maybe I just can't think of proper
keyword to find it.

RSL is a smart guy I agree, but I really feel I am not being respected
somehow. Try to do a few hours googling and for some reason you cant
find an answer, then somebody post you that passage when you are
trying to pull your hair out. I maybe just blind on googling, but I
think I did tried hard enough before I do ask a question.

On Apr 9, 10:10 pm, "Ryan Bigg (Radar)" <radarliste...@gmail.com>
wrote:
> On Wed, Apr 9, 2008 at 11:27 PM, goodwill <william.yeung...@gmail.com>
> Ryan Bigghttp://www.frozenplague.net

goodwill

unread,
Apr 9, 2008, 11:23:32 AM4/9/08
to Ruby on Rails: Talk
Thanks Brian, I will have a look. I wonder if we could do some patch
on the generator script (or install another generator if possible?) So
that would look like the way I want. Maybe I should peek your code on
scaffold_form_generator to find out how to do it.

On Apr 9, 10:57 pm, "Brian Hogan" <bpho...@gmail.com> wrote:
> The answer is simple - scaffolding in Rails 2.0 is what it is, and it's not
> going to change. The main reason it won't is that very few people actually
> use it. It's not really designed for production, it makes BDD or TDD near
> impossible, and it often generates more than you need.
>
> Some people like the form generation that you got with the old scaffolding.
> I know I did, it was the only part of scaffolding I really liked because I
> find form generation to be tedious when I am working with existing
> databases. My solution was to develop a gem called scaffold_form_generator
>
> sudo gem install scaffold_form_generator
>
> Then given an existing model
>
> ruby script/generate scaffold_form User users
>
> Generates
> app/views/users/_form.html.erb
> app/views/users/new.html.erb
> app/views/users/edit.html.erb
>
> This has been useful to a few people and solved their pain points.  My point
> here is that if you see something that Rails does that you disagree with,
> you have the power to change how it works, or use something different. Rails
> is opinionated and sometimes the opinions of the core team differ from mine.
>   95% of the time, we agree, but when we don't, I just build something
> myself.
>
> On Tue, Apr 8, 2008 at 11:02 AM, goodwill <william.yeung...@gmail.com>

Russell Norris

unread,
Apr 9, 2008, 11:27:38 AM4/9/08
to rubyonra...@googlegroups.com
Respect is earned not doled out like candy. People who come in public forums asserting that the language/framework/tool is broken don't get respect. People who come in those forums stating "Hey, I'm doing foo and keep getting bar... What am I doing wrong" do.

RSL

Ryan Bigg (Radar)

unread,
Apr 9, 2008, 11:45:41 AM4/9/08
to rubyonra...@googlegroups.com
goodwill,

In regards to your mac time_zone problem, I entered those EXACT THREE WORDS in the EXACT SAME ORDER into the EXACT SEARCH ENGINE and I immediately got this as a link: http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/816758f158368da1

Wouldn't just so happen to be EXACTLY the same problem you were getting now, would it?

--
Ryan Bigg
Egotistical Maniac and Friendly Help Minion
http://www.frozenplague.net

goodwill

unread,
Apr 9, 2008, 11:53:25 AM4/9/08
to Ruby on Rails: Talk
Please read the entire thread- Thats the thread I am referring to
which asked the question and no one has answered until I have asked
again and on #rubyonrails, so RSL come out and answer the question. My
post is the 2nd one.

On Apr 9, 11:45 pm, "Ryan Bigg (Radar)" <radarliste...@gmail.com>
wrote:
> goodwill,
>
> In regards to your mac time_zone problem, I entered those EXACT THREE WORDS
> in the EXACT SAME ORDER into the EXACT SEARCH ENGINE and I immediately got
> this as a link:http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/...

James Byrne

unread,
Apr 9, 2008, 11:55:50 AM4/9/08
to rubyonra...@googlegroups.com
RSL ___ wrote:
> Programming is science not sorcery.

Rather, it is an art. The discovery of how to express a thought within
the constraints of the medium chosen.

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

goodwill

unread,
Apr 9, 2008, 12:00:11 PM4/9/08
to Ruby on Rails: Talk
Ok maybe you feel I am complaining. I probably should just throw away
generate scaffold and write my own to fix it in your aspect.

I respect your skill again, but I am not aligned with you in this
regard. People who shout this is wrong without clear elaboration
should not be taken care- but I think I am trying to say there is
something wrong in that generator- and oh I do like rails, just why
this thing work so differently comparing to 1.x and why it seems not
really improved? I think a well written discussion with respect to
everyone (dont say you should fix it because thats how I expect it to
work, for example) somehow should have value. I am just asking for
viewpoints, so to see if its my blind eye havent see this problem in
some aspect or there are people agreeing with what I talk about, and
hopefully going to be patched by someone (or even myself?)

Do I say its broken? I don't think so, even if I do, I am just saying
my beloved tool has some glitches (like most thing in the world..) and
I hope there is a way to fix it. I really don't understand why you
just feel I am asking a question and not googling enough.

On Apr 9, 11:27 pm, "Russell Norris" <r...@swimcommunity.org> wrote:
> Respect is earned not doled out like candy. People who come in public forums
> asserting that the language/framework/tool is broken don't get respect.
> People who come in those forums stating "Hey, I'm doing foo and keep getting
> bar... What am I doing wrong" do.
>
> RSL
>
> On Wed, Apr 9, 2008 at 11:20 AM, goodwill <william.yeung...@gmail.com>

James Byrne

unread,
Apr 9, 2008, 12:36:18 PM4/9/08
to rubyonra...@googlegroups.com
goodwill wrote:
> Ok maybe you feel I am complaining. I probably should just throw away
> generate scaffold and write my own to fix it in your aspect.

Please understand that none of us are criticizing you and most of us
have felt similar frustration at various times with Rails and Ruby and
similar technologies. Nor are we saying that you should just "suck it
up".

What you are being told is that your problem is ignorance. Now, do not
get upset at this because each and every programmer alive is far more
ignorant than they are knowledgeable. It is just that all of us possess
some small patch of intellectual property that we comprehend better than
anyone else and sometimes we imagine that patch is much larger than it
really is.

Rails 2.0 broke with its past and went down the road of ReST, taking
those of us who cared to follow along with it. The change to
scaffolding from 1.2 to 2.0 is one of the consequences of that decision.
It is not as simple as rewriting your own scaffold generator, it is a
matter of coming to understand that there is an entirely different way
of accomplishing what you wish to do than was previously the case.

The conceptual change that ReST presents can be hard to grasp,
particularly when one is familiar with a fundamentally different way of
accomplishing the same things. It is much the same as breaking from
procedural languages and coming to understand object programming. The
difference is profound but the all the evident distinctions are often
subtle and hard to appreciate.

Instead of immediately writing your own generator to do what you think
that you want, you are should reconsider how you would accomplish what
you desire within the new constraints of Rails 2.0. This, in the end,
will prove the more profitable and enlightening course. And that is why
the advice you have been given is essentially to reflect deeply on what
you are saying and how you might alter your approach to your problem.

The pain will pass if you persevere.

goodwill

unread,
Apr 9, 2008, 12:51:42 PM4/9/08
to Ruby on Rails: Talk
James,
I appreciate a lot on your reply. I agree I probably have some
ignorance in some sense (and thats why I need comments).
I personally feel I really still want a working scaffold with proper
REST support. The REST thing is cool, its just that to me I feel
frustrated how it works now. Maybe its correct to say I should just
get rid of scaffolding, but I do miss it. I am dirty and lazy sometime
(esp when deadline is close) so I do use scaffold, and customers are
just happy with that and I could spend more time to fix more important
tasks. So when I found the generator problem in scaffold, that kinda
burn me hard.

I understand like most wizard feature, scaffold probably are just some
code candy. But then it has been a helpful servant, so I still miss
it. I won't give up rails afterall as its way lot better than PHP to
me (I always feel dizzy trying to find out where to start on a php
project, but rails is so natural to just find the controller which
does the task I am concern about).

So what should I do? :( For now probably just bear with it and does
all the painful patching after scaffold generation to move that
properly to namespaces, long run... I really hope a better scaffold
will come out.

On Apr 10, 12:36 am, James Byrne <rails-mailing-l...@andreas-s.net>
wrote:

s.ross

unread,
Apr 9, 2008, 12:56:11 PM4/9/08
to rubyonra...@googlegroups.com
On Apr 9, 2008, at 9:51 AM, goodwill wrote:
I really hope a better scaffold
will come out.

Have you considered ActiveScaffold (http://activescaffold.com/)? It's very different from a generator because it does create things dynamically, but it supports REST and has a lot of keen Ajax features. Have a look.

James Byrne

unread,
Apr 9, 2008, 12:58:24 PM4/9/08
to rubyonra...@googlegroups.com
goodwill wrote:

>
> I understand like most wizard feature, scaffold probably are just some
> code candy. But then it has been a helpful servant, so I still miss
> it. I won't give up rails afterall as its way lot better than PHP to
> me (I always feel dizzy trying to find out where to start on a php
> project, but rails is so natural to just find the controller which
> does the task I am concern about).
>

The scaffold is still there, in a sense, it just will not respond
dynamically to changes in the underlying table as in version 1.2. If
you simply want a quick and dirty admin form to do direct DB maintenance
then take a look at:

http://api.rubyonrails.com/classes/ActionView/Helpers/ActiveRecordHelper.html#M001003

goodwill

unread,
Apr 9, 2008, 1:20:39 PM4/9/08
to Ruby on Rails: Talk
Hmm... if thats just missing dynamic scaffold I won't be posting this
blog post/message at all :)
I don't mind its static- as most case I replace that to static at
soonest because the field naming just doesnt look good, and in some
cases it show up fields that suppose to be hidden from users' eyes.

The real pain about this new scaffold is that doesn't really work as
well as the original in terms of generating in namespaces, as well as
the missing partial form file. I don't mind to modify view file myself
as long as there are no duplicate work. Now the modifications for
adding a few ripple to new/edit form as well as the show form, which
makes it kinda tedious to do so. Furthermore I tried script/generate
scaffold admin/post title:string that would create a not working
scaffold because the table is then being named as admin_post, but the
model seems still try to do Select * from Posts when a find all search
is being triggered. So basically its not working. Trying to generate
it without the namespace again requires a lot of work to put it back
to the correct namespace folder (all the _url and _path functions are
broken) which means again its not working. The problem doesn't look
requires rocket science to fix so I would hope I could spare enough
time to drill in a bit and hopefully fix it.

I will have a look on your ARHelper link, thanks in advance.

On Apr 10, 12:58 am, James Byrne <rails-mailing-l...@andreas-s.net>
wrote:
> http://api.rubyonrails.com/classes/ActionView/Helpers/ActiveRecordHel...
>
> --
> Posted viahttp://www.ruby-forum.com/.

August Lilleaas

unread,
Apr 9, 2008, 1:26:02 PM4/9/08
to rubyonra...@googlegroups.com
rsl. Yes, you are right. And when you're not right (which is not often),
you admit it. I do however urge you to shut the fuck up and be polite.
It's annoying to listen to your whining. You _are_ right, and it _is_
peoples own fault. But why do you have to yell about it?

Is 90% of the people you encounter annoying you, because they think it's
someone else's fault? Then gtfo of the community, you're the minority.
You're pissing people off.

Russell Norris

unread,
Apr 9, 2008, 2:10:43 PM4/9/08
to rubyonra...@googlegroups.com
leethal, my response in this matter has been just that. a _response_ to "goodwill"s assertions that i am disrespecting him by not putting up with his asserting things are broken which are not. i am not yelling. i am not getting emotionally attached here. [projection much?] i don't find anywhere close to 90% of any segment of the Ruby community [even new users] annoying. don't take out yr personal frustrations with me in a public forum. thank you.

RSL

goodwill

unread,
Apr 9, 2008, 11:26:20 PM4/9/08
to Ruby on Rails: Talk
Ross,
I like code generator more because it could be modified later for more
detail adoption. ActiveScaffold is a good stuff though, so thanks for
your pointer.

On Apr 10, 12:56 am, "s.ross" <cwdi...@gmail.com> wrote:
> On Apr 9, 2008, at 9:51 AM, goodwill wrote:
>
> > I really hope a better scaffold
> > will come out.
>
> Have you considered ActiveScaffold (http://activescaffold.com/)?It's  

goodwill

unread,
Apr 9, 2008, 11:27:33 PM4/9/08
to Ruby on Rails: Talk
James,
It turns out creating my own modified version of generator is not that
hard:
http://wiki.rubyonrails.org/rails/pages/UnderstandingGenerators

I probably would do a few code hack this weekend to come up with
mine :) Then let's see if my solution is going to help some people out
from their pain :)


On Apr 10, 12:58 am, James Byrne <rails-mailing-l...@andreas-s.net>
wrote:
> goodwill wrote:
>
> > I understand like most wizard feature, scaffold probably are just some
> > code candy. But then it has been a helpful servant, so I still miss
> > it. I won't give up rails afterall as its way lot better than PHP to
> > me (I always feel dizzy trying to find out where to start on a php
> > project, but rails is so natural to just find the controller which
> > does the task I am concern about).
>
> The scaffold is still there, in a sense, it just will not respond
> dynamically to changes in the underlying table as in version 1.2.  If
> you simply want a quick and dirty admin form to do direct DB maintenance
> then take a look at:
>

Julian Leviston

unread,
Apr 10, 2008, 3:04:55 AM4/10/08
to rubyonra...@googlegroups.com
Not to mention the fact that he's free to continue to use Rails 1.2.

Julian.


Learn Ruby on Rails! Check out the FREE VIDS (for a limited time)
VIDEO #3 out NOW!
http://sensei.zenunit.com/

goodwill

unread,
Apr 15, 2008, 8:47:26 AM4/15/08
to Ruby on Rails: Talk
True, but the new RESTful feature is useful, thats why I am a bit
greedy and hope I could have best of both worlds.

On Apr 10, 3:04 pm, Julian Leviston <jul...@coretech.net.au> wrote:
> Not to mention the fact that he's free to continue to use Rails 1.2.
>
> Julian.
>
> Learn Ruby on Rails! Check out the FREE VIDS (for a limited time)  
> VIDEO #3 out NOW!http://sensei.zenunit.com/

goodwill

unread,
Apr 22, 2008, 11:36:03 AM4/22/08
to Ruby on Rails: Talk
Want to let everyone know that I am almost done hacking the generator.
However I hit into an issue which due to my short age with ruby I
don't understand how to implement properly- the route_resources
command does not allow me to do namespace. I want to add 2 methods,
one to add namespace, the other one to do route_resources within a
specified namespace, how should I add it to the Rails generator create
command? (I bet its something like extend/include an addon module? but
somehow I am a bit confused on this one still) it would be great if
someone could contribute this piece of code.

Most important thing: you may get the code from google code:

http://code.google.com/p/rails-sfold-resources/

Simply use SVN to checkout and put it in your .rails home to play
around it. Or you may also create a new rails project and then throw
it inside lib/generators.

Ryan Bigg (Radar)

unread,
Apr 23, 2008, 10:13:00 PM4/23/08
to rubyonra...@googlegroups.com
I am amazed by your sheer determination and equal amount of stupidity.

I honestly don't know what else to say.
--
Ryan Bigg

goodwill

unread,
Apr 27, 2008, 4:20:16 AM4/27/08
to Ruby on Rails: Talk
Guys I made an update- now it will also generate appropriate routes
inside routes.rb (but the indentation need some tuning, which I will
fix it later) Basically I tried to do 2-3 level namespaces nesting and
they all work correctly now.

Known issues:
1. Imperfect indentation in routes.rb- will be fixed very soon
2. Ugly code: the extended route_resources_in_namespace is really some
quick hack thus it has quite a bit duplications
3. Destroy does not remove namespace route, you have to do it yourself
4. Multiple scaffold elements does not reuse namespace code block,
thats really difficult to fix as it has to follow the entire hierarchy
to make sure the namespace is suitable to be used. Anyway I think its
minor issue as all you really need to fix are just inside routes.rb.

Please let me know if you have any questions, and if you found it
useful, please reply the post so I know you are using it :)
Reply all
Reply to author
Forward
0 new messages