somehow_has_relation 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. data/.gitignore +7 -0
  2. data/Gemfile +12 -0
  3. data/Rakefile +23 -0
  4. data/lib/somehow_has_relation/version.rb +3 -0
  5. data/lib/somehow_has_relation.rb +68 -0
  6. data/somehow_has_relation.gemspec +24 -0
  7. data/test/dummy2/README +243 -0
  8. data/test/dummy2/Rakefile +10 -0
  9. data/test/dummy2/app/controllers/application_controller.rb +10 -0
  10. data/test/dummy2/app/helpers/application_helper.rb +3 -0
  11. data/test/dummy2/app/models/author.rb +4 -0
  12. data/test/dummy2/app/models/bio.rb +4 -0
  13. data/test/dummy2/app/models/comment.rb +8 -0
  14. data/test/dummy2/app/models/post.rb +4 -0
  15. data/test/dummy2/config/boot.rb +115 -0
  16. data/test/dummy2/config/database.yml +22 -0
  17. data/test/dummy2/config/environment.rb +43 -0
  18. data/test/dummy2/config/environments/development.rb +17 -0
  19. data/test/dummy2/config/environments/production.rb +28 -0
  20. data/test/dummy2/config/environments/test.rb +28 -0
  21. data/test/dummy2/config/initializers/backtrace_silencers.rb +7 -0
  22. data/test/dummy2/config/initializers/cookie_verification_secret.rb +7 -0
  23. data/test/dummy2/config/initializers/inflections.rb +10 -0
  24. data/test/dummy2/config/initializers/mime_types.rb +5 -0
  25. data/test/dummy2/config/initializers/new_rails_defaults.rb +21 -0
  26. data/test/dummy2/config/initializers/session_store.rb +15 -0
  27. data/test/dummy2/config/locales/en.yml +5 -0
  28. data/test/dummy2/config/routes.rb +43 -0
  29. data/test/dummy2/db/development.sqlite3 +0 -0
  30. data/test/dummy2/db/migrate/20110316130454_create_posts.rb +12 -0
  31. data/test/dummy2/db/migrate/20110316142731_create_authors.rb +13 -0
  32. data/test/dummy2/db/migrate/20110316144725_create_comments.rb +13 -0
  33. data/test/dummy2/db/migrate/20110316154717_remove_post_id_from_author.rb +9 -0
  34. data/test/dummy2/db/migrate/20110316154912_add_author_id_to_post.rb +9 -0
  35. data/test/dummy2/db/migrate/20110316155523_create_bios.rb +13 -0
  36. data/test/dummy2/db/migrate/20110316155643_add_bio_id_to_comment.rb +9 -0
  37. data/test/dummy2/db/seeds.rb +7 -0
  38. data/test/dummy2/db/test.sqlite3 +0 -0
  39. data/test/dummy2/log/development.log +52 -0
  40. data/test/dummy2/log/production.log +0 -0
  41. data/test/dummy2/log/server.log +0 -0
  42. data/test/dummy2/log/test.log +11438 -0
  43. data/test/dummy2/public/404.html +30 -0
  44. data/test/dummy2/public/422.html +30 -0
  45. data/test/dummy2/public/500.html +30 -0
  46. data/test/dummy2/public/favicon.ico +0 -0
  47. data/test/dummy2/public/images/rails.png +0 -0
  48. data/test/dummy2/public/index.html +275 -0
  49. data/test/dummy2/public/javascripts/application.js +2 -0
  50. data/test/dummy2/public/javascripts/controls.js +963 -0
  51. data/test/dummy2/public/javascripts/dragdrop.js +973 -0
  52. data/test/dummy2/public/javascripts/effects.js +1128 -0
  53. data/test/dummy2/public/javascripts/prototype.js +4320 -0
  54. data/test/dummy2/public/robots.txt +5 -0
  55. data/test/dummy2/script/about +4 -0
  56. data/test/dummy2/script/console +3 -0
  57. data/test/dummy2/script/dbconsole +3 -0
  58. data/test/dummy2/script/destroy +3 -0
  59. data/test/dummy2/script/generate +3 -0
  60. data/test/dummy2/script/performance/benchmarker +3 -0
  61. data/test/dummy2/script/performance/profiler +3 -0
  62. data/test/dummy2/script/plugin +3 -0
  63. data/test/dummy2/script/runner +3 -0
  64. data/test/dummy2/script/server +3 -0
  65. data/test/dummy2/test/fixtures/authors.yml +7 -0
  66. data/test/dummy2/test/fixtures/bios.yml +7 -0
  67. data/test/dummy2/test/fixtures/comments.yml +7 -0
  68. data/test/dummy2/test/fixtures/posts.yml +11 -0
  69. data/test/dummy2/test/unit/author_test.rb +8 -0
  70. data/test/dummy2/test/unit/bio_test.rb +8 -0
  71. data/test/dummy2/test/unit/comment_test.rb +8 -0
  72. data/test/dummy2/test/unit/post_test.rb +8 -0
  73. data/test/dummy3/.gitignore +4 -0
  74. data/test/dummy3/Rakefile +7 -0
  75. data/test/dummy3/app/controllers/application_controller.rb +3 -0
  76. data/test/dummy3/app/helpers/application_helper.rb +2 -0
  77. data/test/dummy3/app/models/author.rb +4 -0
  78. data/test/dummy3/app/models/bio.rb +4 -0
  79. data/test/dummy3/app/models/comment.rb +8 -0
  80. data/test/dummy3/app/models/post.rb +4 -0
  81. data/test/dummy3/app/views/layouts/application.html.erb +14 -0
  82. data/test/dummy3/config/application.rb +40 -0
  83. data/test/dummy3/config/boot.rb +8 -0
  84. data/test/dummy3/config/database.yml +22 -0
  85. data/test/dummy3/config/environment.rb +5 -0
  86. data/test/dummy3/config/environments/development.rb +26 -0
  87. data/test/dummy3/config/environments/production.rb +49 -0
  88. data/test/dummy3/config/environments/test.rb +35 -0
  89. data/test/dummy3/config/initializers/backtrace_silencers.rb +7 -0
  90. data/test/dummy3/config/initializers/inflections.rb +10 -0
  91. data/test/dummy3/config/initializers/mime_types.rb +5 -0
  92. data/test/dummy3/config/initializers/secret_token.rb +7 -0
  93. data/test/dummy3/config/initializers/session_store.rb +8 -0
  94. data/test/dummy3/config/locales/en.yml +5 -0
  95. data/test/dummy3/config/routes.rb +58 -0
  96. data/test/dummy3/config.ru +4 -0
  97. data/test/dummy3/db/migrate/20110317224541_create_posts.rb +13 -0
  98. data/test/dummy3/db/migrate/20110317224616_create_bios.rb +13 -0
  99. data/test/dummy3/db/migrate/20110317224637_create_comments.rb +14 -0
  100. data/test/dummy3/db/migrate/20110317230301_create_authors.rb +12 -0
  101. data/test/dummy3/db/seeds.rb +7 -0
  102. data/test/dummy3/lib/tasks/.gitkeep +0 -0
  103. data/test/dummy3/public/404.html +26 -0
  104. data/test/dummy3/public/422.html +26 -0
  105. data/test/dummy3/public/500.html +26 -0
  106. data/test/dummy3/public/favicon.ico +0 -0
  107. data/test/dummy3/public/images/rails.png +0 -0
  108. data/test/dummy3/public/index.html +239 -0
  109. data/test/dummy3/public/javascripts/application.js +2 -0
  110. data/test/dummy3/public/javascripts/controls.js +965 -0
  111. data/test/dummy3/public/javascripts/dragdrop.js +974 -0
  112. data/test/dummy3/public/javascripts/effects.js +1123 -0
  113. data/test/dummy3/public/javascripts/prototype.js +6001 -0
  114. data/test/dummy3/public/javascripts/rails.js +191 -0
  115. data/test/dummy3/public/robots.txt +5 -0
  116. data/test/dummy3/public/stylesheets/.gitkeep +0 -0
  117. data/test/dummy3/script/rails +6 -0
  118. data/test/somehow_has_relation_test.rb +114 -0
  119. data/test/test_helper.rb +27 -0
  120. metadata +187 -0
@@ -0,0 +1,5 @@
1
+ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2
+ #
3
+ # To ban all spiders from the entire site uncomment the next two lines:
4
+ # User-Agent: *
5
+ # Disallow: /
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../config/boot', __FILE__)
3
+ $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info"
4
+ require 'commands/about'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../config/boot', __FILE__)
3
+ require 'commands/console'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../config/boot', __FILE__)
3
+ require 'commands/dbconsole'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../config/boot', __FILE__)
3
+ require 'commands/destroy'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../config/boot', __FILE__)
3
+ require 'commands/generate'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../../config/boot', __FILE__)
3
+ require 'commands/performance/benchmarker'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../../config/boot', __FILE__)
3
+ require 'commands/performance/profiler'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../config/boot', __FILE__)
3
+ require 'commands/plugin'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../config/boot', __FILE__)
3
+ require 'commands/runner'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../config/boot', __FILE__)
3
+ require 'commands/server'
@@ -0,0 +1,7 @@
1
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
+
3
+ one:
4
+ post:
5
+
6
+ two:
7
+ post:
@@ -0,0 +1,7 @@
1
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
+
3
+ one:
4
+ author_id: 1
5
+
6
+ two:
7
+ author_id: 1
@@ -0,0 +1,7 @@
1
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
+
3
+ one:
4
+ post:
5
+
6
+ two:
7
+ post:
@@ -0,0 +1,11 @@
1
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
+
3
+ # This model initially had no columns defined. If you add columns to the
4
+ # model remove the '{}' from the fixture names and add the columns immediately
5
+ # below each fixture, per the syntax in the comments below
6
+ #
7
+ one: {}
8
+ # column: value
9
+ #
10
+ two: {}
11
+ # column: value
@@ -0,0 +1,8 @@
1
+ require 'test_helper'
2
+
3
+ class AuthorTest < ActiveSupport::TestCase
4
+ # Replace this with your real tests.
5
+ test "the truth" do
6
+ assert true
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ require 'test_helper'
2
+
3
+ class BioTest < ActiveSupport::TestCase
4
+ # Replace this with your real tests.
5
+ test "the truth" do
6
+ assert true
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ require 'test_helper'
2
+
3
+ class CommentTest < ActiveSupport::TestCase
4
+ # Replace this with your real tests.
5
+ test "the truth" do
6
+ assert true
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ require 'test_helper'
2
+
3
+ class PostTest < ActiveSupport::TestCase
4
+ # Replace this with your real tests.
5
+ test "the truth" do
6
+ assert true
7
+ end
8
+ end
@@ -0,0 +1,4 @@
1
+ .bundle
2
+ db/*.sqlite3
3
+ log/*.log
4
+ tmp/
@@ -0,0 +1,7 @@
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
+ require 'rake'
6
+
7
+ Dummy3::Application.load_tasks
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,4 @@
1
+ class Author < ActiveRecord::Base
2
+ has_one :bio
3
+ has_many :posts
4
+ end
@@ -0,0 +1,4 @@
1
+ class Bio < ActiveRecord::Base
2
+ belongs_to :author
3
+ has_many :comments
4
+ end
@@ -0,0 +1,8 @@
1
+ class Comment < ActiveRecord::Base
2
+ belongs_to :post
3
+ belongs_to :bio
4
+
5
+ def recent?
6
+ created_at >= 1.hour.ago
7
+ end
8
+ end
@@ -0,0 +1,4 @@
1
+ class Post < ActiveRecord::Base
2
+ belongs_to :author
3
+ has_many :comments
4
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy3</title>
5
+ <%= stylesheet_link_tag :all %>
6
+ <%= javascript_include_tag :defaults %>
7
+ <%= csrf_meta_tag %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,40 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ require "somehow_has_relation"
6
+
7
+ module Dummy3
8
+ class Application < Rails::Application
9
+ # Settings in config/environments/* take precedence over those specified here.
10
+ # Application configuration should go into files in config/initializers
11
+ # -- all .rb files in that directory are automatically loaded.
12
+
13
+ # Custom directories with classes and modules you want to be autoloadable.
14
+ # config.autoload_paths += %W(#{config.root}/extras)
15
+
16
+ # Only load the plugins named here, in the order given (default is alphabetical).
17
+ # :all can be used as a placeholder for all plugins not explicitly named.
18
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
19
+
20
+ # Activate observers that should always be running.
21
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
22
+
23
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
24
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
25
+ # config.time_zone = 'Central Time (US & Canada)'
26
+
27
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
28
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
29
+ # config.i18n.default_locale = :de
30
+
31
+ # JavaScript files you want as :defaults (application.js is always included).
32
+ # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
33
+
34
+ # Configure the default encoding used in templates for Ruby 1.9.
35
+ config.encoding = "utf-8"
36
+
37
+ # Configure sensitive parameters which will be filtered from the log file.
38
+ config.filter_parameters += [:password]
39
+ end
40
+ end
@@ -0,0 +1,8 @@
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
+
8
+ $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,22 @@
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: db/test.sqlite3
15
+ pool: 5
16
+ timeout: 5000
17
+
18
+ production:
19
+ adapter: sqlite3
20
+ database: db/production.sqlite3
21
+ pool: 5
22
+ timeout: 5000
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ Dummy3::Application.initialize!
@@ -0,0 +1,26 @@
1
+ Dummy3::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_view.debug_rjs = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Don't care if the mailer can't send
18
+ config.action_mailer.raise_delivery_errors = false
19
+
20
+ # Print deprecation notices to the Rails logger
21
+ config.active_support.deprecation = :log
22
+
23
+ # Only use best-standards-support built into browsers
24
+ config.action_dispatch.best_standards_support = :builtin
25
+ end
26
+
@@ -0,0 +1,49 @@
1
+ Dummy3::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
@@ -0,0 +1,35 @@
1
+ Dummy3::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
@@ -0,0 +1,7 @@
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!
@@ -0,0 +1,10 @@
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
@@ -0,0 +1,5 @@
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
@@ -0,0 +1,7 @@
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
+ Dummy3::Application.config.secret_token = '5505922f6350ccd5ad18ae301b5ea6ce8ed2351aa81a74b2c16517bbaee074b69f12a1004337d388305ef26bb6e9861e749183d9f425fcb719afc45289045cf9'