rails_magic_renamer 2.0.0.pre.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +2 -0
  3. data/.ruby-version +1 -0
  4. data/.travis.yml +6 -0
  5. data/CHANGELOG +4 -0
  6. data/Gemfile +4 -0
  7. data/Gemfile.lock +173 -0
  8. data/Guardfile +11 -0
  9. data/Manifest +8 -0
  10. data/README.md +59 -0
  11. data/ROADMAP.md +60 -0
  12. data/Rakefile +2 -0
  13. data/lib/rails_magic_renamer.rb +343 -0
  14. data/lib/rails_magic_renamer/exceptions.rb +35 -0
  15. data/lib/rails_magic_renamer/version.rb +3 -0
  16. data/rails_magic_renamer.gemspec +36 -0
  17. data/spec/rails_helper.rb +26 -0
  18. data/spec/rails_magic_renamer_spec.rb +22 -0
  19. data/spec/spec_helper.rb +17 -0
  20. data/spec/support/sample_app_rails_4/.gitignore +19 -0
  21. data/spec/support/sample_app_rails_4/.rspec +2 -0
  22. data/spec/support/sample_app_rails_4/Gemfile +58 -0
  23. data/spec/support/sample_app_rails_4/Gemfile.lock +249 -0
  24. data/spec/support/sample_app_rails_4/Guardfile +53 -0
  25. data/spec/support/sample_app_rails_4/LICENSE +21 -0
  26. data/spec/support/sample_app_rails_4/README.md +25 -0
  27. data/spec/support/sample_app_rails_4/README.nitrous.md +20 -0
  28. data/spec/support/sample_app_rails_4/Rakefile +6 -0
  29. data/spec/support/sample_app_rails_4/app/assets/images/rails.png +0 -0
  30. data/spec/support/sample_app_rails_4/app/assets/javascripts/application.js +17 -0
  31. data/spec/support/sample_app_rails_4/app/assets/javascripts/sessions.js.coffee +3 -0
  32. data/spec/support/sample_app_rails_4/app/assets/javascripts/static_pages.js.coffee +3 -0
  33. data/spec/support/sample_app_rails_4/app/assets/javascripts/users.js.coffee +3 -0
  34. data/spec/support/sample_app_rails_4/app/assets/stylesheets/application.css +13 -0
  35. data/spec/support/sample_app_rails_4/app/assets/stylesheets/custom.css.scss +246 -0
  36. data/spec/support/sample_app_rails_4/app/assets/stylesheets/sessions.css.scss +3 -0
  37. data/spec/support/sample_app_rails_4/app/assets/stylesheets/static_pages.css.scss +3 -0
  38. data/spec/support/sample_app_rails_4/app/assets/stylesheets/users.css.scss +3 -0
  39. data/spec/support/sample_app_rails_4/app/controllers/application_controller.rb +6 -0
  40. data/spec/support/sample_app_rails_4/app/controllers/concerns/.keep +0 -0
  41. data/spec/support/sample_app_rails_4/app/controllers/microposts_controller.rb +31 -0
  42. data/spec/support/sample_app_rails_4/app/controllers/relationships_controller.rb +21 -0
  43. data/spec/support/sample_app_rails_4/app/controllers/sessions_controller.rb +21 -0
  44. data/spec/support/sample_app_rails_4/app/controllers/static_pages_controller.rb +18 -0
  45. data/spec/support/sample_app_rails_4/app/controllers/users_controller.rb +80 -0
  46. data/spec/support/sample_app_rails_4/app/helpers/application_helper.rb +12 -0
  47. data/spec/support/sample_app_rails_4/app/helpers/sessions_helper.rb +49 -0
  48. data/spec/support/sample_app_rails_4/app/helpers/static_pages_helper.rb +2 -0
  49. data/spec/support/sample_app_rails_4/app/helpers/users_helper.rb +10 -0
  50. data/spec/support/sample_app_rails_4/app/mailers/.keep +0 -0
  51. data/spec/support/sample_app_rails_4/app/models/.keep +0 -0
  52. data/spec/support/sample_app_rails_4/app/models/comment.rb +5 -0
  53. data/spec/support/sample_app_rails_4/app/models/concerns/.keep +0 -0
  54. data/spec/support/sample_app_rails_4/app/models/micropost.rb +14 -0
  55. data/spec/support/sample_app_rails_4/app/models/organisation.rb +3 -0
  56. data/spec/support/sample_app_rails_4/app/models/relationship.rb +6 -0
  57. data/spec/support/sample_app_rails_4/app/models/user.rb +57 -0
  58. data/spec/support/sample_app_rails_4/app/models/user_comment.rb +5 -0
  59. data/spec/support/sample_app_rails_4/app/views/layouts/_footer.html.erb +13 -0
  60. data/spec/support/sample_app_rails_4/app/views/layouts/_header.html.erb +31 -0
  61. data/spec/support/sample_app_rails_4/app/views/layouts/_shim.html.erb +3 -0
  62. data/spec/support/sample_app_rails_4/app/views/layouts/application.html.erb +22 -0
  63. data/spec/support/sample_app_rails_4/app/views/microposts/_micropost.html.erb +11 -0
  64. data/spec/support/sample_app_rails_4/app/views/relationships/create.js.erb +2 -0
  65. data/spec/support/sample_app_rails_4/app/views/relationships/destroy.js.erb +2 -0
  66. data/spec/support/sample_app_rails_4/app/views/sessions/new.html.erb +19 -0
  67. data/spec/support/sample_app_rails_4/app/views/shared/_error_messages.html.erb +12 -0
  68. data/spec/support/sample_app_rails_4/app/views/shared/_feed.html.erb +6 -0
  69. data/spec/support/sample_app_rails_4/app/views/shared/_feed_item.html.erb +15 -0
  70. data/spec/support/sample_app_rails_4/app/views/shared/_micropost_form.html.erb +7 -0
  71. data/spec/support/sample_app_rails_4/app/views/shared/_stats.html.erb +15 -0
  72. data/spec/support/sample_app_rails_4/app/views/shared/_user_info.html.erb +12 -0
  73. data/spec/support/sample_app_rails_4/app/views/static_pages/about.html.erb +8 -0
  74. data/spec/support/sample_app_rails_4/app/views/static_pages/contact.html.erb +6 -0
  75. data/spec/support/sample_app_rails_4/app/views/static_pages/help.html.erb +8 -0
  76. data/spec/support/sample_app_rails_4/app/views/static_pages/home.html.erb +34 -0
  77. data/spec/support/sample_app_rails_4/app/views/static_pages/show.html.erb +0 -0
  78. data/spec/support/sample_app_rails_4/app/views/users/_follow.html.erb +5 -0
  79. data/spec/support/sample_app_rails_4/app/views/users/_follow_form.html.erb +9 -0
  80. data/spec/support/sample_app_rails_4/app/views/users/_unfollow.html.erb +5 -0
  81. data/spec/support/sample_app_rails_4/app/views/users/_user.html.erb +8 -0
  82. data/spec/support/sample_app_rails_4/app/views/users/edit.html.erb +27 -0
  83. data/spec/support/sample_app_rails_4/app/views/users/index.html.erb +10 -0
  84. data/spec/support/sample_app_rails_4/app/views/users/new.html.erb +24 -0
  85. data/spec/support/sample_app_rails_4/app/views/users/show.html.erb +24 -0
  86. data/spec/support/sample_app_rails_4/app/views/users/show_follow.html.erb +30 -0
  87. data/spec/support/sample_app_rails_4/bin/bundle +3 -0
  88. data/spec/support/sample_app_rails_4/bin/rails +4 -0
  89. data/spec/support/sample_app_rails_4/bin/rake +4 -0
  90. data/spec/support/sample_app_rails_4/config.ru +4 -0
  91. data/spec/support/sample_app_rails_4/config/application.rb +31 -0
  92. data/spec/support/sample_app_rails_4/config/boot.rb +4 -0
  93. data/spec/support/sample_app_rails_4/config/cucumber.yml +8 -0
  94. data/spec/support/sample_app_rails_4/config/database.yml +12 -0
  95. data/spec/support/sample_app_rails_4/config/environment.rb +7 -0
  96. data/spec/support/sample_app_rails_4/config/environments/development.rb +27 -0
  97. data/spec/support/sample_app_rails_4/config/environments/production.rb +79 -0
  98. data/spec/support/sample_app_rails_4/config/environments/test.rb +39 -0
  99. data/spec/support/sample_app_rails_4/config/initializers/backtrace_silencers.rb +7 -0
  100. data/spec/support/sample_app_rails_4/config/initializers/filter_parameter_logging.rb +4 -0
  101. data/spec/support/sample_app_rails_4/config/initializers/inflections.rb +16 -0
  102. data/spec/support/sample_app_rails_4/config/initializers/mime_types.rb +5 -0
  103. data/spec/support/sample_app_rails_4/config/initializers/secret_token.rb +22 -0
  104. data/spec/support/sample_app_rails_4/config/initializers/session_store.rb +3 -0
  105. data/spec/support/sample_app_rails_4/config/initializers/wrap_parameters.rb +14 -0
  106. data/spec/support/sample_app_rails_4/config/locales/en.yml +23 -0
  107. data/spec/support/sample_app_rails_4/config/routes.rb +17 -0
  108. data/spec/support/sample_app_rails_4/db/development.sqlite3 +0 -0
  109. data/spec/support/sample_app_rails_4/db/migrate/20130311191400_create_users.rb +10 -0
  110. data/spec/support/sample_app_rails_4/db/migrate/20130311194153_add_index_to_users_email.rb +5 -0
  111. data/spec/support/sample_app_rails_4/db/migrate/20130311201841_add_password_digest_to_users.rb +5 -0
  112. data/spec/support/sample_app_rails_4/db/migrate/20130314184954_add_remember_token_to_users.rb +6 -0
  113. data/spec/support/sample_app_rails_4/db/migrate/20130315015932_add_admin_to_users.rb +5 -0
  114. data/spec/support/sample_app_rails_4/db/migrate/20130315175534_create_microposts.rb +11 -0
  115. data/spec/support/sample_app_rails_4/db/migrate/20130315230445_create_relationships.rb +13 -0
  116. data/spec/support/sample_app_rails_4/db/migrate/20160424113439_create_comments.rb +8 -0
  117. data/spec/support/sample_app_rails_4/db/migrate/20160424113451_create_user_comments.rb +8 -0
  118. data/spec/support/sample_app_rails_4/db/migrate/20160424114701_create_organisations.rb +8 -0
  119. data/spec/support/sample_app_rails_4/db/migrate/20160424114727_add_organisation_id_to_users.rb +5 -0
  120. data/spec/support/sample_app_rails_4/db/schema.rb +67 -0
  121. data/spec/support/sample_app_rails_4/db/seeds.rb +7 -0
  122. data/spec/support/sample_app_rails_4/db/test.sqlite3 +0 -0
  123. data/spec/support/sample_app_rails_4/factory_girl.rb +7 -0
  124. data/spec/support/sample_app_rails_4/features/signing_in.feature +13 -0
  125. data/spec/support/sample_app_rails_4/features/step_definitions/authentication_steps.rb +30 -0
  126. data/spec/support/sample_app_rails_4/features/support/env.rb +59 -0
  127. data/spec/support/sample_app_rails_4/lib/assets/.keep +0 -0
  128. data/spec/support/sample_app_rails_4/lib/tasks/.keep +0 -0
  129. data/spec/support/sample_app_rails_4/lib/tasks/cucumber.rake +65 -0
  130. data/spec/support/sample_app_rails_4/lib/tasks/sample_data.rake +42 -0
  131. data/spec/support/sample_app_rails_4/log/.keep +0 -0
  132. data/spec/support/sample_app_rails_4/public/404.html +27 -0
  133. data/spec/support/sample_app_rails_4/public/422.html +26 -0
  134. data/spec/support/sample_app_rails_4/public/500.html +26 -0
  135. data/spec/support/sample_app_rails_4/public/assets/application-4962059d8f80f9bb096692bacc29c4e8.css +5091 -0
  136. data/spec/support/sample_app_rails_4/public/assets/application-4962059d8f80f9bb096692bacc29c4e8.css.gz +0 -0
  137. data/spec/support/sample_app_rails_4/public/assets/application-eeb856e3fe2c8f879c91d0e81d59cb40.js +12952 -0
  138. data/spec/support/sample_app_rails_4/public/assets/application-eeb856e3fe2c8f879c91d0e81d59cb40.js.gz +0 -0
  139. data/spec/support/sample_app_rails_4/public/assets/glyphicons-halflings-c806376f05e4ccabe2c5315a8e95667c.png +0 -0
  140. data/spec/support/sample_app_rails_4/public/assets/glyphicons-halflings-white-62b67d9edee3db90d18833087f848d6e.png +0 -0
  141. data/spec/support/sample_app_rails_4/public/assets/manifest-802de9eb1c853769101852422b620883.json +1 -0
  142. data/spec/support/sample_app_rails_4/public/assets/rails-231a680f23887d9dd70710ea5efd3c62.png +0 -0
  143. data/spec/support/sample_app_rails_4/public/favicon.ico +0 -0
  144. data/spec/support/sample_app_rails_4/public/robots.txt +5 -0
  145. data/spec/support/sample_app_rails_4/script/cucumber +10 -0
  146. data/spec/support/sample_app_rails_4/spec/controllers/relationships_controller_spec.rb +42 -0
  147. data/spec/support/sample_app_rails_4/spec/factories.rb +17 -0
  148. data/spec/support/sample_app_rails_4/spec/features/authentication_pages_spec.rb +155 -0
  149. data/spec/support/sample_app_rails_4/spec/features/micropost_pages_spec.rb +45 -0
  150. data/spec/support/sample_app_rails_4/spec/features/static_pages_spec.rb +64 -0
  151. data/spec/support/sample_app_rails_4/spec/features/user_pages_spec.rb +239 -0
  152. data/spec/support/sample_app_rails_4/spec/helpers/application_helper_spec.rb +18 -0
  153. data/spec/support/sample_app_rails_4/spec/models/comments_spec.rb +5 -0
  154. data/spec/support/sample_app_rails_4/spec/models/micropost_spec.rb +30 -0
  155. data/spec/support/sample_app_rails_4/spec/models/organisation_spec.rb +5 -0
  156. data/spec/support/sample_app_rails_4/spec/models/relationship_spec.rb +36 -0
  157. data/spec/support/sample_app_rails_4/spec/models/user_comments_spec.rb +5 -0
  158. data/spec/support/sample_app_rails_4/spec/models/user_spec.rb +108 -0
  159. data/spec/support/sample_app_rails_4/spec/spec_helper.rb +57 -0
  160. data/spec/support/sample_app_rails_4/spec/support/utilities.rb +21 -0
  161. data/spec/support/sample_app_rails_4/vendor/assets/javascripts/.keep +0 -0
  162. data/spec/support/sample_app_rails_4/vendor/assets/stylesheets/.keep +0 -0
  163. data/tasks/rspec.rake +4 -0
  164. metadata +534 -0
@@ -0,0 +1,27 @@
1
+ SampleApp::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
+ config.assets.debug = true
27
+ end
@@ -0,0 +1,79 @@
1
+ SampleApp::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 thread 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
+ config.serve_static_assets = false
23
+
24
+ # Compress JavaScripts and CSS.
25
+ config.assets.js_compressor = :uglifier
26
+ # config.assets.css_compressor = :sass
27
+
28
+ # Whether to fallback to assets pipeline if a precompiled asset is missed.
29
+ config.assets.compile = false
30
+
31
+ # Generate digests for assets URLs.
32
+ config.assets.digest = true
33
+
34
+ # Version of your assets, change this if you want to expire all your assets.
35
+ config.assets.version = '1.0'
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
+ # Precompile additional assets.
60
+ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
61
+ # config.assets.precompile += %w( search.js )
62
+
63
+ # Ignore bad email addresses and do not raise email delivery errors.
64
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
65
+ # config.action_mailer.raise_delivery_errors = false
66
+
67
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
68
+ # the I18n.default_locale when a translation can not be found).
69
+ config.i18n.fallbacks = true
70
+
71
+ # Send deprecation notices to registered listeners.
72
+ config.active_support.deprecation = :notify
73
+
74
+ # Disable automatic flushing of the log to improve performance.
75
+ # config.autoflush_log = false
76
+
77
+ # Use default logging formatter so that PID and timestamp are not suppressed.
78
+ config.log_formatter = ::Logger::Formatter.new
79
+ end
@@ -0,0 +1,39 @@
1
+ SampleApp::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
+ # Speed up tests by lowering bcrypt's cost function.
38
+ # ActiveModel::SecurePassword.min_cost = true
39
+ 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,4 @@
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]
@@ -0,0 +1,16 @@
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
@@ -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,22 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Make sure your secret_key_base is kept private
4
+ # if you're sharing your code publicly, such as by adding
5
+ # .secret to your .gitignore file.
6
+
7
+ require 'securerandom'
8
+
9
+ def secure_token
10
+ token_file = Rails.root.join('.secret')
11
+ if File.exist?(token_file)
12
+ # Use the existing token.
13
+ File.read(token_file).chomp
14
+ else
15
+ # Generate a new token and store it in token_file.
16
+ token = SecureRandom.hex(64)
17
+ File.write(token_file, token)
18
+ token
19
+ end
20
+ end
21
+
22
+ SampleApp::Application.config.secret_key_base = secure_token
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ SampleApp::Application.config.session_store :cookie_store, key: '_sample_app_session'
@@ -0,0 +1,14 @@
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
@@ -0,0 +1,23 @@
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"
@@ -0,0 +1,17 @@
1
+ SampleApp::Application.routes.draw do
2
+ resources :users do
3
+ member do
4
+ get :following, :followers
5
+ end
6
+ end
7
+ resources :sessions, only: [:new, :create, :destroy]
8
+ resources :microposts, only: [:create, :destroy]
9
+ resources :relationships, only: [:create, :destroy]
10
+ root to: 'static_pages#home'
11
+ match '/signup', to: 'users#new', via: 'get'
12
+ match '/signin', to: 'sessions#new', via: 'get'
13
+ match '/signout', to: 'sessions#destroy', via: 'delete'
14
+ match '/help', to: 'static_pages#help', via: 'get'
15
+ match '/about', to: 'static_pages#about', via: 'get'
16
+ match '/contact', to: 'static_pages#contact', via: 'get'
17
+ end
@@ -0,0 +1,10 @@
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :users do |t|
4
+ t.string :name
5
+ t.string :email
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,5 @@
1
+ class AddIndexToUsersEmail < ActiveRecord::Migration
2
+ def change
3
+ add_index :users, :email, unique: true
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddPasswordDigestToUsers < ActiveRecord::Migration
2
+ def change
3
+ add_column :users, :password_digest, :string
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ class AddRememberTokenToUsers < ActiveRecord::Migration
2
+ def change
3
+ add_column :users, :remember_token, :string
4
+ add_index :users, :remember_token
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ class AddAdminToUsers < ActiveRecord::Migration
2
+ def change
3
+ add_column :users, :admin, :boolean
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ class CreateMicroposts < ActiveRecord::Migration
2
+ def change
3
+ create_table :microposts do |t|
4
+ t.string :content
5
+ t.integer :user_id
6
+
7
+ t.timestamps
8
+ end
9
+ add_index :microposts, [:user_id, :created_at]
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ class CreateRelationships < ActiveRecord::Migration
2
+ def change
3
+ create_table :relationships do |t|
4
+ t.integer :follower_id
5
+ t.integer :followed_id
6
+
7
+ t.timestamps
8
+ end
9
+ add_index :relationships, :follower_id
10
+ add_index :relationships, :followed_id
11
+ add_index :relationships, [:follower_id, :followed_id], unique: true
12
+ end
13
+ end
@@ -0,0 +1,8 @@
1
+ class CreateComments < ActiveRecord::Migration
2
+ def change
3
+ create_table :comments do |t|
4
+ t.string :description
5
+ t.timestamps
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ class CreateUserComments < ActiveRecord::Migration
2
+ def change
3
+ create_table :user_comments do |t|
4
+ t.integer :user_id
5
+ t.integer :comment_id
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ class CreateOrganisations < ActiveRecord::Migration
2
+ def change
3
+ create_table :organisations do |t|
4
+ t.string :name
5
+ t.timestamps
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ class AddOrganisationIdToUsers < ActiveRecord::Migration
2
+ def change
3
+ add_column :users, :organisation_id, :integer
4
+ end
5
+ end
@@ -0,0 +1,67 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended that you check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(version: 20160424114727) do
15
+
16
+ create_table "comments", force: true do |t|
17
+ t.string "description"
18
+ t.datetime "created_at"
19
+ t.datetime "updated_at"
20
+ end
21
+
22
+ create_table "microposts", force: true do |t|
23
+ t.string "content"
24
+ t.integer "user_id"
25
+ t.datetime "created_at"
26
+ t.datetime "updated_at"
27
+ end
28
+
29
+ add_index "microposts", ["user_id", "created_at"], name: "index_microposts_on_user_id_and_created_at"
30
+
31
+ create_table "organisations", force: true do |t|
32
+ t.string "name"
33
+ t.datetime "created_at"
34
+ t.datetime "updated_at"
35
+ end
36
+
37
+ create_table "relationships", force: true do |t|
38
+ t.integer "follower_id"
39
+ t.integer "followed_id"
40
+ t.datetime "created_at"
41
+ t.datetime "updated_at"
42
+ end
43
+
44
+ add_index "relationships", ["followed_id"], name: "index_relationships_on_followed_id"
45
+ add_index "relationships", ["follower_id", "followed_id"], name: "index_relationships_on_follower_id_and_followed_id", unique: true
46
+ add_index "relationships", ["follower_id"], name: "index_relationships_on_follower_id"
47
+
48
+ create_table "user_comments", force: true do |t|
49
+ t.integer "user_id"
50
+ t.integer "comment_id"
51
+ end
52
+
53
+ create_table "users", force: true do |t|
54
+ t.string "name"
55
+ t.string "email"
56
+ t.datetime "created_at"
57
+ t.datetime "updated_at"
58
+ t.string "password_digest"
59
+ t.string "remember_token"
60
+ t.boolean "admin"
61
+ t.integer "organisation_id"
62
+ end
63
+
64
+ add_index "users", ["email"], name: "index_users_on_email", unique: true
65
+ add_index "users", ["remember_token"], name: "index_users_on_remember_token"
66
+
67
+ end