diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..39a84cc --- /dev/null +++ b/.travis.yml @@ -0,0 +1,18 @@ +language: ruby +sudo: false +rvm: + - 2.1.8 + - 2.2.4 + - 2.3.0 + +gemfile: + - gemfiles/Gemfile-4.1.x + - gemfiles/Gemfile-4.2.x + - gemfiles/Gemfile-5.0.x + +before_script: + - 'bundle install' + - 'cd test/dummy; rake db:migrate; rake db:test:prepare; cd ../..' + +notifications: + email: false diff --git a/Gemfile.lock b/Gemfile.lock index 3c1a563..3ed64d6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,8 +1,8 @@ PATH remote: . specs: - buoy (0.0.1) - rails (~> 4.2.5.1) + buoys (0.1.0) + rails (>= 4.1.0) GEM remote: https://rubygems.org/ @@ -44,7 +44,8 @@ GEM tzinfo (~> 1.1) arel (6.0.3) builder (3.2.2) - concurrent-ruby (1.0.0) + coderay (1.1.1) + concurrent-ruby (1.0.1) erubis (2.7.0) globalid (0.3.6) activesupport (>= 4.1.0) @@ -54,11 +55,18 @@ GEM nokogiri (>= 1.5.9) mail (2.6.3) mime-types (>= 1.16, < 3) + method_source (0.8.2) mime-types (2.99.1) mini_portile2 (2.0.0) minitest (5.8.4) nokogiri (1.6.7.2) mini_portile2 (~> 2.0.0.rc2) + pry (0.10.3) + coderay (~> 1.1.0) + method_source (~> 0.8.1) + slop (~> 3.4) + pry-rails (0.3.4) + pry (>= 0.9.10) rack (1.6.4) rack-test (0.6.3) rack (>= 1.0) @@ -87,10 +95,11 @@ GEM rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (10.5.0) + slop (3.6.0) sprockets (3.5.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.0.2) + sprockets-rails (3.0.4) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) @@ -104,7 +113,8 @@ PLATFORMS ruby DEPENDENCIES - buoy! + buoys! + pry-rails sqlite3 BUNDLED WITH diff --git a/README.md b/README.md new file mode 100644 index 0000000..966b50e --- /dev/null +++ b/README.md @@ -0,0 +1,106 @@ +# Buoys + +Buoys is a Ruby on Rails breadcrumb plugin like [gretel](https://github.com/lassebunk/gretel). + +## Motivation + +I like [gretel](https://github.com/lassebunk/gretel) and respect its idea, but I want to create simpler breadcrumb library like [gretel](https://github.com/lassebunk/gretel) using I18n. + +## Installation + +In your Gemfile + +```ruby +gem 'buoys' +``` + +And run: + +```ruby +$ bundle install +``` + +## Example + +Start by generating configuration and example files. +```ruby +$ bin/rails g buoys:install + create config/locale/buoys.en.yml + create app/views/breadcrumbs/_buoys.html.erb + create config/buoys/breadcrumbs.rb +``` + +Then, in `config/buoys/breadcrumbs.rb` +```ruby +buoy :stories do + link 'Stories', stories_path +end + +# 'crumb' is the alias of 'buoy' +# ex) +crumb :stories do + link 'Stories', stories_path +end + +# link's first argument, it is used as I18n key and defalt value. +# The key is searched in the scope of 'buoys.breadcrumbs'. +# ex) +buoy :story do |story| + link :story, story_path(story) + # same as `link I18n.t('story', scope: 'buoys.breadcrumbs', default: 'story'), story_path(story)` +end + +# You can alse override Buoys configuration +# ex) +buoy :story_tasks do |story| + link :story_tasks, story_tasks_path + pre_buoy :story, story, {link_current: true} +end + +# You can use 'pre_buoy' as parent. 'parent' is the alias of re_buoy` +# ex) +buoy :story_tasks do |story| + link :story_tasks, story_tasks_path + parent :story, story +end +``` + +Then, set the current buoy(breadcrumb) at the top of view file (like `app/views/stories/index.html.erb`). + +```ruby +<% buoy :stories %> +``` + +Then, in `app/views/layouts/application.html.erb`. +```ruby +<%= render partial: 'breadcrumbs/buoys' %> +``` + +Then, You can build and change breadcrumb `app/views/breadcrumbs/_buoys.html.erb` + +```erb +<% if buoys.any? %> + +<% end %> +``` + +## Options + +| option | description | default | +| -------------- | ----------- | ------- | +| :link_current | whether current buoy(breadcrumb) should be linked to | false | +| :current_class | CSS class for current link. if you set `nil`, it is not set CSS class | 'active' | + +Copyright (c) 2016 muryoimpl Released under the MIT license diff --git a/README.rdoc b/README.rdoc deleted file mode 100644 index 1e6d026..0000000 --- a/README.rdoc +++ /dev/null @@ -1,3 +0,0 @@ -= Buoy - -This project rocks and uses MIT-LICENSE. \ No newline at end of file diff --git a/buoy.gemspec b/buoys.gemspec similarity index 53% rename from buoy.gemspec rename to buoys.gemspec index 050f12f..b01fb41 100644 --- a/buoy.gemspec +++ b/buoys.gemspec @@ -1,23 +1,24 @@ $:.push File.expand_path("../lib", __FILE__) # Maintain your gem's version: -require "buoy/version" +require "buoys/version" # Describe your gem and declare its dependencies: Gem::Specification.new do |s| - s.name = "buoy" - s.version = Buoy::VERSION + s.name = "buoys" + s.version = Buoys::VERSION s.authors = ["muryoimpl"] s.email = ["muryoimpl@gmail.com"] - s.homepage = "TODO" - s.summary = "TODO: Summary of Buoy." - s.description = "TODO: Description of Buoy." + s.homepage = "https://github.com/muryoimpl/buoys" + s.summary = "A Ruby on Rails breadcrumbs plugin." + s.description = "A Ruby on Rails breadcrumbs plugin." s.license = "MIT" - s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"] + s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"] s.test_files = Dir["test/**/*"] - s.add_dependency "rails", "~> 4.2.5.1" + s.add_dependency "rails", ">= 4.1.0" s.add_development_dependency "sqlite3" + s.add_development_dependency "pry-rails" end diff --git a/gemfiles/Gemfile-rails4.1.x b/gemfiles/Gemfile-rails4.1.x new file mode 100644 index 0000000..7a8621f --- /dev/null +++ b/gemfiles/Gemfile-rails4.1.x @@ -0,0 +1,6 @@ +source 'https://rubygems.org' + +gem 'rails', '~> 4.1.0' +gem 'sqlite3' + +gem 'buoys', path: '../' diff --git a/gemfiles/Gemfile-rails4.2.x b/gemfiles/Gemfile-rails4.2.x new file mode 100644 index 0000000..fb951e8 --- /dev/null +++ b/gemfiles/Gemfile-rails4.2.x @@ -0,0 +1,6 @@ +source 'https://rubygems.org' + +gem 'rails', '~> 4.2.0' +gem 'sqlite3' + +gem 'buoys', path: '../' diff --git a/gemfiles/Gemfile-rails5.0.x b/gemfiles/Gemfile-rails5.0.x new file mode 100644 index 0000000..28a9b5d --- /dev/null +++ b/gemfiles/Gemfile-rails5.0.x @@ -0,0 +1,6 @@ +source 'https://rubygems.org' + +gem 'rails', '~> 5.0.0.beta3' +gem 'sqlite3' + +gem 'buoys', path: '../' diff --git a/lib/buoy.rb b/lib/buoy.rb deleted file mode 100644 index 4b729e4..0000000 --- a/lib/buoy.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'buoy/version' - -module Buoy -end diff --git a/lib/buoys.rb b/lib/buoys.rb new file mode 100644 index 0000000..aeaec5c --- /dev/null +++ b/lib/buoys.rb @@ -0,0 +1,22 @@ +require 'buoys/version' +require 'buoys/config' +require 'buoys/loader' +require 'buoys/link' +require 'buoys/buoy' +require 'buoys/renderer' +require 'buoys/helper' + +module Buoys + class << self + def buoy_file_paths + @buoy_file_paths ||= [ + Rails.root.join('config', 'buoys', '**', '*.rb') + ] + end + + def configure + yield Buoys::Config + end + end +end +ActionView::Base.send :include, Buoys::Helper diff --git a/lib/buoys/buoy.rb b/lib/buoys/buoy.rb new file mode 100644 index 0000000..2b6230a --- /dev/null +++ b/lib/buoys/buoy.rb @@ -0,0 +1,44 @@ +module Buoys + class Buoy + attr_reader :previous, :context + # buoy :account do + # link 'Account', account_path + # end + # + # buoy :account_edit do |account| + # link 'Account Show', show_account_path(account) + # link 'Account Edit', edit_account_path(account) + # pre_buoy :account + # end + def initialize(context, key, *args) + block = Buoys::Loader.buoys[key] + raise ArgumentError, "Buoys :#{key} is not found" unless block + + @key, @context = key, context + instance_exec *args, &block + end + + def link(key, *args) + options = args.extract_options! + path = args.shift + url = path ? context.url_for(path) : path + + text = I18n.t(key, scope: 'buoys.breadcrumbs', default: key) + + links << Buoys::Link.new(text, url, options) + end + + def links + @links ||= [] + end + + def pre_buoy(key, *args) + @previous = Buoys::Buoy.new(context, key, args) + end + alias_method :parent, :pre_buoy + + def method_missing(method, *args, &block) + context.send(method, *args, &block) + end + end +end diff --git a/lib/buoys/config.rb b/lib/buoys/config.rb new file mode 100644 index 0000000..5d07fc6 --- /dev/null +++ b/lib/buoys/config.rb @@ -0,0 +1,9 @@ +module Buoys + class Config + class << self + attr_accessor :current_class + + attr_accessor :link_current + end + end +end diff --git a/lib/buoys/helper.rb b/lib/buoys/helper.rb new file mode 100644 index 0000000..1d9fa0f --- /dev/null +++ b/lib/buoys/helper.rb @@ -0,0 +1,31 @@ +module Buoys + module Helper + # Declare the breadcrumb which want to render in view. + # + # <%= buoy :help, true %> + def buoy(key, *args) + @_buoys_renderer = Buoys::Renderer.new(self, key, *args) + end + alias_method :breadcrumb, :buoy + + # <% buoys.tap do |links| %> + # <% if links.any? %> + # + # <% end %> + # <% end %> + def buoys + buoys_renderer.render + end + alias_method :breadcrumbs, :buoys + + def buoys_renderer + @_buoys_renderer ||= Buoys::Renderer.new(self, nil) + end + end +end diff --git a/lib/buoys/link.rb b/lib/buoys/link.rb new file mode 100644 index 0000000..465aa04 --- /dev/null +++ b/lib/buoys/link.rb @@ -0,0 +1,51 @@ +module Buoys + class Link + attr_accessor :text, :options, :options_for_config + attr_reader :current + + CONFIG = { + current_class: (Buoys::Config.current_class || 'active'), + link_current: (Buoys::Config.link_current || false), + }.with_indifferent_access + + def initialize(text, url, options) + @options_for_config, @options = extract_options_and_config(options) + @text, @_url = text, url + @current = false + end + + def mark_as_current! + options.merge!(class: config[:current_class]) + @current = true + end + + def current? + !!@current + end + + def url + return '' if current? && !config[:link_current] + + @_url || '' + end + + def url=(str) + @_url = str + end + + private + + def config + CONFIG.merge(options_for_config) + end + + def extract_options_and_config(_options) + options = _options.with_indifferent_access + config = (options.keys & CONFIG.keys).each_with_object({}) {|key, hash| + hash[key] = options.delete(key) + } + + [config, options] + end + end +end diff --git a/lib/buoys/loader.rb b/lib/buoys/loader.rb new file mode 100644 index 0000000..b296c60 --- /dev/null +++ b/lib/buoys/loader.rb @@ -0,0 +1,35 @@ +module Buoys + class Loader + class << self + # + # buoy :account do + # link 'Account', account_path + # end + # + # buoy :account_edit do |account| + # link 'Account Edit', edit_account_path(account) + # pre_buoy :account + # end + def buoy(key, &block) + buoys[key] = block + end + alias_method :crumb, :buoy + + def buoys + @buoys ||= {} + end + + def load_buoys_files + buoys.clear + + buoy_files.each do |file| + instance_eval open(file).read, file + end + end + + def buoy_files + Dir[*Buoys.buoy_file_paths] + end + end + end +end diff --git a/lib/buoys/renderer.rb b/lib/buoys/renderer.rb new file mode 100644 index 0000000..5493e83 --- /dev/null +++ b/lib/buoys/renderer.rb @@ -0,0 +1,36 @@ +module Buoys + class Renderer + def initialize(context, key, *args) + @context, @key, @args = context, key, *args + Buoys::Loader.load_buoys_files if Buoys::Loader.buoys.keys.empty? + end + + def render + return [] unless @key + + buoy = Buoys::Buoy.new(@context, @key, @args) + build_links(buoy) + end + + private + + def build_links(buoy) + links = buoy.links.dup + + links.unshift *collect_previous_links(buoy) + links.last.mark_as_current! + + links + end + + def collect_previous_links(buoy) + links = [] + + while buoy = buoy.previous + links.unshift *buoy.links + end + + links + end + end +end diff --git a/lib/buoy/version.rb b/lib/buoys/version.rb similarity index 64% rename from lib/buoy/version.rb rename to lib/buoys/version.rb index 564b1eb..6db74d6 100644 --- a/lib/buoy/version.rb +++ b/lib/buoys/version.rb @@ -1,3 +1,3 @@ -module Buoy +module Buoys VERSION = "0.0.1" end diff --git a/lib/generators/buoys/install_generator.rb b/lib/generators/buoys/install_generator.rb new file mode 100644 index 0000000..ada02b7 --- /dev/null +++ b/lib/generators/buoys/install_generator.rb @@ -0,0 +1,13 @@ +require 'rails/generators' + +module Buoys + class InstallGenerator < Rails::Generators::Base + source_root File.expand_path('../templates', __FILE__) + + def create_files + copy_file 'buoys.en.yml', 'config/locales/buoys.en.yml' + copy_file '_buoys.html.erb', 'app/views/breadcrumbs/_buoys.html.erb' + copy_file 'breadcrumbs.rb', 'config/buoys/breadcrumbs.rb' + end + end +end diff --git a/lib/generators/buoys/templates/_buoys.html.erb b/lib/generators/buoys/templates/_buoys.html.erb new file mode 100644 index 0000000..f45b1a9 --- /dev/null +++ b/lib/generators/buoys/templates/_buoys.html.erb @@ -0,0 +1,14 @@ +<% if buoys.any? %> + +<% end %> diff --git a/lib/generators/buoys/templates/breadcrumbs.rb b/lib/generators/buoys/templates/breadcrumbs.rb new file mode 100644 index 0000000..f73e132 --- /dev/null +++ b/lib/generators/buoys/templates/breadcrumbs.rb @@ -0,0 +1,38 @@ +buoy :example do + link :example, 'http://localhost:3000' +end + +# buoy :stories do +# link 'Stories', stories_path +# end + +# `crumb` is the alias of `buoy`. +# ex) +# crumb :stories do +# link 'Stories', stories_path +# end + +# link's first argument, it is used as I18n key and defalt value. +# The key is searched in the scope of 'buoys.breadcrumbs'. +# +# ex) +# buoy :story do |story| +# link :story, story_path(story) +# # same as `link I18n.t(:story, scope: 'buoys.breadcrumbs', default: story), story_path(story)` +# end + +# You can alse override Buoys configuration +# +# ex) +# buoy :story_tasks do |story| +# link :story_tasks, story_tasks_path +# pre_buoy :story, story, {link_current: true} +# end + +# You can use `pre_buoy` as parent. `parent` is the alias of `pre_buoy` +# +# ex) +# buoy :story_tasks do |story| +# link :story_tasks, story_tasks_path +# parent :story, story +# end diff --git a/lib/generators/buoys/templates/buoys.en.yml b/lib/generators/buoys/templates/buoys.en.yml new file mode 100644 index 0000000..d715aa5 --- /dev/null +++ b/lib/generators/buoys/templates/buoys.en.yml @@ -0,0 +1,4 @@ +en: + buoys: + breadcrumbs: + example: EXAMPLE diff --git a/test/buoy_test.rb b/test/buoy_test.rb deleted file mode 100644 index fa560e4..0000000 --- a/test/buoy_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class BuoyTest < ActiveSupport::TestCase - test "truth" do - assert_kind_of Module, Buoy - end -end diff --git a/test/buoys_buoy_test.rb b/test/buoys_buoy_test.rb new file mode 100644 index 0000000..ae5524d --- /dev/null +++ b/test/buoys_buoy_test.rb @@ -0,0 +1,30 @@ +require 'test_helper' + +class BuoysBuoyTest < ActiveSupport::TestCase + setup do + @view_context = ActionView::Base.new + Buoys::Loader.load_buoys_files + end + + test 'can interpret multiple `link`s in one buoy block with argument' do + links = Buoys::Buoy.new(@view_context, :help, true).links + + assert_equal links.size, 2 + assert_equal links[0].text, 'help' + assert_equal links[0].url, 'https://example.com/help' + assert_equal links[1].text, 'usage' + assert_equal links[1].url, 'https://example.com/help/usage' + + links = Buoys::Buoy.new(@view_context, :help, false).links + + assert_equal links[0].url, 'http://example.com/help' + assert_equal links[1].url, 'http://example.com/help/usage' + end + + test 'can use :symbol as link name' do + links = Buoys::Buoy.new(@view_context, :account).links + + assert_equal links[0].text, 'Account' + assert_equal links[0].url, 'http://example.com/account' + end +end diff --git a/test/buoys_helper_test.rb b/test/buoys_helper_test.rb new file mode 100644 index 0000000..25858ed --- /dev/null +++ b/test/buoys_helper_test.rb @@ -0,0 +1,42 @@ +require 'test_helper' + +class BuoysHelerTest < ActionView::TestCase + include Buoys::Helper + + test '.buoy (only current)' do + assert respond_to?(:breadcrumb) + + buoy :account + html = render('breadcrumbs/buoys').gsub(/[[:space:]]{2,}|\n/, '') + + assert_dom_equal %{}, html + end + + test '.buoy (not only active)' do + buoy :history + html = render('breadcrumbs/buoys').gsub(/[[:space:]]{2,}|\n/, '') + + assert_dom_equal %{}, html + end + + test '.buoy (has 2 `link`s in one buoy block)' do + breadcrumb :help, true + html = render('breadcrumbs/buoys').gsub(/[[:space:]]{2,}|\n/, '') + + assert_dom_equal %{}, html + end + + test ".buoy (has configuration options in link's arguments)" do + breadcrumb :show_books, 1 + html = render('breadcrumbs/buoys').gsub(/[[:space:]]{2,}|\n/, '') + + assert_dom_equal %{}, html + end + + test '.buoys (no given key)' do + buoys + html = render('breadcrumbs/buoys').gsub(/[[:space:]]{2,}|\n/, '') + + assert_dom_equal '', html + end +end diff --git a/test/buoys_loader_test.rb b/test/buoys_loader_test.rb new file mode 100644 index 0000000..1e0c732 --- /dev/null +++ b/test/buoys_loader_test.rb @@ -0,0 +1,22 @@ +require 'test_helper' + +class BuoysLoaderTest < ActiveSupport::TestCase + test '.buoy_files' do + assert_equal Buoys::Loader.buoy_files.size, 2 + + assert Buoys::Loader.buoy_files.include?(Rails.root.join('config', 'buoys', 'buoys.rb').to_s) + assert Buoys::Loader.buoy_files.include?(Rails.root.join('config', 'buoys', 'breadcrumb.rb').to_s) + end + + test '.buoys' do + Buoys::Loader.load_buoys_files + + actual_keys = [] + expected_keys = %i(account books show_books about history help) + expected_keys.each do |key| + actual_keys << key if Buoys::Loader.buoys.keys.include?(key) + end + + assert_equal actual_keys, expected_keys + end +end diff --git a/test/buoys_test.rb b/test/buoys_test.rb new file mode 100644 index 0000000..4bdcf7b --- /dev/null +++ b/test/buoys_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class BuoysTest < ActiveSupport::TestCase + test ".buoy_file_paths" do + assert_equal [Rails.root.join('config', 'buoys', '**', '*.rb')], Buoys.buoy_file_paths + end +end diff --git a/test/dummy/app/views/breadcrumbs/_buoys.erb b/test/dummy/app/views/breadcrumbs/_buoys.erb new file mode 100644 index 0000000..e793b10 --- /dev/null +++ b/test/dummy/app/views/breadcrumbs/_buoys.erb @@ -0,0 +1,21 @@ +<% if buoys.any? %> + +<% end %> diff --git a/test/dummy/config/application.rb b/test/dummy/config/application.rb index 2305a73..1ae6b57 100644 --- a/test/dummy/config/application.rb +++ b/test/dummy/config/application.rb @@ -3,7 +3,7 @@ require 'rails/all' Bundler.require(*Rails.groups) -require "buoy" +require "buoys" module Dummy class Application < Rails::Application @@ -18,9 +18,9 @@ class Application < Rails::Application # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] # config.i18n.default_locale = :de + config.i18n.default_locale = :en # Do not swallow errors in after_commit/after_rollback callbacks. config.active_record.raise_in_transactional_callbacks = true end end - diff --git a/test/dummy/config/buoys/breadcrumb.rb b/test/dummy/config/buoys/breadcrumb.rb new file mode 100644 index 0000000..50ccc9c --- /dev/null +++ b/test/dummy/config/buoys/breadcrumb.rb @@ -0,0 +1,13 @@ +buoy :about do + link 'about', about_path +end + +buoy :history do + pre_buoy :about + link 'history', history_path +end + +buoy :help do |is_ssl| + link 'help', "#{is_ssl ? 'https' : 'http'}://example.com/help" + link 'usage', "#{is_ssl ? 'https' : 'http'}://example.com/help/usage" +end diff --git a/test/dummy/config/buoys/buoys.rb b/test/dummy/config/buoys/buoys.rb new file mode 100644 index 0000000..81d8091 --- /dev/null +++ b/test/dummy/config/buoys/buoys.rb @@ -0,0 +1,12 @@ +buoy :account do + link :account, 'http://example.com/account' +end + +buoy :books do + link 'Books', 'http://example.com/books' +end + +buoy :show_books do |number| + parent :books + link "show-#{number}", "http://example.com/books/#{number}", link_current: true +end diff --git a/test/dummy/config/locales/en.yml b/test/dummy/config/locales/en.yml index 0653957..d60a020 100644 --- a/test/dummy/config/locales/en.yml +++ b/test/dummy/config/locales/en.yml @@ -21,3 +21,7 @@ en: hello: "Hello world" + + buoys: + breadcrumbs: + account: 'Account' diff --git a/test/dummy/config/routes.rb b/test/dummy/config/routes.rb index 3f66539..1081fa9 100644 --- a/test/dummy/config/routes.rb +++ b/test/dummy/config/routes.rb @@ -1,56 +1,4 @@ Rails.application.routes.draw do - # The priority is based upon order of creation: first created -> highest priority. - # See how all your routes lay out with "rake routes". - - # You can have the root of your site routed with "root" - # root 'welcome#index' - - # Example of regular route: - # get 'products/:id' => 'catalog#view' - - # Example of named route that can be invoked with purchase_url(id: product.id) - # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase - - # Example resource route (maps HTTP verbs to controller actions automatically): - # resources :products - - # Example resource route with options: - # resources :products do - # member do - # get 'short' - # post 'toggle' - # end - # - # collection do - # get 'sold' - # end - # end - - # Example resource route with sub-resources: - # resources :products do - # resources :comments, :sales - # resource :seller - # end - - # Example resource route with more complex sub-resources: - # resources :products do - # resources :comments - # resources :sales do - # get 'recent', on: :collection - # end - # end - - # Example resource route with concerns: - # concern :toggleable do - # post 'toggle' - # end - # resources :posts, concerns: :toggleable - # resources :photos, concerns: :toggleable - - # Example resource route within a namespace: - # namespace :admin do - # # Directs /admin/products/* to Admin::ProductsController - # # (app/controllers/admin/products_controller.rb) - # resources :products - # end + get 'about' => 'dummy/dummy', as: :about + get 'about/history' => 'dummy/dummy', as: :history end diff --git a/test/dummy/db/schema.rb b/test/dummy/db/schema.rb new file mode 100644 index 0000000..4dfbb16 --- /dev/null +++ b/test/dummy/db/schema.rb @@ -0,0 +1,16 @@ +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 0) do + +end