Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

dylan kane
dylan kane
2,772 Points

ruby on rails with html templates

i am making a ruby on rails web application, and before i even started the rails project, i designed the whole thing with html css and java. now, all i need to do is add sign in sign up and post blog stuff. to do that i need to put the website that is already made into a rails project, what changes would need to be made to the html to make it work exactly like it did when it wasnt in the rails application?

1 Answer

You could do zero changes, but that is not the Rails ways. Some things to note:

  1. Rails helps you not repeat yourself. You have a main application view where you should have all the html repeated, normally that would be all the head and add the yield.

  2. Rails views are modular. You can use helper views, or templates, which are the html files that start with underscore '_'. This files contain an html block that is really common through the website. For example, if you have a navigation bar or footer, it will probably be the same in all the website. Use helpers, they will save your time.

  3. Rails gives you the methods. You can use ruby methods for the linking and the images.

  4. Rails has an asset pipeline. You'll probably want to use them for the images (the directory structure is different than a normal html/css website). Once you understand and apply it, you'll see it is simpler now.

Good luck