rails4_bootswatch_devise

weixin_33670713發表於2015-03-09

新增gem

gem 'bootstrap-sass'      # should be already included

gem 'bootswatch-rails'

#gem 'bootswatch-sass'

gem 'font-awesome-rails'

gem 'devise', '~> 3.4.1'

gem 'settingslogic', '~> 2.0.9'

gem 'rails_layout', group: :development

gem 'pry', group: :development

gem 'pry-nav'  , group: :development

gem 'pry-rails', group: :development

gem 'awesome_print',require:"ap", group: :development

############################################################

rails new site —database=postgresql

edit Gemfile,add some gems;

bundle install |bundle —local

edit ./config/database.yml [with right db parameter]

#devise part

rails generate devise:install

rails generate devise member

rake db:migrate

#bootstrap3 /bootswatch /rails_layout

rails generate layout:install bootstrap3

rails generate layout:devise bootstrap3

rails generate layout:navigation

#asset/javascript/application.js

add line:

//= require bootstrap-sprockets

#asset/stylesheets/

no need to change application.css.scss if you has done —“rails_layout bootstrap3”

edit file: framework_and_overrides.css.scss

like this:

@import 'bootswatch/yeti/variables';

@import 'bootstrap';

body { padding-top: 60px;   };

@import "bootswatch/yeti/bootswatch";

@import "font-awesome";

.center {

width: auto;

display: table;

margin-left: auto;

margin-right: auto;

}

.text-center {

text-align: center;

}

………..  no change the below line………..

#edit controller file:

add line :

before_action :authenticate_member!

or [by the model name]

before_action :authenticate_user!

#about the routes.rb

notice the line :

devise_for :members [added by devise auto]

change:

root ‘home#index’

rails generate controller home index

rails s -b 0.0.0.0 -p 80

now you can see the pages work!

and go on!