12 |
13 |
14 |
15 | <%= link_to 'Back', comments_path %>
16 |
--------------------------------------------------------------------------------
/app/views/layouts/application.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | JqueryRails
5 | <%= stylesheet_link_tag "application" %>
6 | <%= javascript_include_tag "application" %>
7 | <%= csrf_meta_tag %>
8 |
9 |
10 |
11 | <%= yield %>
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/config.ru:
--------------------------------------------------------------------------------
1 | # This file is used by Rack-based servers to start the application.
2 |
3 | require ::File.expand_path('../config/environment', __FILE__)
4 | run JqueryRails::Application
5 |
--------------------------------------------------------------------------------
/config/application.rb:
--------------------------------------------------------------------------------
1 | require File.expand_path('../boot', __FILE__)
2 |
3 | require 'rails/all'
4 |
5 | # If you have a Gemfile, require the gems listed there, including any gems
6 | # you've limited to :test, :development, or :production.
7 | Bundler.require(:default, Rails.env) if defined?(Bundler)
8 |
9 | module JqueryRails
10 | class Application < Rails::Application
11 | # Settings in config/environments/* take precedence over those specified here.
12 | # Application configuration should go into files in config/initializers
13 | # -- all .rb files in that directory are automatically loaded.
14 |
15 | # Custom directories with classes and modules you want to be autoloadable.
16 | # config.autoload_paths += %W(#{config.root}/extras)
17 |
18 | # Only load the plugins named here, in the order given (default is alphabetical).
19 | # :all can be used as a placeholder for all plugins not explicitly named.
20 | # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
21 |
22 | # Activate observers that should always be running.
23 | # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
24 |
25 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
26 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
27 | # config.time_zone = 'Central Time (US & Canada)'
28 |
29 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
30 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
31 | # config.i18n.default_locale = :de
32 |
33 | # JavaScript files you want as :defaults (application.js is always included).
34 | # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
35 |
36 | # Configure the default encoding used in templates for Ruby 1.9.
37 | config.encoding = "utf-8"
38 |
39 | # Configure sensitive parameters which will be filtered from the log file.
40 | config.filter_parameters += [:password]
41 |
42 | config.assets.enabled = true
43 |
44 | config.generators do |g|
45 | g.test_framework :rspec
46 | g.view_specs false
47 | g.controller_specs false
48 | end
49 | end
50 | end
51 |
--------------------------------------------------------------------------------
/config/boot.rb:
--------------------------------------------------------------------------------
1 | require 'rubygems'
2 |
3 | # Set up gems listed in the Gemfile.
4 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5 |
6 | require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
7 |
--------------------------------------------------------------------------------
/config/database.yml:
--------------------------------------------------------------------------------
1 | # SQLite version 3.x
2 | # gem install sqlite3
3 | development:
4 | adapter: sqlite3
5 | database: db/development.sqlite3
6 | pool: 5
7 | timeout: 5000
8 |
9 | # Warning: The database defined as "test" will be erased and
10 | # re-generated from your development database when you run "rake".
11 | # Do not set this db to the same as development or production.
12 | test:
13 | adapter: sqlite3
14 | database: ":memory:"
15 |
16 | production:
17 | adapter: sqlite3
18 | database: db/production.sqlite3
19 | pool: 5
20 | timeout: 5000
21 |
--------------------------------------------------------------------------------
/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the rails application
2 | require File.expand_path('../application', __FILE__)
3 |
4 | # Initialize the rails application
5 | JqueryRails::Application.initialize!
6 |
--------------------------------------------------------------------------------
/config/environments/development.rb:
--------------------------------------------------------------------------------
1 | JqueryRails::Application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb
3 |
4 | # In the development environment your application's code is reloaded on
5 | # every request. This slows down response time but is perfect for development
6 | # since you don't have to restart the webserver when you make code changes.
7 | config.cache_classes = false
8 |
9 | # Log error messages when you accidentally call methods on nil.
10 | config.whiny_nils = true
11 |
12 | # Show full error reports and disable caching
13 | config.consider_all_requests_local = true
14 | config.action_controller.perform_caching = false
15 |
16 | # Don't care if the mailer can't send
17 | config.action_mailer.raise_delivery_errors = false
18 |
19 | # Print deprecation notices to the Rails logger
20 | config.active_support.deprecation = :log
21 |
22 | # Only use best-standards-support built into browsers
23 | config.action_dispatch.best_standards_support = :builtin
24 | end
25 |
26 |
--------------------------------------------------------------------------------
/config/environments/production.rb:
--------------------------------------------------------------------------------
1 | JqueryRails::Application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb
3 |
4 | # The production environment is meant for finished, "live" apps.
5 | # Code is not reloaded between requests
6 | config.cache_classes = true
7 |
8 | # Full error reports are disabled and caching is turned on
9 | config.consider_all_requests_local = false
10 | config.action_controller.perform_caching = true
11 |
12 | # Specifies the header that your server uses for sending files
13 | config.action_dispatch.x_sendfile_header = "X-Sendfile"
14 |
15 | # For nginx:
16 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
17 |
18 | # If you have no front-end server that supports something like X-Sendfile,
19 | # just comment this out and Rails will serve the files
20 |
21 | # See everything in the log (default is :info)
22 | # config.log_level = :debug
23 |
24 | # Use a different logger for distributed setups
25 | # config.logger = SyslogLogger.new
26 |
27 | # Use a different cache store in production
28 | # config.cache_store = :mem_cache_store
29 |
30 | # Disable Rails's static asset server
31 | # In production, Apache or nginx will already do this
32 | config.serve_static_assets = false
33 |
34 | # Enable serving of images, stylesheets, and javascripts from an asset server
35 | # config.action_controller.asset_host = "http://assets.example.com"
36 |
37 | # Disable delivery errors, bad email addresses will be ignored
38 | # config.action_mailer.raise_delivery_errors = false
39 |
40 | # Enable threaded mode
41 | # config.threadsafe!
42 |
43 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
44 | # the I18n.default_locale when a translation can not be found)
45 | config.i18n.fallbacks = true
46 |
47 | # Send deprecation notices to registered listeners
48 | config.active_support.deprecation = :notify
49 | end
50 |
--------------------------------------------------------------------------------
/config/environments/test.rb:
--------------------------------------------------------------------------------
1 | JqueryRails::Application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb
3 |
4 | # The test environment is used exclusively to run your application's
5 | # test suite. You never need to work with it otherwise. Remember that
6 | # your test database is "scratch space" for the test suite and is wiped
7 | # and recreated between test runs. Don't rely on the data there!
8 | config.cache_classes = true
9 |
10 | # Log error messages when you accidentally call methods on nil.
11 | config.whiny_nils = true
12 |
13 | # Show full error reports and disable caching
14 | config.consider_all_requests_local = true
15 | config.action_controller.perform_caching = false
16 |
17 | # Raise exceptions instead of rendering exception templates
18 | config.action_dispatch.show_exceptions = false
19 |
20 | # Disable request forgery protection in test environment
21 | config.action_controller.allow_forgery_protection = false
22 |
23 | # Tell Action Mailer not to deliver emails to the real world.
24 | # The :test delivery method accumulates sent emails in the
25 | # ActionMailer::Base.deliveries array.
26 | config.action_mailer.delivery_method = :test
27 |
28 | # Use SQL instead of Active Record's schema dumper when creating the test database.
29 | # This is necessary if your schema can't be completely dumped by the schema dumper,
30 | # like if you have constraints or database-specific column types
31 | # config.active_record.schema_format = :sql
32 |
33 | # Print deprecation notices to the stderr
34 | config.active_support.deprecation = :stderr
35 | end
36 |
--------------------------------------------------------------------------------
/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5 |
6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7 | # Rails.backtrace_cleaner.remove_silencers!
8 |
--------------------------------------------------------------------------------
/config/initializers/inflections.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new inflection rules using the following format
4 | # (all these examples are active by default):
5 | # ActiveSupport::Inflector.inflections do |inflect|
6 | # inflect.plural /^(ox)$/i, '\1en'
7 | # inflect.singular /^(ox)en/i, '\1'
8 | # inflect.irregular 'person', 'people'
9 | # inflect.uncountable %w( fish sheep )
10 | # end
11 |
--------------------------------------------------------------------------------
/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new mime types for use in respond_to blocks:
4 | # Mime::Type.register "text/richtext", :rtf
5 | # Mime::Type.register_alias "text/html", :iphone
6 |
--------------------------------------------------------------------------------
/config/initializers/secret_token.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Your secret key for verifying the integrity of signed cookies.
4 | # If you change this key, all old signed cookies will become invalid!
5 | # Make sure the secret is at least 30 characters and all random,
6 | # no regular words or you'll be exposed to dictionary attacks.
7 | JqueryRails::Application.config.secret_token = '14d748ccb7bec478834026d9ccd18693720043771abe1482a5de414d7e5c8e2bd1bff76c5c3fb23f1416cd733621cdf8da87b0ee6921c39af39cf6a71de399ad'
8 |
--------------------------------------------------------------------------------
/config/initializers/session_store.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | JqueryRails::Application.config.session_store :cookie_store, :key => '_jquery-rails_session'
4 |
5 | # Use the database for sessions instead of the cookie-based default,
6 | # which shouldn't be used to store highly confidential information
7 | # (create the session table with "rails generate session_migration")
8 | # JqueryRails::Application.config.session_store :active_record_store
9 |
--------------------------------------------------------------------------------
/config/locales/en.yml:
--------------------------------------------------------------------------------
1 | # Sample localization file for English. Add more files in this directory for other locales.
2 | # See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3 |
4 | en:
5 | hello: "Hello world"
6 |
--------------------------------------------------------------------------------
/config/routes.rb:
--------------------------------------------------------------------------------
1 | JqueryRails::Application.routes.draw do
2 | resources :comments
3 |
4 | # The priority is based upon order of creation:
5 | # first created -> highest priority.
6 |
7 | # Sample of regular route:
8 | # match 'products/:id' => 'catalog#view'
9 | # Keep in mind you can assign values other than :controller and :action
10 |
11 | # Sample of named route:
12 | # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
13 | # This route can be invoked with purchase_url(:id => product.id)
14 |
15 | # Sample resource route (maps HTTP verbs to controller actions automatically):
16 | # resources :products
17 |
18 | # Sample resource route with options:
19 | # resources :products do
20 | # member do
21 | # get 'short'
22 | # post 'toggle'
23 | # end
24 | #
25 | # collection do
26 | # get 'sold'
27 | # end
28 | # end
29 |
30 | # Sample resource route with sub-resources:
31 | # resources :products do
32 | # resources :comments, :sales
33 | # resource :seller
34 | # end
35 |
36 | # Sample resource route with more complex sub-resources
37 | # resources :products do
38 | # resources :comments
39 | # resources :sales do
40 | # get 'recent', :on => :collection
41 | # end
42 | # end
43 |
44 | # Sample resource route within a namespace:
45 | # namespace :admin do
46 | # # Directs /admin/products/* to Admin::ProductsController
47 | # # (app/controllers/admin/products_controller.rb)
48 | # resources :products
49 | # end
50 |
51 | # You can have the root of your site routed with "root"
52 | # just remember to delete public/index.html.
53 | # root :to => "welcome#index"
54 | root :to => "comments#index"
55 |
56 | # See how all your routes lay out with "rake routes"
57 |
58 | # This is a legacy wild controller route that's not recommended for RESTful applications.
59 | # Note: This route will make all actions in every controller accessible via GET requests.
60 | # match ':controller(/:action(/:id(.:format)))'
61 | end
62 |
--------------------------------------------------------------------------------
/db/migrate/20110209210252_create_comments.rb:
--------------------------------------------------------------------------------
1 | class CreateComments < ActiveRecord::Migration
2 | def self.up
3 | create_table :comments do |t|
4 | t.string :subject
5 | t.text :body
6 |
7 | t.timestamps
8 | end
9 | end
10 |
11 | def self.down
12 | drop_table :comments
13 | end
14 | end
15 |
--------------------------------------------------------------------------------
/db/migrate/20110209210315_add_attachment_to_comment.rb:
--------------------------------------------------------------------------------
1 | class AddAttachmentToComment < ActiveRecord::Migration
2 | def self.up
3 | add_column :comments, :attachment_file_name, :string
4 | add_column :comments, :attachment_content_type, :string
5 | add_column :comments, :attachment_file_size, :integer
6 | add_column :comments, :attachment_updated_at, :datetime
7 | end
8 |
9 | def self.down
10 | remove_column :comments, :attachment_file_name
11 | remove_column :comments, :attachment_content_type
12 | remove_column :comments, :attachment_file_size
13 | remove_column :comments, :attachment_updated_at
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/db/schema.rb:
--------------------------------------------------------------------------------
1 | # encoding: UTF-8
2 | # This file is auto-generated from the current state of the database. Instead
3 | # of editing this file, please use the migrations feature of Active Record to
4 | # incrementally modify your database, and then regenerate this schema definition.
5 | #
6 | # Note that this schema.rb definition is the authoritative source for your
7 | # database schema. If you need to create the application database on another
8 | # system, you should be using db:schema:load, not running all the migrations
9 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10 | # you'll amass, the slower it'll run and the greater likelihood for issues).
11 | #
12 | # It's strongly recommended that you check this file into your version control system.
13 |
14 | ActiveRecord::Schema.define(version: 20110209210315) do
15 |
16 | create_table "comments", force: :cascade do |t|
17 | t.string "subject"
18 | t.text "body"
19 | t.datetime "created_at"
20 | t.datetime "updated_at"
21 | t.string "attachment_file_name"
22 | t.string "attachment_content_type"
23 | t.integer "attachment_file_size"
24 | t.datetime "attachment_updated_at"
25 | end
26 |
27 | end
28 |
--------------------------------------------------------------------------------
/db/seeds.rb:
--------------------------------------------------------------------------------
1 | # This file should contain all the record creation needed to seed the database with its default values.
2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3 | #
4 | # Examples:
5 | #
6 | # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
7 | # Mayor.create(:name => 'Daley', :city => cities.first)
8 |
--------------------------------------------------------------------------------
/doc/README_FOR_APP:
--------------------------------------------------------------------------------
1 | Use this README file to introduce your application and point to useful places in the API for learning more.
2 | Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries.
3 |
--------------------------------------------------------------------------------
/gemfiles/3.2.gemfile:
--------------------------------------------------------------------------------
1 | gem "rails", "~> 3.2.0"
2 |
3 | gem 'sass'
4 | gem 'coffee-script'
5 | gem 'uglifier'
6 |
7 | # Bundle edge Rails instead:
8 | # gem 'rails', :git => 'git://github.com/rails/rails.git'
9 |
10 | gem 'sqlite3'
11 |
12 | gem 'paperclip'
13 | gem 'jquery-rails'
14 | #gem 'activerecord-sqlite3-adapter'
15 |
16 | # Use unicorn as the web server
17 | # gem 'unicorn'
18 |
19 | # Deploy with Capistrano
20 | # gem 'capistrano'
21 |
22 | # To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
23 | # gem 'ruby-debug'
24 | # gem 'ruby-debug19'
25 |
26 | # Bundle the extra gems:
27 | # gem 'bj'
28 | # gem 'nokogiri'
29 | # gem 'sqlite3-ruby', :require => 'sqlite3'
30 | # gem 'aws-s3', :require => 'aws/s3'
31 |
32 | # Bundle gems for the local environment. Make sure to
33 | # put test-only gems in this group so their generators
34 | # and rake tasks are available in development mode:
35 | # group :development, :test do
36 | # gem 'webrat'
37 | # end
38 | group :development, :test do
39 | gem 'rspec-rails'
40 | gem 'selenium-webdriver', '~> 2.44.0'
41 | gem 'capybara'
42 | gem 'launchy'
43 | end
44 |
45 | group :test do
46 | gem 'database_cleaner'
47 | end
--------------------------------------------------------------------------------
/gemfiles/4.0.gemfile:
--------------------------------------------------------------------------------
1 | gem "rails", "~> 4.0"
2 |
3 | gem 'sass'
4 | gem 'coffee-script'
5 | gem 'uglifier'
6 |
7 | # Bundle edge Rails instead:
8 | # gem 'rails', :git => 'git://github.com/rails/rails.git'
9 |
10 | gem 'sqlite3'
11 |
12 | gem 'paperclip'
13 | gem 'jquery-rails'
14 | gem 'responders', '~> 2.0'
15 | #gem 'activerecord-sqlite3-adapter'
16 |
17 | # Use unicorn as the web server
18 | # gem 'unicorn'
19 |
20 | # Deploy with Capistrano
21 | # gem 'capistrano'
22 |
23 | # To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
24 | # gem 'ruby-debug'
25 | # gem 'ruby-debug19'
26 |
27 | # Bundle the extra gems:
28 | # gem 'bj'
29 | # gem 'nokogiri'
30 | # gem 'sqlite3-ruby', :require => 'sqlite3'
31 | # gem 'aws-s3', :require => 'aws/s3'
32 |
33 | # Bundle gems for the local environment. Make sure to
34 | # put test-only gems in this group so their generators
35 | # and rake tasks are available in development mode:
36 | # group :development, :test do
37 | # gem 'webrat'
38 | # end
39 | group :development, :test do
40 | gem 'rspec-rails'
41 | gem 'selenium-webdriver', '~> 2.44.0'
42 | gem 'capybara'
43 | gem 'launchy'
44 | end
45 |
46 | group :test do
47 | gem 'database_cleaner'
48 | end
--------------------------------------------------------------------------------
/gemfiles/4.1.gemfile:
--------------------------------------------------------------------------------
1 | gem "rails", "~> 4.1"
2 |
3 | gem 'sass'
4 | gem 'coffee-script'
5 | gem 'uglifier'
6 |
7 | # Bundle edge Rails instead:
8 | # gem 'rails', :git => 'git://github.com/rails/rails.git'
9 |
10 | gem 'sqlite3'
11 |
12 | gem 'paperclip'
13 | gem 'jquery-rails'
14 | gem 'responders', '~> 2.0'
15 | #gem 'activerecord-sqlite3-adapter'
16 |
17 | # Use unicorn as the web server
18 | # gem 'unicorn'
19 |
20 | # Deploy with Capistrano
21 | # gem 'capistrano'
22 |
23 | # To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
24 | # gem 'ruby-debug'
25 | # gem 'ruby-debug19'
26 |
27 | # Bundle the extra gems:
28 | # gem 'bj'
29 | # gem 'nokogiri'
30 | # gem 'sqlite3-ruby', :require => 'sqlite3'
31 | # gem 'aws-s3', :require => 'aws/s3'
32 |
33 | # Bundle gems for the local environment. Make sure to
34 | # put test-only gems in this group so their generators
35 | # and rake tasks are available in development mode:
36 | # group :development, :test do
37 | # gem 'webrat'
38 | # end
39 | group :development, :test do
40 | gem 'rspec-rails'
41 | gem 'selenium-webdriver', '~> 2.44.0'
42 | gem 'capybara'
43 | gem 'launchy'
44 | end
45 |
46 | group :test do
47 | gem 'database_cleaner'
48 | end
--------------------------------------------------------------------------------
/gemfiles/4.2.gemfile:
--------------------------------------------------------------------------------
1 | gem "rails", "~> 4.2"
2 |
3 | gem 'sass'
4 | gem 'coffee-script'
5 | gem 'uglifier'
6 |
7 | # Bundle edge Rails instead:
8 | # gem 'rails', :git => 'git://github.com/rails/rails.git'
9 |
10 | gem 'sqlite3'
11 |
12 | gem 'paperclip'
13 | gem 'jquery-rails'
14 | gem 'responders', '~> 2.0'
15 | #gem 'activerecord-sqlite3-adapter'
16 |
17 | # Use unicorn as the web server
18 | # gem 'unicorn'
19 |
20 | # Deploy with Capistrano
21 | # gem 'capistrano'
22 |
23 | # To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
24 | # gem 'ruby-debug'
25 | # gem 'ruby-debug19'
26 |
27 | # Bundle the extra gems:
28 | # gem 'bj'
29 | # gem 'nokogiri'
30 | # gem 'sqlite3-ruby', :require => 'sqlite3'
31 | # gem 'aws-s3', :require => 'aws/s3'
32 |
33 | # Bundle gems for the local environment. Make sure to
34 | # put test-only gems in this group so their generators
35 | # and rake tasks are available in development mode:
36 | # group :development, :test do
37 | # gem 'webrat'
38 | # end
39 | group :development, :test do
40 | gem 'rspec-rails'
41 | gem 'selenium-webdriver', '~> 2.44.0'
42 | gem 'capybara'
43 | gem 'launchy'
44 | end
45 |
46 | group :test do
47 | gem 'database_cleaner'
48 | end
--------------------------------------------------------------------------------
/lib/tasks/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JangoSteve/Rails-jQuery-Demo/ce3b4dcfa45fb57bac2bb3bf9faaadb7e5994560/lib/tasks/.gitkeep
--------------------------------------------------------------------------------
/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The page you were looking for doesn't exist (404)
5 |
17 |
18 |
19 |
20 |
21 |
22 |
The page you were looking for doesn't exist.
23 |
You may have mistyped the address or the page may have moved.