Skip to content

Instantly share code, notes, and snippets.

@darthdeus
Forked from inossidabile/Bundle.sh
Created November 24, 2012 15:08
Show Gist options
  • Save darthdeus/4140045 to your computer and use it in GitHub Desktop.
Save darthdeus/4140045 to your computer and use it in GitHub Desktop.
Joosy / Blog / Rails preparations
@import 'bootstrap';
@import 'font-awesome';
body {
padding-top: 60px;
}
bundle install
rails new joosy-blog
source 'https://rubygems.org'
gem 'rails', '3.2.9'
gem 'sqlite3'
gem 'joosy', '1.0.0.RC4'
gem 'jquery-rails'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'anjlab-bootstrap-rails', '2.0.4.4', :require => 'bootstrap-rails'
gem 'font-awesome-sass-rails'
gem 'uglifier', '>= 1.0.3'
end
rails g joosy:application blog
rails g joosy:preloader blog
# app/models/post.rb
class Post < ActiveRecord::Base
attr_accessible :body, :title
has_many :comments
end
# app/models/comment.rb
class Comment < ActiveRecord::Base
attr_accessible :body, :post
belongs_to :post, :counter_cache => true
end
rails g scaffold Post title:string body:text comments_count:integer
rails g scaffold Comment post:references body:text
# db/seeds.rb
posts = Post.create([
{ title: 'Welcome there', body: 'Hey, welcome to the joosy blog example' },
{ title: 'Test post', body: 'Nothing there. Really' }
])
Comment.create(body: 'Great article!', post: posts.first)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment