--Apple-Mail-41-215164423
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed

On 02 Feb 2005, at 07:45, peter.cutting / tetrapak.com wrote:

> I have alot of questions and (daft) opinions which I will place in this
> thread and hopefully I will get some answers. Thanks alot. Peter
>
> 1) is the "list" really necessary in the following code example taken
> from
> http://dev.rubyonrails.org/svn/rails/trunk/actionpack/lib/ 
> action_controller/scaffolding.rb
> #    def list
> #      @entries = Entry.find_all
> #      render_scaffold "list"
> #    end

Yes.

It would be more code to 'guess' which scaffold you wanted from caller.  
  And it would also get in your way more than you like.

> 2) It would be nice if the command
> ruby script\generate scaffold <model>
> also embedded comments in the generated code which described what name
> is what how the name variations are related to one another. Superfluous
> for the experts, I know. But since the code is so tight already why not
> give the newbies some help

Have you read anything from http://api.rubyonrails.com?  Lots of this  
code is very well described there.

> 3) 2) is especially important since the naming is a bit of nightmare.
> eg all sorts of implicit messing around with leading capitals,
> camelcase, underscores, pluralisations, and other (eg person->people)
> transformations going on. This is all very difficult for mere mortals
> (with shitty memories) to grok

Have you read:

http://rails.rubyonrails.com/files/vendor/actionpack/README.html
http://rails.rubyonrails.com/files/vendor/activerecord/README.html

> 4) what is going on with new and create. Do they work togeather. If so
> how?
> (example taken from same place as above)
> #    def new
> #      @entry = Entry.new
> #      render_scaffold
> #    end
> #
> #    def create
> #      @entry = Entry.new(@params["entry"])
> #      if @entry.save
> #        flash["notice"] = "Entry was succesfully created"
> #        redirect_to :action => "list"
> #      else
> #        render "entry/new"
> #      end
> #    end

ActionController methods are 'actions'...

> 5) What is going on in the generated edit view template?
> <%= error_messages_for 'project' %>
> <%= form 'project', :action => 'update' %>

So this form will be sent to the 'update' action of the current  
controller.

> The error_messages_for bit I dont understand at all.

Well documented on http://api.rubyonrails.com:

http://rails.rubyonrails.com/classes/ActionView/Helpers/ 
ActiveRecordHelper.html#M000236

> Editing a record initiates the edit action which which default renders
> the edit view which seems to (based on the above) start of a update
> action ??? and now I am lost

When you submit the form, yes.  See the documentation for #url_for,  
which is how Rails generates URLs:

http://rails.rubyonrails.com/classes/ActionController/Base.html#M000079

> 6) the list template scaffolding iterates thru columns. Wouldnt it be
> better to inline the columns since they will almost certainly be
> customised later. A lot easier to read and mess about with. (the
> iterated alternative could also be included but switched off and the
> developer could then quickly switch it on to see all the available
> columns).

Sure, go nuts!

Just displaying the columns is 'good enough' because the second thing I  
do after adding a scaffolded controller is rip away all the scaffolding  
and build something sensible with only the columns I need.  (The first  
being adding some good data to play with.)

Rails does all the heavy lifting you don't want to do, and leaves you  
to do the heavy lifting you *should* be doing.

-- 
Eric Hodel - drbrain / segment7.net - http://segment7.net
FEC2 57F1 D465 EB15 5D6E  7C11 332A 551C 796C 9F04

--Apple-Mail-41-215164423
content-type: application/pgp-signature; x-mac-type=70674453;
	name=PGP.sig
content-description: This is a digitally signed message part
content-disposition: inline; filename=PGP.sig
content-transfer-encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFCASV3MypVHHlsnwQRAnDUAJwLdchVypF+psmEVrNVmcRAqvfE9wCg5FSV
5uz96xXB5r6cFnbYkKotU1w=
=lqJP
-----END PGP SIGNATURE-----

--Apple-Mail-41-215164423--