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
Cameron Bourke
10,198 PointsBuilding Complex Websites
I've been really struggling to find what each languages place is for building web apps. I have noticed many of the better websites, such as treehouse use RoR. However there page source shows that is built with html/css. I understand that html/css are markup languages and RoR is a programming language, but I can't seem to work out how the two come together. Do you write the html/css/js first and then add that to a ruby application for example?
Any answers would be greatly appreciated!
4 Answers
Stone Preston
42,016 Pointshtml and css are used to make the design/structure of the site while RoR is what actually makes the site work. you embed ruby code into the html and css using embedded ruby.
you embed ruby code and use the rails framework to add the functionality you want such as adding friends, getting data from the database, updating the database etc but the actual look of the site comes from html/css
Cameron Bourke
10,198 PointsThanks for clearing this up Stone! So to start with, you can write the html/css/js first without worrying about Ruby, and then once that is done you embed the ruby code. Is that correct?
Stone Preston
42,016 Pointsyes you can do that. here is what some embedded ruby looks like within html:
<title>My website | <%= yield(:title)%></title>
the embedded ruby is the part between the <%= %> tags which would output the value of the :title variable after the | in your title tag. Basically a RoR site has lots of html/css with embedded ruby throughout the page in different places, so if you needed the users name to be displayed or something you would embed some ruby somewhere and get the users name and output that. just stuff like that throughout the page.
RoR is pretty complex so I recommend checking out the rails courses here and also the free Rails Tutorial eBook
Kevin Korte
28,149 PointsI basically did the same on a custom WP theme. I first wrote the theme as a simple HTML, CSS, and JS website with the idea of what content I was going to be outputting. I than took that initial build, and replaced all of the static, hardcodeded content and replaced with Wordpress functions and PHP snippets to actually generate the live content.
Cameron Bourke
10,198 PointsAlrighty awesome, thanks for heads up!