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.
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.
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.
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:
Encounter the problem.
Google.
Google better.
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.
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)
Ask somebody else.
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.
Never get angry. Angry makes you unreasonable and makes you do silly things, such as formatting a hard drive or destroying a suburb.
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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:
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.
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.
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.
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.