On 27 Apr 2007, at 01:23, Roberto Rivera wrote:
> My friend and I are working on a small app. Today he sent me some
> code.
> I plugged it into my setup but when I tried to retrieve it, I noticed
> CSS wasn''t working properly. Upon inspecting the code I noticed
Rails
> had added a lot of html code.
>
> I end up with: two css links (our own and scaffold.css), two <html>
> tags, two <head> tags, and two <body> tags.
IIRC, the scaffold creates a layout in the folder views/layouts.
You''ll find <%= yield %> in the view code of the layout. Your
.rhtml
files are rendered in this layout if the controller says "layout
''scaffold''" (or whatever it''s called) on top.
Both your views and the
layout contain the <head> and <body> tags, that''s why cou
see them
twice. Layouts are very useful for extracting the common elements
from your webpages.
> I really dont know why this happenned. I checked our scaffolds
> (generated by rails) and none have html code in the source. Like rails
> adds it by default when the page is requested. But I was under the
> impression that scaffolds are unnecessary and one could create its own
> pages.
Yep, scaffolds are just a quick way to generate a fully working CRUD
sequence, but more complex websites will demand a more customized
approach.
Best regards
Peter De Berdt
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---