'
21 | else
22 | path << o.parent_id
23 | output << '- '
24 | end
25 | elsif i != 0
26 | output << '
- '
27 | end
28 | output << capture(o, path.size - 1, &block)
29 | end
30 |
31 | output << '
' * path.length
32 | output.html_safe
33 | end
34 |
35 | def sorted_nested_li(objects, order, wrapper_attributes = '', &block)
36 | nested_li sort_list(objects, order), wrapper_attributes, &block
37 | end
38 |
39 | private
40 |
41 | def sort_list(objects, order)
42 | objects = objects.order(:lft) if objects.is_a? Class
43 |
44 | # Partition the results
45 | children_of = {}
46 | objects.each do |o|
47 | children_of[o.parent_id] ||= []
48 | children_of[o.parent_id] << o
49 | end
50 |
51 | # Sort each sub-list individually
52 | children_of.each_value do |children|
53 | children.sort_by! &order
54 | end
55 |
56 | # Re-join them into a single list
57 | results = []
58 | recombine_lists(results, children_of, nil)
59 |
60 | results
61 | end
62 |
63 | def recombine_lists(results, children_of, parent_id)
64 | if children_of[parent_id]
65 | children_of[parent_id].each do |o|
66 | results << o
67 | recombine_lists(results, children_of, o.id)
68 | end
69 | end
70 | end
71 |
72 | end
73 | end
74 |
--------------------------------------------------------------------------------
/app/models/how_to/content.rb:
--------------------------------------------------------------------------------
1 | module HowTo
2 | class Content < ActiveRecord::Base
3 | validates :title, :presence => true
4 | validates :section, :presence => true
5 | validates :description, :presence => true
6 |
7 | translates :title, :description
8 | belongs_to :section, :counter_cache => true
9 | scope :active, -> { where(active: true) }
10 |
11 | before_save :fix_counter_cache, :if => ->(c) { !c.new_record? && c.section_id_changed? }
12 |
13 |
14 | include TranslationUtil
15 | allow_multi_locales_edit(*I18n.available_locales)
16 |
17 | # class Translation
18 | # attr_accessible :locale, :title, :description
19 | # end
20 |
21 | private
22 |
23 | def fix_counter_cache
24 | Section.decrement_counter(:contents_count, self.section_id_was)
25 | Section.increment_counter(:contents_count, self.section_id)
26 | end
27 |
28 | def mass_assignment_authorizer(role = :default)
29 | self.class.protected_attributes
30 | end
31 | end
32 | end
33 |
--------------------------------------------------------------------------------
/app/models/how_to/section.rb:
--------------------------------------------------------------------------------
1 | module HowTo
2 | class Section < ActiveRecord::Base
3 | validates :name, :presence => true
4 |
5 | translates :name
6 | acts_as_nested_set
7 |
8 | has_many :contents, :dependent => :destroy
9 |
10 | include HowTo::TranslationUtil
11 | allow_multi_locales_edit(*I18n.available_locales)
12 |
13 | scope :active, -> { where(active: true) }
14 | scope :roots_only, -> { where(:parent_id => nil) }
15 | scope :without, ->(id) { where("id <> ? ", id) if id.present? }
16 | scope :with_content, -> { where("contents_count > 0") }
17 | scope :ordered, -> { order("position ASC") }
18 |
19 | # class Translation
20 | # attr_accessible :locale, :name
21 | # end
22 |
23 | private
24 |
25 | def mass_assignment_authorizer(role = :default)
26 | self.class.protected_attributes
27 | end
28 | end
29 | end
30 |
--------------------------------------------------------------------------------
/app/models/how_to/translation_util.rb:
--------------------------------------------------------------------------------
1 | module HowTo
2 | module TranslationUtil
3 |
4 | def self.included(base)
5 | base.extend ClassMethods
6 | end
7 |
8 | module ClassMethods
9 |
10 | def allow_multi_locales_edit(*locales)
11 | if defined?(self.translated_attribute_names)
12 |
13 | # Find globalize translatable fields
14 | fields = self.translated_attribute_names || []
15 |
16 | # Specially format them with i18n_LOCALE_FIELD_NAME
17 | i18n_fields = fields.collect { |f| locales.collect { |l| "i18n_#{l.to_s}_#{f}".to_sym } }.flatten
18 |
19 | # Store global configuration
20 | @@i18n_multi_edit_options ||= {}
21 |
22 | include InstanceMethods
23 |
24 | i18n_fields.each do |field|
25 | @@i18n_multi_edit_options[field] ||= field.to_s.split('_').collect(&:to_sym)
26 |
27 | self.__send__ :define_method, field do
28 | get_i18nize_value(@@i18n_multi_edit_options[field])
29 | end
30 |
31 | self.__send__ :define_method, "#{field.to_s}=".to_sym do |value|
32 | set_i18nize_value(@@i18n_multi_edit_options[field], value)
33 | end
34 | end
35 | end
36 | end
37 |
38 | end
39 |
40 | module InstanceMethods
41 | # Set method for I18nize call, so it will automatically store current
42 | # locale and set the desire locale then rollback to the active one.
43 | def i18nize_call(locale, &block)
44 | active_locale = I18n.locale.to_s
45 | I18n.locale = locale
46 |
47 | result = block.call()
48 |
49 | I18n.locale = active_locale
50 | result
51 | end
52 |
53 | # Execute in the field accessor
54 | def get_i18nize_value(field_parts)
55 | i18nize_call(field_parts[1]) do
56 | field_name = field_parts.to_a.join('_')
57 | self.__send__ field_name[8..-1].to_sym
58 | end
59 | end
60 |
61 | # Set the field value
62 | def set_i18nize_value(field_parts, value)
63 | i18nize_call(field_parts[1]) do
64 | field_name = field_parts.to_a.join('_')
65 | self.__send__ "#{field_name[8..-1].to_s}=", value
66 | end
67 | end
68 | end
69 | end
70 | end
--------------------------------------------------------------------------------
/app/views/how_to/contents/_form.html.erb:
--------------------------------------------------------------------------------
1 |
25 |
26 | <%= form_for @content, :html => {:class => 'form-horizontal'} do |f| %>
27 |
78 | <% end %>
79 |
80 |
81 |
--------------------------------------------------------------------------------
/app/views/how_to/contents/edit.html.erb:
--------------------------------------------------------------------------------
1 | <%= render :partial => 'form' %>
2 |
--------------------------------------------------------------------------------
/app/views/how_to/contents/index.html.erb:
--------------------------------------------------------------------------------
1 | Contents
2 |
3 |
4 |
5 | Title |
6 | Section |
7 | Actions |
8 |
9 |
10 |
11 | <% @contents.each do |content| %>
12 |
13 | <%= link_to content.title, content_path(content) %> |
14 | <%= content.section.try(:name) %> |
15 |
16 | <%= link_to 'Edit', edit_content_path(content), :class => 'btn btn-mini' %>
17 | <%= link_to 'Destroy', content_path(content), :method => :delete, :confirm => 'Are you sure?', :class => 'btn btn-mini btn-danger' %>
18 | |
19 |
20 | <% end %>
21 |
22 |
23 |
24 | <%= link_to 'New', new_content_path, :class => 'btn btn-primary' %>
25 |
--------------------------------------------------------------------------------
/app/views/how_to/contents/new.html.erb:
--------------------------------------------------------------------------------
1 | <%= render :partial => 'form' %>
2 |
--------------------------------------------------------------------------------
/app/views/how_to/contents/show.html.erb:
--------------------------------------------------------------------------------
1 | Content
2 |
3 |
4 | Title
5 | <%= @content.title %>
6 |
7 |
8 |
9 | Description
10 | <%= @content.description.html_safe %>
11 |
12 |
13 |
14 | Active
15 | <%= @content.active %>
16 |
17 |
18 |
19 | <%= link_to 'Back', contents_path, :class => 'btn' %>
20 | <%= link_to 'Edit', edit_content_path(@content), :class => 'btn' %>
21 | <%= link_to 'Delete', content_path(@content), :method => 'delete', :confirm => 'Are you sure?', :class => 'btn btn-danger' %>
22 |
23 |
--------------------------------------------------------------------------------
/app/views/how_to/faq/show.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <% HowTo::Section.with_content.ordered.each do |section| %>
5 |
6 |
7 |
<%= section.name %>
8 |
9 |
10 |
11 | <% section.contents.each do |content| %>
12 | -
13 | <%= link_to content.title.html_safe, "##{dom_id(content)}" %>
14 |
15 | <% end %>
16 |
17 | <% section.contents.each do |content| %>
18 |
19 |
20 |
<%= content.title.html_safe %>
21 |
22 |
23 | <%= content.description.html_safe %>
24 |
25 |
26 | <% end %>
27 |
28 |
29 |
30 |
31 | <% end %>
32 |
33 |
34 |
35 |
36 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/app/views/how_to/sections/_form.html.erb:
--------------------------------------------------------------------------------
1 | <%= form_for @section, :html => {:class => 'form-horizontal'} do |f| %>
2 |
31 | <% end %>
32 |
--------------------------------------------------------------------------------
/app/views/how_to/sections/edit.html.erb:
--------------------------------------------------------------------------------
1 | <%= render :partial => 'form' %>
2 |
--------------------------------------------------------------------------------
/app/views/how_to/sections/index.html.erb:
--------------------------------------------------------------------------------
1 | Sections
2 |
3 |
4 |
5 | Name |
6 | Content count |
7 | Actions |
8 |
9 |
10 |
11 | <% @sections.each do |section| %>
12 |
13 | <%= link_to section.name, section_path(section) %> |
14 | <%= section.contents_count %> |
15 |
16 | <%= link_to 'Edit', edit_section_path(section), :class => 'btn btn-mini' %>
17 | <%= link_to 'Destroy', section_path(section), :method => :delete, :confirm => 'Are you sure?', :class => 'btn btn-mini btn-danger' %>
18 | |
19 |
20 | <% end %>
21 |
22 |
23 |
24 | <%= link_to 'New', new_section_path, :class => 'btn btn-primary' %>
25 |
--------------------------------------------------------------------------------
/app/views/how_to/sections/new.html.erb:
--------------------------------------------------------------------------------
1 | <%= render :partial => 'form' %>
2 |
--------------------------------------------------------------------------------
/app/views/how_to/sections/show.html.erb:
--------------------------------------------------------------------------------
1 | Section
2 |
3 |
4 | Name
5 | <%= @section.name %>
6 |
7 |
8 |
9 | Active
10 | <%= @section.active %>
11 |
12 |
13 |
14 |
15 | <%= link_to 'Back', sections_path, :class => 'btn' %>
16 | <%= link_to 'Edit', edit_section_path(@section), :class => 'btn' %>
17 | <%= link_to 'Delete', section_path(@section), :method => 'delete', :confirm => 'Are you sure?', :class => 'btn btn-danger' %>
18 |
19 |
--------------------------------------------------------------------------------
/app/views/layouts/how_to/_messages.html.erb:
--------------------------------------------------------------------------------
1 | <% flash.each do |name, msg| %>
2 | <% if msg.is_a?(String) %>
3 | ">
4 |
×
5 | <%= content_tag :div, msg, :id => "flash_#{name}" %>
6 |
7 | <% end %>
8 | <% end %>
--------------------------------------------------------------------------------
/app/views/layouts/how_to/_navigation.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
11 | <% if can_manage_how_to? %>
12 |
13 |
14 |
15 | - <%= link_to 'Sections', :sections %>
16 | - <%= link_to 'Contents', :contents %>
17 |
18 |
19 |
20 | <% end %>
21 |
22 |
--------------------------------------------------------------------------------
/app/views/layouts/how_to/application.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | <%= content_for?(:title) ? yield(:title) : "App Name" %>
12 | ">
13 | <%= stylesheet_link_tag "how_to/application", :media => "all" %>
14 | <%= javascript_include_tag "how_to/application" %>
15 | <%= csrf_meta_tags %>
16 | <%= yield(:head) %>
17 |
18 |
19 |
23 |
24 |
25 |
26 |
27 |
30 |
31 |
32 | <%= render 'layouts/how_to/navigation' %>
33 | <%= yield %>
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application.
3 |
4 | ENGINE_ROOT = File.expand_path('../..', __FILE__)
5 | ENGINE_PATH = File.expand_path('../../lib/how_to/engine', __FILE__)
6 |
7 | # Set up gems listed in the Gemfile.
8 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
9 | require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
10 |
11 | require 'rails/all'
12 | require 'rails/engine/commands'
13 |
--------------------------------------------------------------------------------
/config/routes.rb:
--------------------------------------------------------------------------------
1 | HowTo::Engine.routes.draw do
2 | resources :sections
3 |
4 | resources :contents
5 | root :to => "faq#show"
6 | end
7 |
--------------------------------------------------------------------------------
/db/migrate/20130602053453_create_how_to_sections.rb:
--------------------------------------------------------------------------------
1 | class CreateHowToSections < ActiveRecord::Migration
2 | def change
3 | create_table :how_to_sections do |t|
4 | t.integer :parent_id
5 | t.boolean :active , default: true
6 | t.integer :sub_sections_count, default: 0
7 | t.integer :contents_count, default: 0
8 | t.integer :order, default: 0
9 | t.integer :lft
10 | t.integer :rgt
11 | t.integer :depth
12 |
13 | t.timestamps
14 | end
15 |
16 | create_table :how_to_section_translations do |t|
17 | t.integer :how_to_section_id
18 | t.string :locale
19 | t.string :name
20 |
21 | t.timestamps
22 | end
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/db/migrate/20130602054608_create_how_to_contents.rb:
--------------------------------------------------------------------------------
1 | class CreateHowToContents < ActiveRecord::Migration
2 | def change
3 | create_table :how_to_contents do |t|
4 | t.integer :section_id
5 | t.integer :order , default: 0
6 | t.boolean :active, default: true
7 | t.timestamps
8 | end
9 |
10 | create_table :how_to_content_translations do |t|
11 | t.integer :how_to_content_id
12 | t.string :locale
13 | t.string :title
14 | t.text :description
15 |
16 | t.timestamps
17 | end
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/db/migrate/20130906034009_alter_order_column.rb:
--------------------------------------------------------------------------------
1 | class AlterOrderColumn < ActiveRecord::Migration
2 | def up
3 | rename_column :how_to_sections, :order, :position
4 | rename_column :how_to_contents, :order, :position
5 | end
6 |
7 | def down
8 | rename_column :how_to_sections, :position, :order
9 | rename_column :how_to_contents, :position, :order
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/how_to.gemspec:
--------------------------------------------------------------------------------
1 | $:.push File.expand_path("../lib", __FILE__)
2 |
3 | # Maintain your gem's version:
4 | require "how_to/version"
5 |
6 | # Describe your gem and declare its dependencies:
7 | Gem::Specification.new do |s|
8 | s.name = "how_to"
9 | s.version = HowTo::VERSION
10 | s.authors = ["Muntasim Ahmed"]
11 | s.email = ["ahmed2tul@gmail.com"]
12 | s.homepage = "https://github.com/railscash/how_to"
13 | s.summary = "Rails engine that makes managing faq/manual easy and simple."
14 | s.description = "Multilingual CMS for managing faq, question/answer, manual etc."
15 |
16 | s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
17 | s.test_files = Dir["test/**/*"]
18 |
19 | s.add_dependency "rails", "~> 4.0"
20 | s.add_dependency "globalize"
21 | s.add_dependency "awesome_nested_set", "~> 3.0"
22 |
23 | s.add_development_dependency "sqlite3"
24 | end
25 |
--------------------------------------------------------------------------------
/lib/generators/how_to/config_generator.rb:
--------------------------------------------------------------------------------
1 | module HowTo
2 | module Generators
3 | class ConfigGenerator < Rails::Generators::Base
4 | source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
5 |
6 | desc < for rich text editor
4 | #You have to install mercury to your application
5 | # rich_text is not working now
6 | #config.rich_text_enabled = false
7 |
8 | # You can override the layout name
9 | #
10 | #config.layout_name = 'application'
11 |
12 | #in your application controller:
13 | # def authorize_to_manage_how_to
14 | # redirect_to :somewhere_else unless
15 | # end
16 | #
17 | #config.authorization_method_to_manage = :authorize_to_manage_how_to!
18 | #
19 | # if you want to set some permission to vew the how to then you can set a method name and define it as like authorization_method_to_manage
20 | # def allowed_to_view_how_to
21 | # redirect_to main_app.root_path, :notice => t('notifications.admin_section_access_error') unless current_user
22 | # end
23 | #config.authorization_method_to_view = nil #nil allows everybody to vew the how lo page
24 |
25 | #this method should return true/false
26 | #config.permitted_to_manage_how_to = :permitted_to_manage_how_to?
27 | end
28 |
--------------------------------------------------------------------------------
/lib/generators/how_to/view_generator.rb:
--------------------------------------------------------------------------------
1 | module HowTo
2 | module Generators
3 |
4 | class ViewGenerator < Rails::Generators::Base
5 | source_root File.expand_path('../../../../app/views/how_to', __FILE__)
6 |
7 | desc <rake doc:app.
29 |
--------------------------------------------------------------------------------
/test/dummy/Rakefile:
--------------------------------------------------------------------------------
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 | Rails.application.load_tasks
7 |
--------------------------------------------------------------------------------
/test/dummy/app/assets/images/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amuntasim/how_to/3c3a5ee677a2c5ca7e819f83078ade3db2f886c2/test/dummy/app/assets/images/.keep
--------------------------------------------------------------------------------
/test/dummy/app/assets/javascripts/application.js:
--------------------------------------------------------------------------------
1 | // This is a manifest file that'll be compiled into application.js, which will include all the files
2 | // listed below.
3 | //
4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5 | // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6 | //
7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8 | // compiled file.
9 | //
10 | // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11 | // about supported directives.
12 | //
13 | //= require_tree .
14 |
--------------------------------------------------------------------------------
/test/dummy/app/assets/stylesheets/application.css:
--------------------------------------------------------------------------------
1 | /*
2 | * This is a manifest file that'll be compiled into application.css, which will include all the files
3 | * listed below.
4 | *
5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6 | * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7 | *
8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9 | * compiled file so the styles you add here take precedence over styles defined in any styles
10 | * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11 | * file per style scope.
12 | *
13 | *= require_tree .
14 | *= require_self
15 | */
16 |
--------------------------------------------------------------------------------
/test/dummy/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | class ApplicationController < ActionController::Base
2 | # Prevent CSRF attacks by raising an exception.
3 | # For APIs, you may want to use :null_session instead.
4 | protect_from_forgery with: :exception
5 | end
6 |
--------------------------------------------------------------------------------
/test/dummy/app/controllers/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amuntasim/how_to/3c3a5ee677a2c5ca7e819f83078ade3db2f886c2/test/dummy/app/controllers/concerns/.keep
--------------------------------------------------------------------------------
/test/dummy/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 | end
3 |
--------------------------------------------------------------------------------
/test/dummy/app/mailers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amuntasim/how_to/3c3a5ee677a2c5ca7e819f83078ade3db2f886c2/test/dummy/app/mailers/.keep
--------------------------------------------------------------------------------
/test/dummy/app/models/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amuntasim/how_to/3c3a5ee677a2c5ca7e819f83078ade3db2f886c2/test/dummy/app/models/.keep
--------------------------------------------------------------------------------
/test/dummy/app/models/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amuntasim/how_to/3c3a5ee677a2c5ca7e819f83078ade3db2f886c2/test/dummy/app/models/concerns/.keep
--------------------------------------------------------------------------------
/test/dummy/app/views/layouts/application.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Dummy
5 | <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6 | <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7 | <%= csrf_meta_tags %>
8 |
9 |
10 |
11 | <%= yield %>
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/test/dummy/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 | load Gem.bin_path('bundler', 'bundle')
4 |
--------------------------------------------------------------------------------
/test/dummy/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | APP_PATH = File.expand_path('../../config/application', __FILE__)
3 | require_relative '../config/boot'
4 | require 'rails/commands'
5 |
--------------------------------------------------------------------------------
/test/dummy/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require_relative '../config/boot'
3 | require 'rake'
4 | Rake.application.run
5 |
--------------------------------------------------------------------------------
/test/dummy/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 Rails.application
5 |
--------------------------------------------------------------------------------
/test/dummy/config/application.rb:
--------------------------------------------------------------------------------
1 | require File.expand_path('../boot', __FILE__)
2 |
3 | require 'rails/all'
4 |
5 | Bundler.require(*Rails.groups)
6 | require "how_to"
7 |
8 | module Dummy
9 | class Application < Rails::Application
10 | # Settings in config/environments/* take precedence over those specified here.
11 | # Application configuration should go into files in config/initializers
12 | # -- all .rb files in that directory are automatically loaded.
13 |
14 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
15 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
16 | # config.time_zone = 'Central Time (US & Canada)'
17 |
18 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
19 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
20 | # config.i18n.default_locale = :de
21 | end
22 | end
23 |
24 |
--------------------------------------------------------------------------------
/test/dummy/config/boot.rb:
--------------------------------------------------------------------------------
1 | # Set up gems listed in the Gemfile.
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3 |
4 | require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5 | $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
6 |
--------------------------------------------------------------------------------
/test/dummy/config/database.yml:
--------------------------------------------------------------------------------
1 | # SQLite version 3.x
2 | # gem install sqlite3
3 | #
4 | # Ensure the SQLite 3 gem is defined in your Gemfile
5 | # gem 'sqlite3'
6 | #
7 | default: &default
8 | adapter: sqlite3
9 | pool: 5
10 | timeout: 5000
11 |
12 | development:
13 | <<: *default
14 | database: db/development.sqlite3
15 |
16 | # Warning: The database defined as "test" will be erased and
17 | # re-generated from your development database when you run "rake".
18 | # Do not set this db to the same as development or production.
19 | test:
20 | <<: *default
21 | database: db/test.sqlite3
22 |
23 | production:
24 | <<: *default
25 | database: db/production.sqlite3
26 |
--------------------------------------------------------------------------------
/test/dummy/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require File.expand_path('../application', __FILE__)
3 |
4 | # Initialize the Rails application.
5 | Rails.application.initialize!
6 |
--------------------------------------------------------------------------------
/test/dummy/config/environments/development.rb:
--------------------------------------------------------------------------------
1 | Rails.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 web server when you make code changes.
7 | config.cache_classes = false
8 |
9 | # Do not eager load code on boot.
10 | config.eager_load = false
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 | # Raise an error on page load if there are pending migrations.
23 | config.active_record.migration_error = :page_load
24 |
25 | # Debug mode disables concatenation and preprocessing of assets.
26 | # This option may cause significant delays in view rendering with a large
27 | # number of complex assets.
28 | config.assets.debug = true
29 |
30 | # Adds additional error checking when serving assets at runtime.
31 | # Checks for improperly declared sprockets dependencies.
32 | # Raises helpful error messages.
33 | config.assets.raise_runtime_errors = true
34 |
35 | # Raises error for missing translations
36 | # config.action_view.raise_on_missing_translations = true
37 | end
38 |
--------------------------------------------------------------------------------
/test/dummy/config/environments/production.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # Code is not reloaded between requests.
5 | config.cache_classes = true
6 |
7 | # Eager load code on boot. This eager loads most of Rails and
8 | # your application in memory, allowing both threaded web servers
9 | # and those relying on copy on write to perform better.
10 | # Rake tasks automatically ignore this option for performance.
11 | config.eager_load = true
12 |
13 | # Full error reports are disabled and caching is turned on.
14 | config.consider_all_requests_local = false
15 | config.action_controller.perform_caching = true
16 |
17 | # Enable Rack::Cache to put a simple HTTP cache in front of your application
18 | # Add `rack-cache` to your Gemfile before enabling this.
19 | # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
20 | # config.action_dispatch.rack_cache = true
21 |
22 | # Disable Rails's static asset server (Apache or nginx will already do this).
23 | config.serve_static_assets = false
24 |
25 | # Compress JavaScripts and CSS.
26 | config.assets.js_compressor = :uglifier
27 | # config.assets.css_compressor = :sass
28 |
29 | # Do not fallback to assets pipeline if a precompiled asset is missed.
30 | config.assets.compile = false
31 |
32 | # Generate digests for assets URLs.
33 | config.assets.digest = true
34 |
35 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
36 |
37 | # Specifies the header that your server uses for sending files.
38 | # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
39 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
40 |
41 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
42 | # config.force_ssl = true
43 |
44 | # Set to :debug to see everything in the log.
45 | config.log_level = :info
46 |
47 | # Prepend all log lines with the following tags.
48 | # config.log_tags = [ :subdomain, :uuid ]
49 |
50 | # Use a different logger for distributed setups.
51 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
52 |
53 | # Use a different cache store in production.
54 | # config.cache_store = :mem_cache_store
55 |
56 | # Enable serving of images, stylesheets, and JavaScripts from an asset server.
57 | # config.action_controller.asset_host = "http://assets.example.com"
58 |
59 | # Ignore bad email addresses and do not raise email delivery errors.
60 | # Set this to true and configure the email server for immediate delivery to raise delivery errors.
61 | # config.action_mailer.raise_delivery_errors = false
62 |
63 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
64 | # the I18n.default_locale when a translation cannot be found).
65 | config.i18n.fallbacks = true
66 |
67 | # Send deprecation notices to registered listeners.
68 | config.active_support.deprecation = :notify
69 |
70 | # Disable automatic flushing of the log to improve performance.
71 | # config.autoflush_log = false
72 |
73 | # Use default logging formatter so that PID and timestamp are not suppressed.
74 | config.log_formatter = ::Logger::Formatter.new
75 |
76 | # Do not dump schema after migrations.
77 | config.active_record.dump_schema_after_migration = false
78 | end
79 |
--------------------------------------------------------------------------------
/test/dummy/config/environments/test.rb:
--------------------------------------------------------------------------------
1 | Rails.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 | # Do not eager load code on boot. This avoids loading your whole application
11 | # just for the purpose of running a single test. If you are using a tool that
12 | # preloads Rails for running tests, you may have to set it to true.
13 | config.eager_load = false
14 |
15 | # Configure static asset server for tests with Cache-Control for performance.
16 | config.serve_static_assets = true
17 | config.static_cache_control = 'public, max-age=3600'
18 |
19 | # Show full error reports and disable caching.
20 | config.consider_all_requests_local = true
21 | config.action_controller.perform_caching = false
22 |
23 | # Raise exceptions instead of rendering exception templates.
24 | config.action_dispatch.show_exceptions = false
25 |
26 | # Disable request forgery protection in test environment.
27 | config.action_controller.allow_forgery_protection = false
28 |
29 | # Tell Action Mailer not to deliver emails to the real world.
30 | # The :test delivery method accumulates sent emails in the
31 | # ActionMailer::Base.deliveries array.
32 | config.action_mailer.delivery_method = :test
33 |
34 | # Print deprecation notices to the stderr.
35 | config.active_support.deprecation = :stderr
36 |
37 | # Raises error for missing translations
38 | # config.action_view.raise_on_missing_translations = true
39 | end
40 |
--------------------------------------------------------------------------------
/test/dummy/config/initializers/assets.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Version of your assets, change this if you want to expire all your assets.
4 | Rails.application.config.assets.version = '1.0'
5 |
6 | # Precompile additional assets.
7 | # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
8 | # Rails.application.config.assets.precompile += %w( search.js )
9 |
--------------------------------------------------------------------------------
/test/dummy/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 |
--------------------------------------------------------------------------------
/test/dummy/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.action_dispatch.cookies_serializer = :json
--------------------------------------------------------------------------------
/test/dummy/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Configure sensitive parameters which will be filtered from the log file.
4 | Rails.application.config.filter_parameters += [:password]
5 |
--------------------------------------------------------------------------------
/test/dummy/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. Inflections
4 | # are locale specific, and you may define rules for as many different
5 | # locales as you wish. All of these examples are active by default:
6 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
7 | # inflect.plural /^(ox)$/i, '\1en'
8 | # inflect.singular /^(ox)en/i, '\1'
9 | # inflect.irregular 'person', 'people'
10 | # inflect.uncountable %w( fish sheep )
11 | # end
12 |
13 | # These inflection rules are supported but not enabled by default:
14 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
15 | # inflect.acronym 'RESTful'
16 | # end
17 |
--------------------------------------------------------------------------------
/test/dummy/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 |
--------------------------------------------------------------------------------
/test/dummy/config/initializers/session_store.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.session_store :cookie_store, key: '_dummy_session'
4 |
--------------------------------------------------------------------------------
/test/dummy/config/initializers/wrap_parameters.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # This file contains settings for ActionController::ParamsWrapper which
4 | # is enabled by default.
5 |
6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7 | ActiveSupport.on_load(:action_controller) do
8 | wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9 | end
10 |
11 | # To enable root element in JSON for ActiveRecord objects.
12 | # ActiveSupport.on_load(:active_record) do
13 | # self.include_root_in_json = true
14 | # end
15 |
--------------------------------------------------------------------------------
/test/dummy/config/locales/en.yml:
--------------------------------------------------------------------------------
1 | # Files in the config/locales directory are used for internationalization
2 | # and are automatically loaded by Rails. If you want to use locales other
3 | # than English, add the necessary files in this directory.
4 | #
5 | # To use the locales, use `I18n.t`:
6 | #
7 | # I18n.t 'hello'
8 | #
9 | # In views, this is aliased to just `t`:
10 | #
11 | # <%= t('hello') %>
12 | #
13 | # To use a different locale, set it with `I18n.locale`:
14 | #
15 | # I18n.locale = :es
16 | #
17 | # This would use the information in config/locales/es.yml.
18 | #
19 | # To learn more, please read the Rails Internationalization guide
20 | # available at http://guides.rubyonrails.org/i18n.html.
21 |
22 | en:
23 | hello: "Hello world"
24 |
--------------------------------------------------------------------------------
/test/dummy/config/routes.rb:
--------------------------------------------------------------------------------
1 | Rails.application.routes.draw do
2 |
3 | mount HowTo::Engine => "/how_to"
4 | end
5 |
--------------------------------------------------------------------------------
/test/dummy/config/secrets.yml:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Your secret key is used for verifying the integrity of signed cookies.
4 | # If you change this key, all old signed cookies will become invalid!
5 |
6 | # Make sure the secret is at least 30 characters and all random,
7 | # no regular words or you'll be exposed to dictionary attacks.
8 | # You can use `rake secret` to generate a secure secret key.
9 |
10 | # Make sure the secrets in this file are kept private
11 | # if you're sharing your code publicly.
12 |
13 | development:
14 | secret_key_base: 358f6abd81ec47f2f696b43b8ce259a8c9ec613dce2eefb3ed31bd85fb4a46cb4abda5a966f31cc55c97e804e132bc4d4b9908f768f674d73afc4e3467cfbf81
15 |
16 | test:
17 | secret_key_base: 06ffd3c153e52fb3f3bdaf781bf7efe424de62ded5fc82303d6f529b156628463a24c8eb05b66706eb71b8b395fa56a50b00590fd79e47d149b2f6b518fa858b
18 |
19 | # Do not keep production secrets in the repository,
20 | # instead read values from the environment.
21 | production:
22 | secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
23 |
--------------------------------------------------------------------------------
/test/dummy/db/development.sqlite3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amuntasim/how_to/3c3a5ee677a2c5ca7e819f83078ade3db2f886c2/test/dummy/db/development.sqlite3
--------------------------------------------------------------------------------
/test/dummy/lib/assets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amuntasim/how_to/3c3a5ee677a2c5ca7e819f83078ade3db2f886c2/test/dummy/lib/assets/.keep
--------------------------------------------------------------------------------
/test/dummy/log/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amuntasim/how_to/3c3a5ee677a2c5ca7e819f83078ade3db2f886c2/test/dummy/log/.keep
--------------------------------------------------------------------------------
/test/dummy/log/development.log:
--------------------------------------------------------------------------------
1 |
2 |
3 | Started GET "/" for 127.0.0.1 at 2014-11-04 17:00:37 +0600
4 | Processing by Rails::WelcomeController#index as HTML
5 | Rendered /Users/muntasinahmed/.rvm/gems/ruby-2.1.0/gems/railties-4.1.7/lib/rails/templates/rails/welcome/index.html.erb (1.8ms)
6 | Completed 200 OK in 8ms (Views: 7.8ms | ActiveRecord: 0.0ms)
7 |
8 |
9 | Started GET "/" for 127.0.0.1 at 2014-11-04 17:55:21 +0600
10 | Processing by Rails::WelcomeController#index as HTML
11 | Rendered /Users/muntasinahmed/.rvm/gems/ruby-2.1.0/gems/railties-4.1.7/lib/rails/templates/rails/welcome/index.html.erb (1.7ms)
12 | Completed 200 OK in 9ms (Views: 8.5ms | ActiveRecord: 0.0ms)
13 |
14 |
15 | Started GET "/how_to" for 127.0.0.1 at 2014-11-04 17:55:27 +0600
16 |
17 | ActionController::RoutingError (No route matches [GET] ""):
18 | actionpack (4.1.7) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
19 | actionpack (4.1.7) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
20 | railties (4.1.7) lib/rails/rack/logger.rb:38:in `call_app'
21 | railties (4.1.7) lib/rails/rack/logger.rb:20:in `block in call'
22 | activesupport (4.1.7) lib/active_support/tagged_logging.rb:68:in `block in tagged'
23 | activesupport (4.1.7) lib/active_support/tagged_logging.rb:26:in `tagged'
24 | activesupport (4.1.7) lib/active_support/tagged_logging.rb:68:in `tagged'
25 | railties (4.1.7) lib/rails/rack/logger.rb:20:in `call'
26 | actionpack (4.1.7) lib/action_dispatch/middleware/request_id.rb:21:in `call'
27 | rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
28 | rack (1.5.2) lib/rack/runtime.rb:17:in `call'
29 | activesupport (4.1.7) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
30 | rack (1.5.2) lib/rack/lock.rb:17:in `call'
31 | actionpack (4.1.7) lib/action_dispatch/middleware/static.rb:84:in `call'
32 | rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
33 | railties (4.1.7) lib/rails/engine.rb:514:in `call'
34 | railties (4.1.7) lib/rails/application.rb:144:in `call'
35 | rack (1.5.2) lib/rack/lock.rb:17:in `call'
36 | rack (1.5.2) lib/rack/content_length.rb:14:in `call'
37 | rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
38 | /Users/muntasinahmed/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
39 | /Users/muntasinahmed/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
40 | /Users/muntasinahmed/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
41 |
42 |
43 | Rendered /Users/muntasinahmed/.rvm/gems/ruby-2.1.0/gems/actionpack-4.1.7/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.2ms)
44 | Rendered /Users/muntasinahmed/.rvm/gems/ruby-2.1.0/gems/actionpack-4.1.7/lib/action_dispatch/middleware/templates/routes/_route.html.erb (0.7ms)
45 | Rendered /Users/muntasinahmed/.rvm/gems/ruby-2.1.0/gems/actionpack-4.1.7/lib/action_dispatch/middleware/templates/routes/_route.html.erb (0.0ms)
46 | Rendered /Users/muntasinahmed/.rvm/gems/ruby-2.1.0/gems/actionpack-4.1.7/lib/action_dispatch/middleware/templates/routes/_table.html.erb (7.2ms)
47 | Rendered /Users/muntasinahmed/.rvm/gems/ruby-2.1.0/gems/actionpack-4.1.7/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb within rescues/layout (27.7ms)
48 |
49 |
50 | Started GET "/how_to" for 127.0.0.1 at 2014-11-04 18:06:47 +0600
51 | Processing by HowTo::FaqController#show as HTML
52 | Rendered /Users/muntasinahmed/projects/rails_apps/how_to/app/views/how_to/faq/show.html.erb within layouts/how_to/application (10.6ms)
53 | Completed 500 Internal Server Error in 17ms
54 |
55 | ActionView::Template::Error (Asset filtered out and will not be served: add `Rails.application.config.assets.precompile += %w( how_to/jquery.scrollTo.min.js )` to `config/initializers/assets.rb` and restart your server):
56 | 1: <% content_for :head do %>
57 | 2: <%= javascript_include_tag 'how_to/jquery.scrollTo.min' %>
58 | 3: <%= javascript_include_tag 'how_to/jquery.localScroll.min' %>
59 | 4: <%= javascript_include_tag 'how_to/jquery.treeview' %>
60 | 5: <%= stylesheet_link_tag 'how_to/jquery.treeview' %>
61 | sprockets-rails (2.2.0) lib/sprockets/rails/helper.rb:193:in `check_errors_for'
62 | sprockets-rails (2.2.0) lib/sprockets/rails/helper.rb:137:in `block in javascript_include_tag'
63 | sprockets-rails (2.2.0) lib/sprockets/rails/helper.rb:136:in `map'
64 | sprockets-rails (2.2.0) lib/sprockets/rails/helper.rb:136:in `javascript_include_tag'
65 | /Users/muntasinahmed/projects/rails_apps/how_to/app/views/how_to/faq/show.html.erb:2:in `block in ___sers_muntasinahmed_projects_rails_apps_how_to_app_views_how_to_faq_show_html_erb__4416949540072123400_2215678520'
66 | actionview (4.1.7) lib/action_view/helpers/capture_helper.rb:38:in `block in capture'
67 | actionview (4.1.7) lib/action_view/helpers/capture_helper.rb:200:in `with_output_buffer'
68 | actionview (4.1.7) lib/action_view/helpers/capture_helper.rb:38:in `capture'
69 | actionview (4.1.7) lib/action_view/helpers/capture_helper.rb:152:in `content_for'
70 | /Users/muntasinahmed/projects/rails_apps/how_to/app/views/how_to/faq/show.html.erb:1:in `___sers_muntasinahmed_projects_rails_apps_how_to_app_views_how_to_faq_show_html_erb__4416949540072123400_2215678520'
71 | actionview (4.1.7) lib/action_view/template.rb:145:in `block in render'
72 | activesupport (4.1.7) lib/active_support/notifications.rb:161:in `instrument'
73 | actionview (4.1.7) lib/action_view/template.rb:339:in `instrument'
74 | actionview (4.1.7) lib/action_view/template.rb:143:in `render'
75 | actionview (4.1.7) lib/action_view/renderer/template_renderer.rb:55:in `block (2 levels) in render_template'
76 | actionview (4.1.7) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
77 | activesupport (4.1.7) lib/active_support/notifications.rb:159:in `block in instrument'
78 | activesupport (4.1.7) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
79 | activesupport (4.1.7) lib/active_support/notifications.rb:159:in `instrument'
80 | actionview (4.1.7) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
81 | actionview (4.1.7) lib/action_view/renderer/template_renderer.rb:54:in `block in render_template'
82 | actionview (4.1.7) lib/action_view/renderer/template_renderer.rb:62:in `render_with_layout'
83 | actionview (4.1.7) lib/action_view/renderer/template_renderer.rb:53:in `render_template'
84 | actionview (4.1.7) lib/action_view/renderer/template_renderer.rb:17:in `render'
85 | actionview (4.1.7) lib/action_view/renderer/renderer.rb:42:in `render_template'
86 | actionview (4.1.7) lib/action_view/renderer/renderer.rb:23:in `render'
87 | actionview (4.1.7) lib/action_view/rendering.rb:99:in `_render_template'
88 | actionpack (4.1.7) lib/action_controller/metal/streaming.rb:217:in `_render_template'
89 | actionview (4.1.7) lib/action_view/rendering.rb:82:in `render_to_body'
90 | actionpack (4.1.7) lib/action_controller/metal/rendering.rb:32:in `render_to_body'
91 | actionpack (4.1.7) lib/action_controller/metal/renderers.rb:32:in `render_to_body'
92 | actionpack (4.1.7) lib/abstract_controller/rendering.rb:25:in `render'
93 | actionpack (4.1.7) lib/action_controller/metal/rendering.rb:16:in `render'
94 | actionpack (4.1.7) lib/action_controller/metal/instrumentation.rb:41:in `block (2 levels) in render'
95 | activesupport (4.1.7) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
96 | /Users/muntasinahmed/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
97 | activesupport (4.1.7) lib/active_support/core_ext/benchmark.rb:12:in `ms'
98 | actionpack (4.1.7) lib/action_controller/metal/instrumentation.rb:41:in `block in render'
99 | actionpack (4.1.7) lib/action_controller/metal/instrumentation.rb:84:in `cleanup_view_runtime'
100 | activerecord (4.1.7) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
101 | actionpack (4.1.7) lib/action_controller/metal/instrumentation.rb:40:in `render'
102 | actionpack (4.1.7) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
103 | actionpack (4.1.7) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
104 | actionpack (4.1.7) lib/abstract_controller/base.rb:189:in `process_action'
105 | actionpack (4.1.7) lib/action_controller/metal/rendering.rb:10:in `process_action'
106 | actionpack (4.1.7) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
107 | activesupport (4.1.7) lib/active_support/callbacks.rb:113:in `call'
108 | activesupport (4.1.7) lib/active_support/callbacks.rb:113:in `call'
109 | activesupport (4.1.7) lib/active_support/callbacks.rb:166:in `block in halting'
110 | activesupport (4.1.7) lib/active_support/callbacks.rb:229:in `call'
111 | activesupport (4.1.7) lib/active_support/callbacks.rb:229:in `block in halting'
112 | activesupport (4.1.7) lib/active_support/callbacks.rb:166:in `call'
113 | activesupport (4.1.7) lib/active_support/callbacks.rb:166:in `block in halting'
114 | activesupport (4.1.7) lib/active_support/callbacks.rb:86:in `call'
115 | activesupport (4.1.7) lib/active_support/callbacks.rb:86:in `run_callbacks'
116 | actionpack (4.1.7) lib/abstract_controller/callbacks.rb:19:in `process_action'
117 | actionpack (4.1.7) lib/action_controller/metal/rescue.rb:29:in `process_action'
118 | actionpack (4.1.7) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
119 | activesupport (4.1.7) lib/active_support/notifications.rb:159:in `block in instrument'
120 | activesupport (4.1.7) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
121 | activesupport (4.1.7) lib/active_support/notifications.rb:159:in `instrument'
122 | actionpack (4.1.7) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
123 | actionpack (4.1.7) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
124 | activerecord (4.1.7) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
125 | actionpack (4.1.7) lib/abstract_controller/base.rb:136:in `process'
126 | actionview (4.1.7) lib/action_view/rendering.rb:30:in `process'
127 | actionpack (4.1.7) lib/action_controller/metal.rb:196:in `dispatch'
128 | actionpack (4.1.7) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
129 | actionpack (4.1.7) lib/action_controller/metal.rb:232:in `block in action'
130 | actionpack (4.1.7) lib/action_dispatch/routing/route_set.rb:82:in `call'
131 | actionpack (4.1.7) lib/action_dispatch/routing/route_set.rb:82:in `dispatch'
132 | actionpack (4.1.7) lib/action_dispatch/routing/route_set.rb:50:in `call'
133 | actionpack (4.1.7) lib/action_dispatch/journey/router.rb:73:in `block in call'
134 | actionpack (4.1.7) lib/action_dispatch/journey/router.rb:59:in `each'
135 | actionpack (4.1.7) lib/action_dispatch/journey/router.rb:59:in `call'
136 | actionpack (4.1.7) lib/action_dispatch/routing/route_set.rb:678:in `call'
137 | railties (4.1.7) lib/rails/engine.rb:514:in `call'
138 | railties (4.1.7) lib/rails/railtie.rb:194:in `public_send'
139 | railties (4.1.7) lib/rails/railtie.rb:194:in `method_missing'
140 | actionpack (4.1.7) lib/action_dispatch/journey/router.rb:73:in `block in call'
141 | actionpack (4.1.7) lib/action_dispatch/journey/router.rb:59:in `each'
142 | actionpack (4.1.7) lib/action_dispatch/journey/router.rb:59:in `call'
143 | actionpack (4.1.7) lib/action_dispatch/routing/route_set.rb:678:in `call'
144 | rack (1.5.2) lib/rack/etag.rb:23:in `call'
145 | rack (1.5.2) lib/rack/conditionalget.rb:25:in `call'
146 | rack (1.5.2) lib/rack/head.rb:11:in `call'
147 | actionpack (4.1.7) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
148 | actionpack (4.1.7) lib/action_dispatch/middleware/flash.rb:254:in `call'
149 | rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
150 | rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
151 | actionpack (4.1.7) lib/action_dispatch/middleware/cookies.rb:560:in `call'
152 | activerecord (4.1.7) lib/active_record/query_cache.rb:36:in `call'
153 | activerecord (4.1.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:621:in `call'
154 | activerecord (4.1.7) lib/active_record/migration.rb:380:in `call'
155 | actionpack (4.1.7) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
156 | activesupport (4.1.7) lib/active_support/callbacks.rb:82:in `run_callbacks'
157 | actionpack (4.1.7) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
158 | actionpack (4.1.7) lib/action_dispatch/middleware/reloader.rb:73:in `call'
159 | actionpack (4.1.7) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
160 | actionpack (4.1.7) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
161 | actionpack (4.1.7) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
162 | railties (4.1.7) lib/rails/rack/logger.rb:38:in `call_app'
163 | railties (4.1.7) lib/rails/rack/logger.rb:20:in `block in call'
164 | activesupport (4.1.7) lib/active_support/tagged_logging.rb:68:in `block in tagged'
165 | activesupport (4.1.7) lib/active_support/tagged_logging.rb:26:in `tagged'
166 | activesupport (4.1.7) lib/active_support/tagged_logging.rb:68:in `tagged'
167 | railties (4.1.7) lib/rails/rack/logger.rb:20:in `call'
168 | actionpack (4.1.7) lib/action_dispatch/middleware/request_id.rb:21:in `call'
169 | rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
170 | rack (1.5.2) lib/rack/runtime.rb:17:in `call'
171 | activesupport (4.1.7) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
172 | rack (1.5.2) lib/rack/lock.rb:17:in `call'
173 | actionpack (4.1.7) lib/action_dispatch/middleware/static.rb:84:in `call'
174 | rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
175 | railties (4.1.7) lib/rails/engine.rb:514:in `call'
176 | railties (4.1.7) lib/rails/application.rb:144:in `call'
177 | rack (1.5.2) lib/rack/lock.rb:17:in `call'
178 | rack (1.5.2) lib/rack/content_length.rb:14:in `call'
179 | rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
180 | /Users/muntasinahmed/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
181 | /Users/muntasinahmed/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
182 | /Users/muntasinahmed/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
183 |
184 |
185 | Rendered /Users/muntasinahmed/.rvm/gems/ruby-2.1.0/gems/actionpack-4.1.7/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.3ms)
186 | Rendered /Users/muntasinahmed/.rvm/gems/ruby-2.1.0/gems/actionpack-4.1.7/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (9.7ms)
187 | Rendered /Users/muntasinahmed/.rvm/gems/ruby-2.1.0/gems/actionpack-4.1.7/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout (20.4ms)
188 |
--------------------------------------------------------------------------------
/test/dummy/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The page you were looking for doesn't exist (404)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
The page you were looking for doesn't exist.
62 |
You may have mistyped the address or the page may have moved.
63 |
64 |
If you are the application owner check the logs for more information.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/test/dummy/public/422.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The change you wanted was rejected (422)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
The change you wanted was rejected.
62 |
Maybe you tried to change something you didn't have access to.
63 |
64 |
If you are the application owner check the logs for more information.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/test/dummy/public/500.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | We're sorry, but something went wrong (500)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
We're sorry, but something went wrong.
62 |
63 |
If you are the application owner check the logs for more information.
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/test/dummy/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amuntasim/how_to/3c3a5ee677a2c5ca7e819f83078ade3db2f886c2/test/dummy/public/favicon.ico
--------------------------------------------------------------------------------
/test/how_to_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class HowToTest < ActiveSupport::TestCase
4 | test "truth" do
5 | assert_kind_of Module, HowTo
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/test/integration/navigation_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class NavigationTest < ActionDispatch::IntegrationTest
4 | fixtures :all
5 |
6 | # test "the truth" do
7 | # assert true
8 | # end
9 | end
10 |
11 |
--------------------------------------------------------------------------------
/test/test_helper.rb:
--------------------------------------------------------------------------------
1 | # Configure Rails Environment
2 | ENV["RAILS_ENV"] = "test"
3 |
4 | require File.expand_path("../dummy/config/environment.rb", __FILE__)
5 | require "rails/test_help"
6 |
7 | Rails.backtrace_cleaner.remove_silencers!
8 |
9 | # Load support files
10 | Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
11 |
12 | # Load fixtures from the engine
13 | if ActiveSupport::TestCase.method_defined?(:fixture_path=)
14 | ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
15 | end
16 |
--------------------------------------------------------------------------------