The complete process of building a personal blog with Rails + bootstrap

Source: Internet
Author: User

Part 1

-Start with the most basic, create a new project:

Rails New Blog
-then modify source to https://ruby.taobao.com, add bootstrap gem to Gemfile:
Gem ' Twitter-bootstrap-rails '
There is no error executing the bundle install, but there is a hint:
Important:you need to add a JavaScript runtime to your gemfile on order for Bootstrap's less files to compile to CSS. EXECJS supports these runtimes:therubyracer-google V8 embedded within Rubytherubyrhino-mozilla Rhino embedded within jrubynode.jsapple javascriptcore-included with Mac OS xmicrosoft Window S Script Host (JScript) **********************************************
Look at the hint is missing a JS Runtime,ok, follow the prompts I installed Execjs
Gem Install Execjs

The EXECJS supported runtime is then added to the Gemfile:

Gem ' Therubyracer '
Again bundle install, no problem, access to localhost:3000, can be normal access!

Part 2

-Create homepage

Rails Generate Controller Blogs



Add the index method to the BLOGSCONTROLLER.RB in the Blogs subdirectory under the Controller directory

def indexend

Then create a Index.html.erb file under the Views directory, adding a line of HTML code

 

Finally, change the routes.rb file to add

Root to: ' Blogs#index '



Refresh localhost:3000 again to see the new homepage!





The complete process of building a personal blog with Rails + bootstrap

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.