Skip to content

Commit bc74294

Browse files
committed
First and last commit
0 parents  commit bc74294

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+8947
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.bundle
2+
db/*.sqlite3
3+
log/*.log
4+
tmp/**/*

Gemfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
source 'http://rubygems.org'
2+
3+
gem 'rails', '3.0.0.beta3'
4+
5+
# Bundle edge Rails instead:
6+
# gem 'rails', :git => 'git://github.com/rails/rails.git'
7+
8+
gem 'sqlite3-ruby', :require => 'sqlite3'
9+
10+
# Use unicorn as the web server
11+
# gem 'unicorn'
12+
13+
# Deploy with Capistrano
14+
# gem 'capistrano'
15+
16+
# Bundle the extra gems:
17+
# gem 'bj'
18+
# gem 'nokogiri', '1.4.1'
19+
# gem 'sqlite3-ruby', :require => 'sqlite3'
20+
# gem 'aws-s3', :require => 'aws/s3'
21+
22+
# Bundle gems for certain environments:
23+
# gem 'rspec', :group => :test
24+
# group :test do
25+
# gem 'webrat'
26+
# end

README

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
== Dummy app for creating Ajax-submitted jQuery and Rails 3 Comments ==
2+
3+
Created as an example for the blog post http://blog.bernatfarrero.com/jquery-and-rails-3-mini-tutorial/

Rakefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Add your own tasks in files placed in lib/tasks ending in .rake,
2+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3+
4+
require File.expand_path('../config/application', __FILE__)
5+
6+
require 'rake'
7+
require 'rake/testtask'
8+
require 'rake/rdoctask'
9+
10+
Rails::Application.load_tasks
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class ApplicationController < ActionController::Base
2+
protect_from_forgery
3+
layout 'application'
4+
end
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
class CommentsController < ApplicationController
2+
def index
3+
@comments = Comment.all
4+
respond_to do |format|
5+
format.html # index.html.erb
6+
format.rss
7+
end
8+
end
9+
10+
def create
11+
@comment = Comment.create!(params[:comment])
12+
flash[:notice] = "Thanks for commenting!"
13+
respond_to do |format|
14+
format.html { redirect_to comments_path }
15+
format.js
16+
end
17+
end
18+
19+
def destroy
20+
@comment = Comment.find(params[:id])
21+
@comment.destroy
22+
respond_to do |format|
23+
format.html { redirect_to comments_path }
24+
format.js
25+
end
26+
end
27+
28+
end

app/helpers/application_helper.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
module ApplicationHelper
2+
end

app/helpers/comments_helper.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
module CommentsHelper
2+
end

app/models/comment.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class Comment < ActiveRecord::Base
2+
end

app/views/comments/_comment.html.erb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<%= div_for comment do %>
2+
<span class="dateandoptions">
3+
Posted <%=time_ago_in_words(comment.created_at)%> ago<br />
4+
<%= link_to 'Delete', comment_path(comment), :method => :delete, :class => "delete", :remote => true %>
5+
</span>
6+
<p><b><%= comment.name %></b> wrote:</p>
7+
<br />
8+
<%= content_tag(:p, comment.body, :class => "comment-body") %>
9+
<% end %>

0 commit comments

Comments
 (0)