diff --git a/Gemfile b/Gemfile index d643000..dd7543e 100644 --- a/Gemfile +++ b/Gemfile @@ -15,7 +15,7 @@ group :assets do gem 'coffee-rails', '~> 3.2.1' # See https://github.com/sstephenson/execjs#readme for more supported runtimes - # gem 'therubyracer', :platform => :ruby + gem 'therubyracer', :platform => :ruby gem 'uglifier', '>= 1.0.3' end diff --git a/Gemfile.lock b/Gemfile.lock index 0f24858..1887036 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -67,6 +67,7 @@ GEM json (1.7.3) launchy (2.1.0) addressable (~> 2.2.6) + libv8 (3.3.10.4) libwebsocket (0.1.3) addressable mail (2.4.4) @@ -140,6 +141,8 @@ GEM rack (~> 1.0) tilt (~> 1.1, != 1.3.0) sqlite3 (1.3.6) + therubyracer (0.10.1) + libv8 (~> 3.3.10) thor (0.14.6) tilt (1.3.3) treetop (1.4.10) @@ -166,4 +169,5 @@ DEPENDENCIES rspec-rails (~> 2.0) sass-rails (~> 3.2.3) sqlite3 + therubyracer uglifier (>= 1.0.3) diff --git a/app/controllers/books_controller.rb b/app/controllers/books_controller.rb index d13ffd9..6c5be44 100644 --- a/app/controllers/books_controller.rb +++ b/app/controllers/books_controller.rb @@ -16,6 +16,7 @@ def index # GET /books/1 # GET /books/1.json def show + @memo = Memo.new respond_to do |format| format.html # show.html.erb format.xml { render xml: @book } diff --git a/app/models/book.rb b/app/models/book.rb index 95c42dd..36ac641 100644 --- a/app/models/book.rb +++ b/app/models/book.rb @@ -1,6 +1,7 @@ # encoding: UTF-8 class Book < ActiveRecord::Base attr_accessible :memo, :purchased_on, :title + has_many :memos, :dependent => :destroy validates :title, :presence => true before_create :total_books_count diff --git a/app/views/books/show.html.erb b/app/views/books/show.html.erb index 23005ab..c25810b 100644 --- a/app/views/books/show.html.erb +++ b/app/views/books/show.html.erb @@ -15,6 +15,19 @@ <%= @book.purchased_on %>
+<%= memo.description %>+
" do render # Run the generator again with the --webrat flag if you want to use webrat matchers - rendered.should match(/Title/) - rendered.should match(/MyText/) + rendered.should match(/Title/) + rendered.should match(/MyText/) end end