Rails adding extra code?

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
tags, two tags, and two tags.

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.

How do I work that out?

Regards,
az

On 27 Apr 2007, at 01:23, Roberto R. 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
tags, two tags, and two 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 and 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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs