增加样式和布局
This commit is contained in:
parent
b76f978252
commit
8b39503495
2
Gemfile
2
Gemfile
|
@ -1,6 +1,6 @@
|
||||||
source 'http://ruby.taobao.org'
|
source 'http://ruby.taobao.org'
|
||||||
|
|
||||||
gem 'rails', '3.2.6'
|
gem 'rails', '3.2.3'
|
||||||
|
|
||||||
# Bundle edge Rails instead:
|
# Bundle edge Rails instead:
|
||||||
# gem 'rails', :git => 'git://github.com/rails/rails.git'
|
# gem 'rails', :git => 'git://github.com/rails/rails.git'
|
||||||
|
|
130
Gemfile.lock
130
Gemfile.lock
|
@ -1,37 +1,38 @@
|
||||||
GEM
|
GEM
|
||||||
remote: http://ruby.taobao.org/
|
remote: http://ruby.taobao.org/
|
||||||
specs:
|
specs:
|
||||||
actionmailer (3.2.6)
|
actionmailer (3.2.3)
|
||||||
actionpack (= 3.2.6)
|
actionpack (= 3.2.3)
|
||||||
mail (~> 2.4.4)
|
mail (~> 2.4.4)
|
||||||
actionpack (3.2.6)
|
actionpack (3.2.3)
|
||||||
activemodel (= 3.2.6)
|
activemodel (= 3.2.3)
|
||||||
activesupport (= 3.2.6)
|
activesupport (= 3.2.3)
|
||||||
builder (~> 3.0.0)
|
builder (~> 3.0.0)
|
||||||
erubis (~> 2.7.0)
|
erubis (~> 2.7.0)
|
||||||
journey (~> 1.0.1)
|
journey (~> 1.0.1)
|
||||||
rack (~> 1.4.0)
|
rack (~> 1.4.0)
|
||||||
rack-cache (~> 1.2)
|
rack-cache (~> 1.2)
|
||||||
rack-test (~> 0.6.1)
|
rack-test (~> 0.6.1)
|
||||||
sprockets (~> 2.1.3)
|
sprockets (~> 2.1.2)
|
||||||
activemodel (3.2.6)
|
activemodel (3.2.3)
|
||||||
activesupport (= 3.2.6)
|
activesupport (= 3.2.3)
|
||||||
builder (~> 3.0.0)
|
builder (~> 3.0.0)
|
||||||
activerecord (3.2.6)
|
activerecord (3.2.3)
|
||||||
activemodel (= 3.2.6)
|
activemodel (= 3.2.3)
|
||||||
activesupport (= 3.2.6)
|
activesupport (= 3.2.3)
|
||||||
arel (~> 3.0.2)
|
arel (~> 3.0.2)
|
||||||
tzinfo (~> 0.3.29)
|
tzinfo (~> 0.3.29)
|
||||||
activeresource (3.2.6)
|
activeresource (3.2.3)
|
||||||
activemodel (= 3.2.6)
|
activemodel (= 3.2.3)
|
||||||
activesupport (= 3.2.6)
|
activesupport (= 3.2.3)
|
||||||
activesupport (3.2.6)
|
activesupport (3.2.3)
|
||||||
i18n (~> 0.6)
|
i18n (~> 0.6)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
|
addressable (2.2.8)
|
||||||
arel (3.0.2)
|
arel (3.0.2)
|
||||||
bson (1.6.0)
|
bson (1.6.4)
|
||||||
bson_ext (1.6.0)
|
bson_ext (1.6.4)
|
||||||
bson (= 1.6.0)
|
bson (~> 1.6.4)
|
||||||
builder (3.0.0)
|
builder (3.0.0)
|
||||||
capybara (1.1.2)
|
capybara (1.1.2)
|
||||||
mime-types (>= 1.16)
|
mime-types (>= 1.16)
|
||||||
|
@ -40,7 +41,7 @@ GEM
|
||||||
rack-test (>= 0.5.4)
|
rack-test (>= 0.5.4)
|
||||||
selenium-webdriver (~> 2.0)
|
selenium-webdriver (~> 2.0)
|
||||||
xpath (~> 0.1.4)
|
xpath (~> 0.1.4)
|
||||||
childprocess (0.3.1)
|
childprocess (0.3.2)
|
||||||
ffi (~> 1.0.6)
|
ffi (~> 1.0.6)
|
||||||
coffee-rails (3.2.2)
|
coffee-rails (3.2.2)
|
||||||
coffee-script (>= 2.2.0)
|
coffee-script (>= 2.2.0)
|
||||||
|
@ -49,12 +50,11 @@ GEM
|
||||||
coffee-script-source
|
coffee-script-source
|
||||||
execjs
|
execjs
|
||||||
coffee-script-source (1.3.3)
|
coffee-script-source (1.3.3)
|
||||||
cucumber (1.1.9)
|
cucumber (1.2.1)
|
||||||
builder (>= 2.1.2)
|
builder (>= 2.1.2)
|
||||||
diff-lcs (>= 1.1.2)
|
diff-lcs (>= 1.1.3)
|
||||||
gherkin (~> 2.9.0)
|
gherkin (~> 2.11.0)
|
||||||
json (>= 1.4.6)
|
json (>= 1.4.6)
|
||||||
term-ansicolor (>= 1.0.6)
|
|
||||||
cucumber-rails (1.3.0)
|
cucumber-rails (1.3.0)
|
||||||
capybara (>= 1.1.2)
|
capybara (>= 1.1.2)
|
||||||
cucumber (>= 1.1.8)
|
cucumber (>= 1.1.8)
|
||||||
|
@ -63,10 +63,10 @@ GEM
|
||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
execjs (1.4.0)
|
execjs (1.4.0)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
factory_girl (2.6.0)
|
factory_girl (3.5.0)
|
||||||
activesupport (>= 2.3.9)
|
activesupport (>= 3.0.0)
|
||||||
ffi (1.0.11)
|
ffi (1.0.11)
|
||||||
gherkin (2.9.0)
|
gherkin (2.11.0)
|
||||||
json (>= 1.4.6)
|
json (>= 1.4.6)
|
||||||
hike (1.2.1)
|
hike (1.2.1)
|
||||||
i18n (0.6.0)
|
i18n (0.6.0)
|
||||||
|
@ -75,23 +75,26 @@ GEM
|
||||||
railties (>= 3.2.0, < 5.0)
|
railties (>= 3.2.0, < 5.0)
|
||||||
thor (~> 0.14)
|
thor (~> 0.14)
|
||||||
json (1.7.3)
|
json (1.7.3)
|
||||||
json_pure (1.6.5)
|
libwebsocket (0.1.3)
|
||||||
|
addressable
|
||||||
mail (2.4.4)
|
mail (2.4.4)
|
||||||
i18n (>= 0.4.0)
|
i18n (>= 0.4.0)
|
||||||
mime-types (~> 1.16)
|
mime-types (~> 1.16)
|
||||||
treetop (~> 1.4.8)
|
treetop (~> 1.4.8)
|
||||||
mime-types (1.19)
|
mime-types (1.19)
|
||||||
mongo (1.6.0)
|
mongoid (3.0.0.rc)
|
||||||
bson (= 1.6.0)
|
|
||||||
mongoid (2.4.11)
|
|
||||||
activemodel (~> 3.1)
|
activemodel (~> 3.1)
|
||||||
mongo (<= 1.6.2)
|
moped (~> 1.0.0.rc)
|
||||||
|
origin (~> 1.0.0.rc)
|
||||||
tzinfo (~> 0.3.22)
|
tzinfo (~> 0.3.22)
|
||||||
mongoid-rspec (1.4.4)
|
mongoid-rspec (1.4.6)
|
||||||
mongoid (~> 2.0)
|
mongoid (>= 3.0.0.rc)
|
||||||
rspec (~> 2)
|
rake
|
||||||
|
rspec (>= 2.9)
|
||||||
|
moped (1.0.0.rc)
|
||||||
multi_json (1.3.6)
|
multi_json (1.3.6)
|
||||||
nokogiri (1.5.2)
|
nokogiri (1.5.4)
|
||||||
|
origin (1.0.1)
|
||||||
polyglot (0.3.3)
|
polyglot (0.3.3)
|
||||||
rack (1.4.1)
|
rack (1.4.1)
|
||||||
rack-cache (1.2)
|
rack-cache (1.2)
|
||||||
|
@ -100,54 +103,53 @@ GEM
|
||||||
rack
|
rack
|
||||||
rack-test (0.6.1)
|
rack-test (0.6.1)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
rails (3.2.6)
|
rails (3.2.3)
|
||||||
actionmailer (= 3.2.6)
|
actionmailer (= 3.2.3)
|
||||||
actionpack (= 3.2.6)
|
actionpack (= 3.2.3)
|
||||||
activerecord (= 3.2.6)
|
activerecord (= 3.2.3)
|
||||||
activeresource (= 3.2.6)
|
activeresource (= 3.2.3)
|
||||||
activesupport (= 3.2.6)
|
activesupport (= 3.2.3)
|
||||||
bundler (~> 1.0)
|
bundler (~> 1.0)
|
||||||
railties (= 3.2.6)
|
railties (= 3.2.3)
|
||||||
railties (3.2.6)
|
railties (3.2.3)
|
||||||
actionpack (= 3.2.6)
|
actionpack (= 3.2.3)
|
||||||
activesupport (= 3.2.6)
|
activesupport (= 3.2.3)
|
||||||
rack-ssl (~> 1.3.2)
|
rack-ssl (~> 1.3.2)
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
rdoc (~> 3.4)
|
rdoc (~> 3.4)
|
||||||
thor (>= 0.14.6, < 2.0)
|
thor (~> 0.14.6)
|
||||||
rake (0.9.2.2)
|
rake (0.9.2.2)
|
||||||
rdoc (3.12)
|
rdoc (3.12)
|
||||||
json (~> 1.4)
|
json (~> 1.4)
|
||||||
rspec (2.8.0)
|
rspec (2.10.0)
|
||||||
rspec-core (~> 2.8.0)
|
rspec-core (~> 2.10.0)
|
||||||
rspec-expectations (~> 2.8.0)
|
rspec-expectations (~> 2.10.0)
|
||||||
rspec-mocks (~> 2.8.0)
|
rspec-mocks (~> 2.10.0)
|
||||||
rspec-core (2.8.0)
|
rspec-core (2.10.1)
|
||||||
rspec-expectations (2.8.0)
|
rspec-expectations (2.10.0)
|
||||||
diff-lcs (~> 1.1.2)
|
diff-lcs (~> 1.1.3)
|
||||||
rspec-mocks (2.8.0)
|
rspec-mocks (2.10.1)
|
||||||
rspec-rails (2.8.1)
|
rspec-rails (2.10.1)
|
||||||
actionpack (>= 3.0)
|
actionpack (>= 3.0)
|
||||||
activesupport (>= 3.0)
|
activesupport (>= 3.0)
|
||||||
railties (>= 3.0)
|
railties (>= 3.0)
|
||||||
rspec (~> 2.8.0)
|
rspec (~> 2.10.0)
|
||||||
rubyzip (0.9.6.1)
|
rubyzip (0.9.9)
|
||||||
sass (3.1.19)
|
sass (3.1.19)
|
||||||
sass-rails (3.2.5)
|
sass-rails (3.2.5)
|
||||||
railties (~> 3.2.0)
|
railties (~> 3.2.0)
|
||||||
sass (>= 3.1.10)
|
sass (>= 3.1.10)
|
||||||
tilt (~> 1.3)
|
tilt (~> 1.3)
|
||||||
selenium-webdriver (2.13.0)
|
selenium-webdriver (2.24.0)
|
||||||
childprocess (>= 0.2.1)
|
childprocess (>= 0.2.5)
|
||||||
ffi (~> 1.0.9)
|
libwebsocket (~> 0.1.3)
|
||||||
json_pure
|
multi_json (~> 1.0)
|
||||||
rubyzip
|
rubyzip
|
||||||
sprockets (2.1.3)
|
sprockets (2.1.3)
|
||||||
hike (~> 1.2)
|
hike (~> 1.2)
|
||||||
rack (~> 1.0)
|
rack (~> 1.0)
|
||||||
tilt (~> 1.1, != 1.3.0)
|
tilt (~> 1.1, != 1.3.0)
|
||||||
term-ansicolor (1.0.7)
|
thor (0.14.6)
|
||||||
thor (0.15.3)
|
|
||||||
tilt (1.3.3)
|
tilt (1.3.3)
|
||||||
treetop (1.4.10)
|
treetop (1.4.10)
|
||||||
polyglot
|
polyglot
|
||||||
|
@ -171,7 +173,7 @@ DEPENDENCIES
|
||||||
jquery-rails
|
jquery-rails
|
||||||
mongoid
|
mongoid
|
||||||
mongoid-rspec
|
mongoid-rspec
|
||||||
rails (= 3.2.6)
|
rails (= 3.2.3)
|
||||||
rspec-rails
|
rspec-rails
|
||||||
sass-rails (~> 3.2.3)
|
sass-rails (~> 3.2.3)
|
||||||
uglifier (>= 1.0.3)
|
uglifier (>= 1.0.3)
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 406 B |
|
@ -0,0 +1,3 @@
|
||||||
|
# Place all the behaviors and hooks related to the matching controller here.
|
||||||
|
# All this logic will automatically be available in application.js.
|
||||||
|
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
|
@ -11,3 +11,52 @@
|
||||||
*= require_self
|
*= require_self
|
||||||
*= require_tree .
|
*= require_tree .
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* http://meyerweb.com/eric/tools/css/reset/
|
||||||
|
v2.0 | 20110126
|
||||||
|
License: none (public domain)
|
||||||
|
*/
|
||||||
|
|
||||||
|
html, body, div, span, applet, object, iframe,
|
||||||
|
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
||||||
|
a, abbr, acronym, address, big, cite, code,
|
||||||
|
del, dfn, em, img, ins, kbd, q, s, samp,
|
||||||
|
small, strike, strong, sub, sup, tt, var,
|
||||||
|
b, u, i, center,
|
||||||
|
dl, dt, dd, ol, ul, li,
|
||||||
|
fieldset, form, label, legend,
|
||||||
|
table, caption, tbody, tfoot, thead, tr, th, td,
|
||||||
|
article, aside, canvas, details, embed,
|
||||||
|
figure, figcaption, footer, header, hgroup,
|
||||||
|
menu, nav, output, ruby, section, summary,
|
||||||
|
time, mark, audio, video {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
border: 0;
|
||||||
|
font-size: 100%;
|
||||||
|
font: inherit;
|
||||||
|
vertical-align: baseline;
|
||||||
|
}
|
||||||
|
/* HTML5 display-role reset for older browsers */
|
||||||
|
article, aside, details, figcaption, figure,
|
||||||
|
footer, header, hgroup, menu, nav, section {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
ol, ul {
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
blockquote, q {
|
||||||
|
quotes: none;
|
||||||
|
}
|
||||||
|
blockquote:before, blockquote:after,
|
||||||
|
q:before, q:after {
|
||||||
|
content: '';
|
||||||
|
content: none;
|
||||||
|
}
|
||||||
|
table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
border-spacing: 0;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
// Place all the styles related to the blogs controller here.
|
||||||
|
// They will automatically be included in application.css.
|
||||||
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||||
|
|
||||||
|
div.blog {
|
||||||
|
background: url('bg_fn_blog_corner.png') no-repeat;
|
||||||
|
padding: 2em 19px;
|
||||||
|
width: 641px;
|
||||||
|
border-radius: 5px;
|
||||||
|
border: 1px solid #E6E6E6;
|
||||||
|
h2 {
|
||||||
|
font-size: 40px;
|
||||||
|
margin-bottom: 19px;
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
&:hover {
|
||||||
|
strong {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
strong {
|
||||||
|
font-size: 10px;
|
||||||
|
line-height: 40px;
|
||||||
|
margin-left: 1em;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
div.bottom {
|
||||||
|
background: url('bg_fn_blog.png') no-repeat;
|
||||||
|
height: 40px;
|
||||||
|
width: 679px;
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
.container {
|
||||||
|
width: 1100px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
div.head {
|
||||||
|
margin-bottom: 2em;
|
||||||
|
background-color: #EFEFEF;
|
||||||
|
border-bottom: 1px solid #E6E6E6;
|
||||||
|
margin: 0 auto 1em;
|
||||||
|
div.container {
|
||||||
|
.descrip {
|
||||||
|
margin-left: 2em;
|
||||||
|
}
|
||||||
|
ul.nav {
|
||||||
|
list-style: none;
|
||||||
|
display: inline-block;
|
||||||
|
li {
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 0.3em;
|
||||||
|
width: 78px;
|
||||||
|
a {
|
||||||
|
display: block;
|
||||||
|
padding: 40px 0 10px 10px;
|
||||||
|
background-color: black;
|
||||||
|
color: white;
|
||||||
|
text-decoration: none;
|
||||||
|
strong {
|
||||||
|
display: block;
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
a#home {
|
||||||
|
background-color: #333;
|
||||||
|
}
|
||||||
|
a#tech {
|
||||||
|
background-color: #224b8f;
|
||||||
|
}
|
||||||
|
a#life {
|
||||||
|
background-color: #f15b6c;
|
||||||
|
}
|
||||||
|
a#creator {
|
||||||
|
background-color: #78cdd1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
class BlogsController < ApplicationController
|
||||||
|
def index
|
||||||
|
@posts = Post.all
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,2 @@
|
||||||
|
module BlogsHelper
|
||||||
|
end
|
|
@ -1,6 +1,5 @@
|
||||||
class Posts
|
class Post
|
||||||
include Mongoid::Document
|
include Mongoid::Document
|
||||||
field :title, :type => String
|
field :title, :type => String
|
||||||
field :content, :type => String
|
field :content, :type => String
|
||||||
field :type, :type => String
|
|
||||||
end
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
<div class="blog">
|
||||||
|
<h2><%= link_to (post.title + "<strong> >></strong>").html_safe, blog_path(post) %></h2>
|
||||||
|
<div class="content"><%= post.content %></div>
|
||||||
|
</div>
|
||||||
|
<div class="bottom"></div>
|
|
@ -0,0 +1 @@
|
||||||
|
<%= render :partial=> "post", :collection=> @posts %>
|
|
@ -0,0 +1,2 @@
|
||||||
|
<h1>Blogs#show</h1>
|
||||||
|
<p>Find me in app/views/blogs/show.html.erb</p>
|
|
@ -1,14 +1,29 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>WBlog</title>
|
<title>WinDy's Blog</title>
|
||||||
<%= stylesheet_link_tag "application", :media => "all" %>
|
<%= stylesheet_link_tag "application", :media => "all" %>
|
||||||
<%= javascript_include_tag "application" %>
|
<%= javascript_include_tag "application" %>
|
||||||
|
<%= yield :js %>
|
||||||
<%= csrf_meta_tags %>
|
<%= csrf_meta_tags %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<%= yield %>
|
<!-- head -->
|
||||||
|
<div class="head">
|
||||||
|
<div class="container">
|
||||||
|
<ul class="nav">
|
||||||
|
<li> <a id="home" href="#">首页<strong>Home</strong></a> </li>
|
||||||
|
<li> <a id="tech" href="#">技术<strong>Tech</strong></a> </li>
|
||||||
|
<li> <a id="life" href="#">生活<strong>Life</strong></a> </li>
|
||||||
|
<li> <a id="creator" href="#">创业<strong>Creator</strong></a> </li>
|
||||||
|
</ul>
|
||||||
|
<strong class="descrip">WinDy的个人中心 - 记录人生经历 - 技术 生活 And 创业</strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="container">
|
||||||
|
<%= yield %>
|
||||||
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -5,6 +5,7 @@ require File.expand_path('../boot', __FILE__)
|
||||||
require "action_controller/railtie"
|
require "action_controller/railtie"
|
||||||
require "action_mailer/railtie"
|
require "action_mailer/railtie"
|
||||||
require "active_resource/railtie"
|
require "active_resource/railtie"
|
||||||
|
require "sprockets/railtie"
|
||||||
require "rails/test_unit/railtie"
|
require "rails/test_unit/railtie"
|
||||||
|
|
||||||
if defined?(Bundler)
|
if defined?(Bundler)
|
||||||
|
|
|
@ -23,11 +23,11 @@ WBlog::Application.configure do
|
||||||
config.action_dispatch.best_standards_support = :builtin
|
config.action_dispatch.best_standards_support = :builtin
|
||||||
|
|
||||||
# Raise exception on mass assignment protection for Active Record models
|
# Raise exception on mass assignment protection for Active Record models
|
||||||
config.active_record.mass_assignment_sanitizer = :strict
|
#config.active_record.mass_assignment_sanitizer = :strict
|
||||||
|
|
||||||
# Log the query plan for queries taking more than this (works
|
# Log the query plan for queries taking more than this (works
|
||||||
# with SQLite, MySQL, and PostgreSQL)
|
# with SQLite, MySQL, and PostgreSQL)
|
||||||
config.active_record.auto_explain_threshold_in_seconds = 0.5
|
#config.active_record.auto_explain_threshold_in_seconds = 0.5
|
||||||
|
|
||||||
# Do not compress assets
|
# Do not compress assets
|
||||||
config.assets.compress = false
|
config.assets.compress = false
|
||||||
|
|
|
@ -1,20 +1,60 @@
|
||||||
development:
|
development:
|
||||||
host: localhost
|
# Configure available database sessions. (required)
|
||||||
database: w_blog_development
|
sessions:
|
||||||
|
# Defines the default session. (required)
|
||||||
|
default:
|
||||||
|
# Defines the name of the default database that Mongoid can connect to.
|
||||||
|
# (required).
|
||||||
|
database: w_blog_development
|
||||||
|
# Provides the hosts the default session can connect to. Must be an array
|
||||||
|
# of host:port pairs. (required)
|
||||||
|
hosts:
|
||||||
|
- localhost:27017
|
||||||
|
options:
|
||||||
|
# Change whether the session persists in safe mode by default.
|
||||||
|
# (default: false)
|
||||||
|
# safe: false
|
||||||
|
|
||||||
test:
|
# Change the default consistency model to :eventual or :strong.
|
||||||
host: localhost
|
# :eventual will send reads to secondaries, :strong sends everything
|
||||||
database: w_blog_test
|
# to master. (default: :eventual)
|
||||||
|
consistency: :strong
|
||||||
|
# Configure Mongoid specific options. (optional)
|
||||||
|
options:
|
||||||
|
# Configuration for whether or not to allow access to fields that do
|
||||||
|
# not have a field definition on the model. (default: true)
|
||||||
|
# allow_dynamic_fields: true
|
||||||
|
|
||||||
# set these environment variables on your prod server
|
# Enable the identity map, needed for eager loading. (default: false)
|
||||||
production:
|
# identity_map_enabled: false
|
||||||
host: <%= ENV['MONGOID_HOST'] %>
|
|
||||||
port: <%= ENV['MONGOID_PORT'] %>
|
# Includes the root model name in json serialization. (default: false)
|
||||||
username: <%= ENV['MONGOID_USERNAME'] %>
|
# include_root_in_json: false
|
||||||
password: <%= ENV['MONGOID_PASSWORD'] %>
|
|
||||||
database: <%= ENV['MONGOID_DATABASE'] %>
|
# Include the _type field in serializaion. (default: false)
|
||||||
# slaves:
|
# include_type_for_serialization: false
|
||||||
# - host: slave1.local
|
|
||||||
# port: 27018
|
# Preload all models in development, needed when models use
|
||||||
# - host: slave2.local
|
# inheritance. (default: false)
|
||||||
# port: 27019
|
# preload_models: false
|
||||||
|
|
||||||
|
# Protect id and type from mass assignment. (default: true)
|
||||||
|
# protect_sensitive_fields: true
|
||||||
|
|
||||||
|
# Raise an error when performing a #find and the document is not found.
|
||||||
|
# (default: true)
|
||||||
|
# raise_not_found_error: true
|
||||||
|
|
||||||
|
# Raise an error when defining a scope with the same name as an
|
||||||
|
# existing method. (default: false)
|
||||||
|
# scope_overwrite_exception: false
|
||||||
|
|
||||||
|
# Skip the database version check, used when connecting to a db without
|
||||||
|
# admin access. (default: false)
|
||||||
|
# skip_version_check: false
|
||||||
|
|
||||||
|
# User Active Support's time zone in conversions. (default: true)
|
||||||
|
# use_activesupport_time_zone: true
|
||||||
|
|
||||||
|
# Ensure all times are UTC in the app side. (default: false)
|
||||||
|
# use_utc: false
|
||||||
|
|
|
@ -1,58 +1,4 @@
|
||||||
WBlog::Application.routes.draw do
|
WBlog::Application.routes.draw do
|
||||||
# The priority is based upon order of creation:
|
root :to => 'blogs#index'
|
||||||
# first created -> highest priority.
|
resources :blogs, :only=>[:index, :show]
|
||||||
|
|
||||||
# Sample of regular route:
|
|
||||||
# match 'products/:id' => 'catalog#view'
|
|
||||||
# Keep in mind you can assign values other than :controller and :action
|
|
||||||
|
|
||||||
# Sample of named route:
|
|
||||||
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
|
|
||||||
# This route can be invoked with purchase_url(:id => product.id)
|
|
||||||
|
|
||||||
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
|
||||||
# resources :products
|
|
||||||
|
|
||||||
# Sample resource route with options:
|
|
||||||
# resources :products do
|
|
||||||
# member do
|
|
||||||
# get 'short'
|
|
||||||
# post 'toggle'
|
|
||||||
# end
|
|
||||||
#
|
|
||||||
# collection do
|
|
||||||
# get 'sold'
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
|
|
||||||
# Sample resource route with sub-resources:
|
|
||||||
# resources :products do
|
|
||||||
# resources :comments, :sales
|
|
||||||
# resource :seller
|
|
||||||
# end
|
|
||||||
|
|
||||||
# Sample resource route with more complex sub-resources
|
|
||||||
# resources :products do
|
|
||||||
# resources :comments
|
|
||||||
# resources :sales do
|
|
||||||
# get 'recent', :on => :collection
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
|
|
||||||
# Sample resource route within a namespace:
|
|
||||||
# namespace :admin do
|
|
||||||
# # Directs /admin/products/* to Admin::ProductsController
|
|
||||||
# # (app/controllers/admin/products_controller.rb)
|
|
||||||
# resources :products
|
|
||||||
# end
|
|
||||||
|
|
||||||
# You can have the root of your site routed with "root"
|
|
||||||
# just remember to delete public/index.html.
|
|
||||||
# root :to => 'welcome#index'
|
|
||||||
|
|
||||||
# See how all your routes lay out with "rake routes"
|
|
||||||
|
|
||||||
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
|
||||||
# Note: This route will make all actions in every controller accessible via GET requests.
|
|
||||||
# match ':controller(/:action(/:id))(.:format)'
|
|
||||||
end
|
end
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,19 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe BlogsController do
|
||||||
|
|
||||||
|
describe "GET 'index'" do
|
||||||
|
it "returns http success" do
|
||||||
|
get 'index'
|
||||||
|
response.should be_success
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "GET 'show'" do
|
||||||
|
it "returns http success" do
|
||||||
|
get 'show'
|
||||||
|
response.should be_success
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,15 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
# Specs in this file have access to a helper object that includes
|
||||||
|
# the BlogsHelper. For example:
|
||||||
|
#
|
||||||
|
# describe BlogsHelper do
|
||||||
|
# describe "string concat" do
|
||||||
|
# it "concats two strings with spaces" do
|
||||||
|
# helper.concat_strings("this","that").should == "this that"
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
describe BlogsHelper do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
|
@ -1,5 +1,5 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe Posts do
|
describe Post do
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
end
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe "blogs/index.html.erb" do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe "blogs/show.html.erb" do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
Loading…
Reference in New Issue