diff --git a/ChrisCahill-christophercahill/d3/personal_website/views/about.erb b/ChrisCahill-christophercahill/d3/personal_website/views/about.erb index acd2617..31d250f 100644 --- a/ChrisCahill-christophercahill/d3/personal_website/views/about.erb +++ b/ChrisCahill-christophercahill/d3/personal_website/views/about.erb @@ -30,7 +30,8 @@ border-radius: 12px; opacity: .85; } - li{ + + li{ display: inline; list-style-type: none; padding-right: 20px; diff --git a/ChrisCahill-christophercahill/d4/finding_things.rb b/ChrisCahill-christophercahill/d4/finding_things.rb new file mode 100644 index 0000000..916d41f --- /dev/null +++ b/ChrisCahill-christophercahill/d4/finding_things.rb @@ -0,0 +1,73 @@ +def index_of(string, letter) + i = 0 + length = string.length + string = string.chars.to_a + string.each do |character| + if character.downcase == letter.downcase + break + else + i = i + 1 + end + end + if i > length + i = -1 + end + i +end + +puts index_of("hello", "o") +puts index_of("tomorrow", "o") +puts index_of("lekker", "k") + +def find_by_name(array, name) + result = nil + array.each do |individual_hash| + if individual_hash[:name] == name + result = individual_hash + break + end + end + result +end + +people = [ + { + :id => 1, + :name => "bru" + }, + { + :id => 2, + :name => "ski" + }, + { + :id => 3, + :name => "brunette" + }, + { + :id => 4, + :name => "ski" + } +] + +puts find_by_name(people, "ski") +# => {:id=>2,:name=>"ski"} + +puts find_by_name(people, "kitten!") +# => nil + +def filter_by_name(array, name) + result = [] + array.each do |individual_hash| + if individual_hash[:name] == name + result << individual_hash + end + end + result +end + +filter_by_name(people, "ski") +# => [{:id=>2,:name=>"ski"}, {:id=>4,:name=>"ski"}] +filter_by_name(people, "bru") +# => [{:id=>1,:name=>"bru"}] (Note this is still an array) +filter_by_name(people, "puppy!!!") +# => [] \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d4/fizzbuzz.rb b/ChrisCahill-christophercahill/d4/fizzbuzz.rb new file mode 100644 index 0000000..fbbfbc6 --- /dev/null +++ b/ChrisCahill-christophercahill/d4/fizzbuzz.rb @@ -0,0 +1,18 @@ +def fizzbuzz(max_val) + val = 1 + while val <= max_val + if (val % 3 == 0) && (val % 5 == 0) + puts "fizzbuzz" + elsif (val % 3 == 0) + puts "fizz" + elsif (val % 5 == 0) + puts "buzz" + else + puts val + end + val+= 1 + end +end + +fizzbuzz 100 + diff --git a/ChrisCahill-christophercahill/d4/map.rb b/ChrisCahill-christophercahill/d4/map.rb new file mode 100644 index 0000000..d5aeb7c --- /dev/null +++ b/ChrisCahill-christophercahill/d4/map.rb @@ -0,0 +1,17 @@ +# map.rb +engines = ["Google", "Bing", "Ask Jeeves"] + +result = engines.map do |e| + if e == "Google" + new_e = "OK" + elsif e == "Bing" + new_e = "Bad!" + else + new_e = "What is that?" + end + new_e +end + +puts result + +# => ["OK", "Bad!", "What is that?"] \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d4/phonebook_app/app.rb b/ChrisCahill-christophercahill/d4/phonebook_app/app.rb new file mode 100644 index 0000000..88a47d6 --- /dev/null +++ b/ChrisCahill-christophercahill/d4/phonebook_app/app.rb @@ -0,0 +1,18 @@ +require 'sinatra' + +get '/' do + erb :index +end + +get '/contacts' do + @contacts = ["Melissa", "Sarah", "Robert"] + erb :contacts +end + +get '/contacts/:contact' do + @contacts = { "Melissa" => "071-871-1840", "Sarah" => "071-160-5132", + "Robert" => "071-221-8652"} + @contact_name = params["contact"] + @contact_number = @contacts[@contact_name].to_s + erb :contact +end \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d4/phonebook_app/views/contact.erb b/ChrisCahill-christophercahill/d4/phonebook_app/views/contact.erb new file mode 100644 index 0000000..b0b70a1 --- /dev/null +++ b/ChrisCahill-christophercahill/d4/phonebook_app/views/contact.erb @@ -0,0 +1 @@ +

<%= @contact_name %>'s number is <%= @contact_number %>.

\ No newline at end of file diff --git a/ChrisCahill-christophercahill/d4/phonebook_app/views/contacts.erb b/ChrisCahill-christophercahill/d4/phonebook_app/views/contacts.erb new file mode 100644 index 0000000..5e71a17 --- /dev/null +++ b/ChrisCahill-christophercahill/d4/phonebook_app/views/contacts.erb @@ -0,0 +1,7 @@ +

Contacts

+

Here are all of the contacts I have #needfriends

+ \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d4/phonebook_app/views/index.erb b/ChrisCahill-christophercahill/d4/phonebook_app/views/index.erb new file mode 100644 index 0000000..3822744 --- /dev/null +++ b/ChrisCahill-christophercahill/d4/phonebook_app/views/index.erb @@ -0,0 +1,3 @@ +

Welcome to this sketch online phonebook.

+To see all my contacts, click here +

To make this have any use, you can find a phone number for a contact by utilizing the URL. For example, if you were to type /contacts/Sarah it would return to you Sarah's number.

\ No newline at end of file diff --git a/ChrisCahill-christophercahill/d4/recipes.rb b/ChrisCahill-christophercahill/d4/recipes.rb new file mode 100644 index 0000000..8ce8b8c --- /dev/null +++ b/ChrisCahill-christophercahill/d4/recipes.rb @@ -0,0 +1,21 @@ +dishes = { :Butter_Chicken => ["chicken", "curry", "rice"], + :BLT => ["bacon", "lettuce", "tomato"], :Crepes => ["water", "flour", "butter"]} + + +recipes = { + :Butter_Chicken => { + :description => "This is a classic Indian-inspired dish.", + :ingredients => ["chicken", "curry", "rice"], + :steps => ["Prep the chicken", "Marinate with spices", "Cook with curry"] + }, + :BLT => { + :description => "'Merica.", + :ingredients => ["bacon", "lettuce", "tomato"], + :steps => ["Put bacon in between", "Add lettuce", "Add tomato"] + }, + :Crepes => { + :description => "Viva la France", + :ingredients => ["flour", "water", "butter"], + :steps => ["Prep the liquid mixture", "Pour on crepe stone"] + } +} diff --git a/ChrisCahill-christophercahill/d4/reverse.rb b/ChrisCahill-christophercahill/d4/reverse.rb new file mode 100644 index 0000000..0c48c26 --- /dev/null +++ b/ChrisCahill-christophercahill/d4/reverse.rb @@ -0,0 +1,15 @@ +def reverse(array) + length = array.length - 1 + new_array = [] + while length >= 0 + new_array << array[length] + puts array[length] + length-= 1 + end + new_array +end + +random_objects = ["apples", 4, "bananas", "kiwis", "pears"] + +reverse random_objects + diff --git a/ChrisCahill-christophercahill/d5/capetown_guide/app.rb b/ChrisCahill-christophercahill/d5/capetown_guide/app.rb new file mode 100644 index 0000000..404bc26 --- /dev/null +++ b/ChrisCahill-christophercahill/d5/capetown_guide/app.rb @@ -0,0 +1,74 @@ +require "sinatra" + +get "/" do + erb :index +end + +get "/places" do + @places = ["Lion's Head", "Camps Bay", "Old Biscuit Mill"] + @places_url = { "Lion's Head" => "lion" , + "Camps Bay" => "camp" , "Old Biscuit Mill" => "old" } + erb :places +end + +get "/places/:destination" do |destination| + places = {"lion" => + {"title" => "Lion's Head", + "picture" => "http://www.capetownmagazine.com//media_lib/r2/fa98c334aa8f8907bd2a8595e46c5526.img.jpg", + "map" => "https://www.google.co.za/maps/place/Lion's+Head,+Table+Mountain+National+Park,+Signal+Hill,+Cape+Town,+8001/@-33.935037,18.3889709,15z/data=!4m2!3m1!1s0x1dcc6705adf437ed:0x482833296b600211", + "description" => "Description:
+ +Lion's head is a mountain in Cape Town, South Africa, located between Table Mountain and Signal Hill. Lion's Head peaks at 669 metres (2,195 ft) above sea level. The mountain is a part of the Table Mountain National Park. + +The suburbs of the city surround the peak on almost all sides of the Mountain, but strict management by city authorities has kept development of housing off the higher ground. The Lion's Head area is significant to the Cape Malay community, who historically lived in the Bo-Kaap quarter. + +

+ +Activities:
+ +Lion's head is know for it's beautiful views over both the city and the Atlantic Seaboard. The hour-long walk to the top is extremely popular, especially during the full moon and during sunrise. Its slopes are also a popular launching point for paragliders. + + + +" + }, + "camp" => + {"title" => "Camps Bay", + "picture" => "http://www.savingwater.co.za/wp-content/uploads/2010/02/camps-bay.jpg", + "map" => "https://www.google.co.za/maps/place/Camps+Bay,+Cape+Town/@-33.9520409,18.382408,15z/data=!3m1!4b1!4m2!3m1!1s0x1dcc67ad0e328c89:0xc7a0b241c4464b97", + "description" => "Description/History:
+ +Camps Bay is an affluent suburb of Cape Town, South Africa. In summer it attracts a large number of foreign visitors as well as South Africans. The first residents of Camps Bay were the San (Hunter Gatherers) and the Goringqhaique, Khoi pastorates. By 1713 the number of Gringqhaique population had been reduced by measles and smallpox. All that was left of their settlement was an old kraal (Oudekraal). For most of the 1800s Camps Bay was undeveloped. Lord Charles Somerset used the area for hunting and used the Roundhouse as his lodge. Kloof Road was built in 1848 and in 1884 Thomas Bain was commissioned to build a road from Sea Point to Camps Bay using convict labour. In 1913 Camps Bay was incorporated into Cape Town although it was still seen as a recreational area rather than a residential area. + +

+ +Activities:
+ +If you head south from the beaches of Clifton (or north from the buzz of Sea Point), you’ll discover the chic suburb of Camps Bay. The main attraction, Victoria Road, is jam-packed with funky restaurants, trendy pubs, and bucket-and-spade shops on one side, and a palm-fringed beach on the other. + +If you’re staying over, there’s a wide range of accommodation on offer, from self-catering apartments to stylish villas and the old and gracious The Bay Hotel with its perfect views of Camps Bay beach. + +" + }, + "old" => + {"title" => "Old Biscuit Mill", + "picture" => "http://www.thewrendesign.com/wp-content/uploads/design-goods-market/biscuit-mill-1.jpg", + "map" => "https://www.google.co.za/maps/place/The+Old+Biscuit+Mill/@-33.9275533,18.4574846,17z/data=!3m1!4b1!4m2!3m1!1s0x1dcc5da6b46abd99:0x39cc47e5b0eb6340", + "description" => "Description:
There are many markets in Cape Town, but one stands out head and shoulders above all others - The Old Biscuit Mill market in Woodstock. A wide range of food stalls, an excellent vibe, good music and did we mention the excellent wide range of foods? + +Tucked away in Woodstock, one of Cape Towns poorer suburbs, The Old Biscuit Mill market has managed to attract the young and trendy Cape Town crowd in their droves with an atmosphere similar to Borough Market in London. + +The food stalls represent a wide range of tastes from your standard sandwiches (nothing standard about them though), to Ostrich burgers, Greek kebabs, organic local foods, French food and a wide range of breads, cheeses and wines all locally produced in the Western Cape. + +Directly outside of the market you will find a treasure-trove of homeware shops that sell those obscure and never thought of knick-knacks that you never knew you needed untill you saw them! + +The market runs every Saturday what ever the weather from 9am till 2pm, be advised it can get extremely busy and at times finding a parking spot can be a problem so arrive early (before 10:30am) in order to get a decent parking spot." + }} + + @destination = places[destination] + @name = @destination["title"] + @image_url = @destination["picture"] + @description = @destination["description"] + @map_url = @destination["map"] + erb :place +end diff --git a/ChrisCahill-christophercahill/d5/capetown_guide/views/index.erb b/ChrisCahill-christophercahill/d5/capetown_guide/views/index.erb new file mode 100644 index 0000000..3b6dec0 --- /dev/null +++ b/ChrisCahill-christophercahill/d5/capetown_guide/views/index.erb @@ -0,0 +1,75 @@ + + + + + + +

Welcome to Cape Town

+

A Brief Guide

+
+
+
+
+
+

"This cape is the most stately thing and the fairest cape we saw in the whole circumference of the earth" -Sir Francis Drake, 1580

+
+
+ +
+
+
+
+
+Attractions + \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d5/capetown_guide/views/place.erb b/ChrisCahill-christophercahill/d5/capetown_guide/views/place.erb new file mode 100644 index 0000000..48376a8 --- /dev/null +++ b/ChrisCahill-christophercahill/d5/capetown_guide/views/place.erb @@ -0,0 +1,72 @@ + + + + + + + +
+

<%= @name %>

+Click here to see the location on Google Maps +
+
+ +
+

<%= @description %>

+ + + \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d5/capetown_guide/views/places.erb b/ChrisCahill-christophercahill/d5/capetown_guide/views/places.erb new file mode 100644 index 0000000..cfdeee8 --- /dev/null +++ b/ChrisCahill-christophercahill/d5/capetown_guide/views/places.erb @@ -0,0 +1,87 @@ + + + + + + +

Tourist Attractions in Cape Town

+

Click on any of the links below to find out more about each destination

+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+Home + + diff --git a/ChrisCahill-christophercahill/d6/blog/.gitignore b/ChrisCahill-christophercahill/d6/blog/.gitignore new file mode 100644 index 0000000..050c9d9 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/.gitignore @@ -0,0 +1,17 @@ +# See https://help.github.com/articles/ignoring-files for more about ignoring files. +# +# If you find yourself ignoring temporary files generated by your text editor +# or operating system, you probably want to add a global ignore instead: +# git config --global core.excludesfile '~/.gitignore_global' + +# Ignore bundler config. +/.bundle + +# Ignore the default SQLite database. +/db/*.sqlite3 +/db/*.sqlite3-journal + +# Ignore all logfiles and tempfiles. +/log/* +!/log/.keep +/tmp diff --git a/ChrisCahill-christophercahill/d6/blog/Gemfile b/ChrisCahill-christophercahill/d6/blog/Gemfile new file mode 100644 index 0000000..a2b2606 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/Gemfile @@ -0,0 +1,45 @@ +source 'https://rubygems.org' + + +# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' +gem 'rails', '4.2.1' +# Use sqlite3 as the database for Active Record +gem 'sqlite3' +# Use SCSS for stylesheets +gem 'sass-rails', '~> 5.0' +# Use Uglifier as compressor for JavaScript assets +gem 'uglifier', '>= 1.3.0' +# Use CoffeeScript for .coffee assets and views +gem 'coffee-rails', '~> 4.1.0' +# See https://github.com/rails/execjs#readme for more supported runtimes +# gem 'therubyracer', platforms: :ruby + +# Use jquery as the JavaScript library +gem 'jquery-rails' +# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks +gem 'turbolinks' +# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder +gem 'jbuilder', '~> 2.0' +# bundle exec rake doc:rails generates the API under doc/api. +gem 'sdoc', '~> 0.4.0', group: :doc + +# Use ActiveModel has_secure_password +# gem 'bcrypt', '~> 3.1.7' + +# Use Unicorn as the app server +# gem 'unicorn' + +# Use Capistrano for deployment +# gem 'capistrano-rails', group: :development + +group :development, :test do + # Call 'byebug' anywhere in the code to stop execution and get a debugger console + gem 'byebug' + + # Access an IRB console on exception pages or by using <%= console %> in views + gem 'web-console', '~> 2.0' + + # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring + gem 'spring' +end + diff --git a/ChrisCahill-christophercahill/d6/blog/Gemfile.lock b/ChrisCahill-christophercahill/d6/blog/Gemfile.lock new file mode 100644 index 0000000..78c5eda --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/Gemfile.lock @@ -0,0 +1,158 @@ +GEM + remote: https://rubygems.org/ + specs: + actionmailer (4.2.1) + actionpack (= 4.2.1) + actionview (= 4.2.1) + activejob (= 4.2.1) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 1.0, >= 1.0.5) + actionpack (4.2.1) + actionview (= 4.2.1) + activesupport (= 4.2.1) + rack (~> 1.6) + rack-test (~> 0.6.2) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.1) + actionview (4.2.1) + activesupport (= 4.2.1) + builder (~> 3.1) + erubis (~> 2.7.0) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.1) + activejob (4.2.1) + activesupport (= 4.2.1) + globalid (>= 0.3.0) + activemodel (4.2.1) + activesupport (= 4.2.1) + builder (~> 3.1) + activerecord (4.2.1) + activemodel (= 4.2.1) + activesupport (= 4.2.1) + arel (~> 6.0) + activesupport (4.2.1) + i18n (~> 0.7) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + arel (6.0.0) + binding_of_caller (0.7.2) + debug_inspector (>= 0.0.1) + builder (3.2.2) + byebug (5.0.0) + columnize (= 0.9.0) + coffee-rails (4.1.0) + coffee-script (>= 2.2.0) + railties (>= 4.0.0, < 5.0) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.9.1.1) + columnize (0.9.0) + debug_inspector (0.0.2) + erubis (2.7.0) + execjs (2.5.2) + globalid (0.3.5) + activesupport (>= 4.1.0) + i18n (0.7.0) + jbuilder (2.3.0) + activesupport (>= 3.0.0, < 5) + multi_json (~> 1.2) + jquery-rails (4.0.4) + rails-dom-testing (~> 1.0) + railties (>= 4.2.0) + thor (>= 0.14, < 2.0) + json (1.8.3) + loofah (2.0.2) + nokogiri (>= 1.5.9) + mail (2.6.3) + mime-types (>= 1.16, < 3) + mime-types (2.6.1) + mini_portile (0.6.2) + minitest (5.7.0) + multi_json (1.11.1) + nokogiri (1.6.6.2) + mini_portile (~> 0.6.0) + rack (1.6.4) + rack-test (0.6.3) + rack (>= 1.0) + rails (4.2.1) + actionmailer (= 4.2.1) + actionpack (= 4.2.1) + actionview (= 4.2.1) + activejob (= 4.2.1) + activemodel (= 4.2.1) + activerecord (= 4.2.1) + activesupport (= 4.2.1) + bundler (>= 1.3.0, < 2.0) + railties (= 4.2.1) + sprockets-rails + rails-deprecated_sanitizer (1.0.3) + activesupport (>= 4.2.0.alpha) + rails-dom-testing (1.0.6) + activesupport (>= 4.2.0.beta, < 5.0) + nokogiri (~> 1.6.0) + rails-deprecated_sanitizer (>= 1.0.1) + rails-html-sanitizer (1.0.2) + loofah (~> 2.0) + railties (4.2.1) + actionpack (= 4.2.1) + activesupport (= 4.2.1) + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (10.4.2) + rdoc (4.2.0) + sass (3.4.14) + sass-rails (5.0.3) + railties (>= 4.0.0, < 5.0) + sass (~> 3.1) + sprockets (>= 2.8, < 4.0) + sprockets-rails (>= 2.0, < 4.0) + tilt (~> 1.1) + sdoc (0.4.1) + json (~> 1.7, >= 1.7.7) + rdoc (~> 4.0) + spring (1.3.6) + sprockets (3.2.0) + rack (~> 1.0) + sprockets-rails (2.3.1) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (>= 2.8, < 4.0) + sqlite3 (1.3.10) + thor (0.19.1) + thread_safe (0.3.5) + tilt (1.4.1) + turbolinks (2.5.3) + coffee-rails + tzinfo (1.2.2) + thread_safe (~> 0.1) + uglifier (2.7.1) + execjs (>= 0.3.0) + json (>= 1.8.0) + web-console (2.1.3) + activemodel (>= 4.0) + binding_of_caller (>= 0.7.2) + railties (>= 4.0) + sprockets-rails (>= 2.0, < 4.0) + +PLATFORMS + ruby + +DEPENDENCIES + byebug + coffee-rails (~> 4.1.0) + jbuilder (~> 2.0) + jquery-rails + rails (= 4.2.1) + sass-rails (~> 5.0) + sdoc (~> 0.4.0) + spring + sqlite3 + turbolinks + uglifier (>= 1.3.0) + web-console (~> 2.0) + +BUNDLED WITH + 1.10.3 diff --git a/ChrisCahill-christophercahill/d6/blog/README.rdoc b/ChrisCahill-christophercahill/d6/blog/README.rdoc new file mode 100644 index 0000000..dd4e97e --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/README.rdoc @@ -0,0 +1,28 @@ +== README + +This README would normally document whatever steps are necessary to get the +application up and running. + +Things you may want to cover: + +* Ruby version + +* System dependencies + +* Configuration + +* Database creation + +* Database initialization + +* How to run the test suite + +* Services (job queues, cache servers, search engines, etc.) + +* Deployment instructions + +* ... + + +Please feel free to use a different markup language if you do not plan to run +rake doc:app. diff --git a/ChrisCahill-christophercahill/d6/blog/Rakefile b/ChrisCahill-christophercahill/d6/blog/Rakefile new file mode 100644 index 0000000..ba6b733 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/Rakefile @@ -0,0 +1,6 @@ +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require File.expand_path('../config/application', __FILE__) + +Rails.application.load_tasks diff --git a/ChrisCahill-christophercahill/d6/blog/app/assets/images/.keep b/ChrisCahill-christophercahill/d6/blog/app/assets/images/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d6/blog/app/assets/javascripts/application.js b/ChrisCahill-christophercahill/d6/blog/app/assets/javascripts/application.js new file mode 100644 index 0000000..e07c5a8 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/app/assets/javascripts/application.js @@ -0,0 +1,16 @@ +// This is a manifest file that'll be compiled into application.js, which will include all the files +// listed below. +// +// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, +// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. +// +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// compiled file. +// +// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details +// about supported directives. +// +//= require jquery +//= require jquery_ujs +//= require turbolinks +//= require_tree . diff --git a/ChrisCahill-christophercahill/d6/blog/app/assets/javascripts/articles.coffee b/ChrisCahill-christophercahill/d6/blog/app/assets/javascripts/articles.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/app/assets/javascripts/articles.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/ChrisCahill-christophercahill/d6/blog/app/assets/javascripts/comments.coffee b/ChrisCahill-christophercahill/d6/blog/app/assets/javascripts/comments.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/app/assets/javascripts/comments.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/ChrisCahill-christophercahill/d6/blog/app/assets/javascripts/welcome.coffee b/ChrisCahill-christophercahill/d6/blog/app/assets/javascripts/welcome.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/app/assets/javascripts/welcome.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/ChrisCahill-christophercahill/d6/blog/app/assets/stylesheets/application.css b/ChrisCahill-christophercahill/d6/blog/app/assets/stylesheets/application.css new file mode 100644 index 0000000..f9cd5b3 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/app/assets/stylesheets/application.css @@ -0,0 +1,15 @@ +/* + * This is a manifest file that'll be compiled into application.css, which will include all the files + * listed below. + * + * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, + * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. + * + * You're free to add application-wide styles to this file and they'll appear at the bottom of the + * compiled file so the styles you add here take precedence over styles defined in any styles + * defined in the other CSS/SCSS files in this directory. It is generally better to create a new + * file per style scope. + * + *= require_tree . + *= require_self + */ diff --git a/ChrisCahill-christophercahill/d6/blog/app/assets/stylesheets/articles.scss b/ChrisCahill-christophercahill/d6/blog/app/assets/stylesheets/articles.scss new file mode 100644 index 0000000..cca5487 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/app/assets/stylesheets/articles.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the articles controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/ChrisCahill-christophercahill/d6/blog/app/assets/stylesheets/comments.scss b/ChrisCahill-christophercahill/d6/blog/app/assets/stylesheets/comments.scss new file mode 100644 index 0000000..e730912 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/app/assets/stylesheets/comments.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Comments controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/ChrisCahill-christophercahill/d6/blog/app/assets/stylesheets/welcome.scss b/ChrisCahill-christophercahill/d6/blog/app/assets/stylesheets/welcome.scss new file mode 100644 index 0000000..77ce11a --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/app/assets/stylesheets/welcome.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the welcome controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/ChrisCahill-christophercahill/d6/blog/app/controllers/application_controller.rb b/ChrisCahill-christophercahill/d6/blog/app/controllers/application_controller.rb new file mode 100644 index 0000000..d83690e --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/app/controllers/application_controller.rb @@ -0,0 +1,5 @@ +class ApplicationController < ActionController::Base + # Prevent CSRF attacks by raising an exception. + # For APIs, you may want to use :null_session instead. + protect_from_forgery with: :exception +end diff --git a/ChrisCahill-christophercahill/d6/blog/app/controllers/articles_controller.rb b/ChrisCahill-christophercahill/d6/blog/app/controllers/articles_controller.rb new file mode 100644 index 0000000..9808598 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/app/controllers/articles_controller.rb @@ -0,0 +1,52 @@ +class ArticlesController < ApplicationController + + http_basic_authenticate_with name: "dhh", password: "secret", except: [:index, :show] + +def index + @articles = Article.all +end + +def show + @article = Article.find(params[:id]) +end + +def new + @article = Article.new +end + +def edit + @article = Article.find(params[:id]) +end + +def create + @article = Article.new(article_params) + + if @article.save + redirect_to @article + else + render 'new' + end +end + +def update + @article = Article.find(params[:id]) + + if @article.update(article_params) + redirect_to @article + else + render 'edit' + end +end + +def destroy + @article = Article.find(params[:id]) + @article.destroy + + redirect_to articles_path +end + +private + def article_params + params.require(:article).permit(:title, :text) + end +end \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d6/blog/app/controllers/comments_controller.rb b/ChrisCahill-christophercahill/d6/blog/app/controllers/comments_controller.rb new file mode 100644 index 0000000..beeb376 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/app/controllers/comments_controller.rb @@ -0,0 +1,22 @@ +class CommentsController < ApplicationController + +http_basic_authenticate_with name: "dhh", password: "secret", only: :destroy + + def create + @article = Article.find(params[:article_id]) + @comment = @article.comments.create(comment_params) + redirect_to article_path(@article) + end + + def destroy + @article = Article.find(params[:article_id]) + @comment = @article.comments.find(params[:id]) + @comment.destroy + redirect_to article_path(@article) + end + + private + def comment_params + params.require(:comment).permit(:commenter, :body) + end +end \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d6/blog/app/controllers/concerns/.keep b/ChrisCahill-christophercahill/d6/blog/app/controllers/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d6/blog/app/controllers/welcome_controller.rb b/ChrisCahill-christophercahill/d6/blog/app/controllers/welcome_controller.rb new file mode 100644 index 0000000..f9b859b --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/app/controllers/welcome_controller.rb @@ -0,0 +1,4 @@ +class WelcomeController < ApplicationController + def index + end +end diff --git a/ChrisCahill-christophercahill/d6/blog/app/helpers/application_helper.rb b/ChrisCahill-christophercahill/d6/blog/app/helpers/application_helper.rb new file mode 100644 index 0000000..de6be79 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/ChrisCahill-christophercahill/d6/blog/app/helpers/articles_helper.rb b/ChrisCahill-christophercahill/d6/blog/app/helpers/articles_helper.rb new file mode 100644 index 0000000..2968277 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/app/helpers/articles_helper.rb @@ -0,0 +1,2 @@ +module ArticlesHelper +end diff --git a/ChrisCahill-christophercahill/d6/blog/app/helpers/comments_helper.rb b/ChrisCahill-christophercahill/d6/blog/app/helpers/comments_helper.rb new file mode 100644 index 0000000..0ec9ca5 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/app/helpers/comments_helper.rb @@ -0,0 +1,2 @@ +module CommentsHelper +end diff --git a/ChrisCahill-christophercahill/d6/blog/app/helpers/welcome_helper.rb b/ChrisCahill-christophercahill/d6/blog/app/helpers/welcome_helper.rb new file mode 100644 index 0000000..eeead45 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/app/helpers/welcome_helper.rb @@ -0,0 +1,2 @@ +module WelcomeHelper +end diff --git a/ChrisCahill-christophercahill/d6/blog/app/mailers/.keep b/ChrisCahill-christophercahill/d6/blog/app/mailers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d6/blog/app/models/.keep b/ChrisCahill-christophercahill/d6/blog/app/models/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d6/blog/app/models/article.rb b/ChrisCahill-christophercahill/d6/blog/app/models/article.rb new file mode 100644 index 0000000..8bce345 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/app/models/article.rb @@ -0,0 +1,5 @@ +class Article < ActiveRecord::Base + has_many :comments, dependent: :destroy + validates :title, presence: true, + length: { minimum: 5 } +end \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d6/blog/app/models/comment.rb b/ChrisCahill-christophercahill/d6/blog/app/models/comment.rb new file mode 100644 index 0000000..e2646a3 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/app/models/comment.rb @@ -0,0 +1,3 @@ +class Comment < ActiveRecord::Base + belongs_to :article +end diff --git a/ChrisCahill-christophercahill/d6/blog/app/models/concerns/.keep b/ChrisCahill-christophercahill/d6/blog/app/models/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d6/blog/app/views/articles/_form.html.erb b/ChrisCahill-christophercahill/d6/blog/app/views/articles/_form.html.erb new file mode 100644 index 0000000..908918d --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/app/views/articles/_form.html.erb @@ -0,0 +1,31 @@ +<%= form_for @article do |f| %> + + <% if @article.errors.any? %> +
+

+ <%= pluralize(@article.errors.count, "error") %> prohibited + this article from being saved: +

+ +
+ <% end %> + +

+ <%= f.label :title %>
+ <%= f.text_field :title %> +

+ +

+ <%= f.label :text %>
+ <%= f.text_area :text %> +

+ +

+ <%= f.submit %> +

+ +<% end %> \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d6/blog/app/views/articles/edit.html.erb b/ChrisCahill-christophercahill/d6/blog/app/views/articles/edit.html.erb new file mode 100644 index 0000000..41c5336 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/app/views/articles/edit.html.erb @@ -0,0 +1,5 @@ +

Edit article

+ +<%= render 'form' %> + +<%= link_to 'Back', articles_path %> \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d6/blog/app/views/articles/index.html.erb b/ChrisCahill-christophercahill/d6/blog/app/views/articles/index.html.erb new file mode 100644 index 0000000..02f429e --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/app/views/articles/index.html.erb @@ -0,0 +1,21 @@ +

Listing Articles

+<%= link_to 'New article', new_article_path %> + + + + + + + + <% @articles.each do |article| %> + + + + + + + + <% end %> +
TitleText
<%= article.title %><%= article.text %><%= link_to 'Show', article_path(article) %><%= link_to 'Edit', edit_article_path(article) %><%= link_to 'Destroy', article_path(article), + method: :delete, + data: { confirm: 'Are you sure?' } %>
\ No newline at end of file diff --git a/ChrisCahill-christophercahill/d6/blog/app/views/articles/new.html.erb b/ChrisCahill-christophercahill/d6/blog/app/views/articles/new.html.erb new file mode 100644 index 0000000..7d9d6d9 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/app/views/articles/new.html.erb @@ -0,0 +1,5 @@ +

New article

+ +<%= render 'form' %> + +<%= link_to 'Back', articles_path %> \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d6/blog/app/views/articles/show.html.erb b/ChrisCahill-christophercahill/d6/blog/app/views/articles/show.html.erb new file mode 100644 index 0000000..ef60e82 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/app/views/articles/show.html.erb @@ -0,0 +1,18 @@ +

+ Title: + <%= @article.title %> +

+ +

+ Text: + <%= @article.text %> +

+ +

Comments

+<%= render @article.comments %> + +

Add a comment:

+<%= render 'comments/form' %> + +<%= link_to 'Edit', edit_article_path(@article) %> | +<%= link_to 'Back', articles_path %> diff --git a/ChrisCahill-christophercahill/d6/blog/app/views/comments/_comment.html.erb b/ChrisCahill-christophercahill/d6/blog/app/views/comments/_comment.html.erb new file mode 100644 index 0000000..4a66d31 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/app/views/comments/_comment.html.erb @@ -0,0 +1,16 @@ +

+ Commenter: + <%= comment.commenter %> +

+ +

+ Comment: + <%= comment.body %> +

+ +

+ <%= link_to 'Destroy Comment', [comment.article, comment], + method: :delete, + data: { confirm: 'Are you sure?' } %> +

+ diff --git a/ChrisCahill-christophercahill/d6/blog/app/views/comments/_form.html.erb b/ChrisCahill-christophercahill/d6/blog/app/views/comments/_form.html.erb new file mode 100644 index 0000000..49c5d9d --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/app/views/comments/_form.html.erb @@ -0,0 +1,13 @@ +<%= form_for([@article, @article.comments.build]) do |f| %> +

+ <%= f.label :commenter %>
+ <%= f.text_field :commenter %> +

+

+ <%= f.label :body %>
+ <%= f.text_area :body %> +

+

+ <%= f.submit %> +

+<% end %> \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d6/blog/app/views/layouts/application.html.erb b/ChrisCahill-christophercahill/d6/blog/app/views/layouts/application.html.erb new file mode 100644 index 0000000..d0ba841 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/app/views/layouts/application.html.erb @@ -0,0 +1,14 @@ + + + + Blog + <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> + <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> + <%= csrf_meta_tags %> + + + +<%= yield %> + + + diff --git a/ChrisCahill-christophercahill/d6/blog/app/views/welcome/index.html.erb b/ChrisCahill-christophercahill/d6/blog/app/views/welcome/index.html.erb new file mode 100644 index 0000000..dad5006 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/app/views/welcome/index.html.erb @@ -0,0 +1,2 @@ +

Hello, Rails!

+<%= link_to 'My Blog', controller: 'articles' %> \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d6/blog/bin/bundle b/ChrisCahill-christophercahill/d6/blog/bin/bundle new file mode 100755 index 0000000..66e9889 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/bin/bundle @@ -0,0 +1,3 @@ +#!/usr/bin/env ruby +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +load Gem.bin_path('bundler', 'bundle') diff --git a/ChrisCahill-christophercahill/d6/blog/bin/rails b/ChrisCahill-christophercahill/d6/blog/bin/rails new file mode 100755 index 0000000..5191e69 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/bin/rails @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +APP_PATH = File.expand_path('../../config/application', __FILE__) +require_relative '../config/boot' +require 'rails/commands' diff --git a/ChrisCahill-christophercahill/d6/blog/bin/rake b/ChrisCahill-christophercahill/d6/blog/bin/rake new file mode 100755 index 0000000..1724048 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/bin/rake @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +require_relative '../config/boot' +require 'rake' +Rake.application.run diff --git a/ChrisCahill-christophercahill/d6/blog/bin/setup b/ChrisCahill-christophercahill/d6/blog/bin/setup new file mode 100755 index 0000000..acdb2c1 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/bin/setup @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +require 'pathname' + +# path to your application root. +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) + +Dir.chdir APP_ROOT do + # This script is a starting point to setup your application. + # Add necessary setup steps to this file: + + puts "== Installing dependencies ==" + system "gem install bundler --conservative" + system "bundle check || bundle install" + + # puts "\n== Copying sample files ==" + # unless File.exist?("config/database.yml") + # system "cp config/database.yml.sample config/database.yml" + # end + + puts "\n== Preparing database ==" + system "bin/rake db:setup" + + puts "\n== Removing old logs and tempfiles ==" + system "rm -f log/*" + system "rm -rf tmp/cache" + + puts "\n== Restarting application server ==" + system "touch tmp/restart.txt" +end diff --git a/ChrisCahill-christophercahill/d6/blog/config.ru b/ChrisCahill-christophercahill/d6/blog/config.ru new file mode 100644 index 0000000..bd83b25 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/config.ru @@ -0,0 +1,4 @@ +# This file is used by Rack-based servers to start the application. + +require ::File.expand_path('../config/environment', __FILE__) +run Rails.application diff --git a/ChrisCahill-christophercahill/d6/blog/config/application.rb b/ChrisCahill-christophercahill/d6/blog/config/application.rb new file mode 100644 index 0000000..ecd54d7 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/config/application.rb @@ -0,0 +1,26 @@ +require File.expand_path('../boot', __FILE__) + +require 'rails/all' + +# Require the gems listed in Gemfile, including any gems +# you've limited to :test, :development, or :production. +Bundler.require(*Rails.groups) + +module Blog + class Application < Rails::Application + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. + # config.time_zone = 'Central Time (US & Canada)' + + # 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 + + # Do not swallow errors in after_commit/after_rollback callbacks. + config.active_record.raise_in_transactional_callbacks = true + end +end diff --git a/ChrisCahill-christophercahill/d6/blog/config/boot.rb b/ChrisCahill-christophercahill/d6/blog/config/boot.rb new file mode 100644 index 0000000..6b750f0 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/config/boot.rb @@ -0,0 +1,3 @@ +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) + +require 'bundler/setup' # Set up gems listed in the Gemfile. diff --git a/ChrisCahill-christophercahill/d6/blog/config/database.yml b/ChrisCahill-christophercahill/d6/blog/config/database.yml new file mode 100644 index 0000000..1c1a37c --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/config/database.yml @@ -0,0 +1,25 @@ +# SQLite version 3.x +# gem install sqlite3 +# +# Ensure the SQLite 3 gem is defined in your Gemfile +# gem 'sqlite3' +# +default: &default + adapter: sqlite3 + pool: 5 + timeout: 5000 + +development: + <<: *default + database: db/development.sqlite3 + +# Warning: The database defined as "test" will be erased and +# re-generated from your development database when you run "rake". +# Do not set this db to the same as development or production. +test: + <<: *default + database: db/test.sqlite3 + +production: + <<: *default + database: db/production.sqlite3 diff --git a/ChrisCahill-christophercahill/d6/blog/config/environment.rb b/ChrisCahill-christophercahill/d6/blog/config/environment.rb new file mode 100644 index 0000000..ee8d90d --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/config/environment.rb @@ -0,0 +1,5 @@ +# Load the Rails application. +require File.expand_path('../application', __FILE__) + +# Initialize the Rails application. +Rails.application.initialize! diff --git a/ChrisCahill-christophercahill/d6/blog/config/environments/development.rb b/ChrisCahill-christophercahill/d6/blog/config/environments/development.rb new file mode 100644 index 0000000..b55e214 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/config/environments/development.rb @@ -0,0 +1,41 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # In the development environment your application's code is reloaded on + # every request. This slows down response time but is perfect for development + # since you don't have to restart the web server when you make code changes. + config.cache_classes = false + + # Do not eager load code on boot. + config.eager_load = false + + # Show full error reports and disable caching. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Don't care if the mailer can't send. + config.action_mailer.raise_delivery_errors = false + + # Print deprecation notices to the Rails logger. + config.active_support.deprecation = :log + + # Raise an error on page load if there are pending migrations. + config.active_record.migration_error = :page_load + + # Debug mode disables concatenation and preprocessing of assets. + # This option may cause significant delays in view rendering with a large + # number of complex assets. + config.assets.debug = true + + # Asset digests allow you to set far-future HTTP expiration dates on all assets, + # yet still be able to expire them through the digest params. + config.assets.digest = true + + # Adds additional error checking when serving assets at runtime. + # Checks for improperly declared sprockets dependencies. + # Raises helpful error messages. + config.assets.raise_runtime_errors = true + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true +end diff --git a/ChrisCahill-christophercahill/d6/blog/config/environments/production.rb b/ChrisCahill-christophercahill/d6/blog/config/environments/production.rb new file mode 100644 index 0000000..5c1b32e --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/config/environments/production.rb @@ -0,0 +1,79 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # Code is not reloaded between requests. + config.cache_classes = true + + # Eager load code on boot. This eager loads most of Rails and + # your application in memory, allowing both threaded web servers + # and those relying on copy on write to perform better. + # Rake tasks automatically ignore this option for performance. + config.eager_load = true + + # Full error reports are disabled and caching is turned on. + config.consider_all_requests_local = false + config.action_controller.perform_caching = true + + # Enable Rack::Cache to put a simple HTTP cache in front of your application + # Add `rack-cache` to your Gemfile before enabling this. + # For large-scale production use, consider using a caching reverse proxy like + # NGINX, varnish or squid. + # config.action_dispatch.rack_cache = true + + # Disable serving static files from the `/public` folder by default since + # Apache or NGINX already handles this. + config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? + + # Compress JavaScripts and CSS. + config.assets.js_compressor = :uglifier + # config.assets.css_compressor = :sass + + # Do not fallback to assets pipeline if a precompiled asset is missed. + config.assets.compile = false + + # Asset digests allow you to set far-future HTTP expiration dates on all assets, + # yet still be able to expire them through the digest params. + config.assets.digest = true + + # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb + + # Specifies the header that your server uses for sending files. + # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # Use the lowest log level to ensure availability of diagnostic information + # when problems arise. + config.log_level = :debug + + # Prepend all log lines with the following tags. + # config.log_tags = [ :subdomain, :uuid ] + + # Use a different logger for distributed setups. + # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + + # Use a different cache store in production. + # config.cache_store = :mem_cache_store + + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.action_controller.asset_host = 'http://assets.example.com' + + # Ignore bad email addresses and do not raise email delivery errors. + # Set this to true and configure the email server for immediate delivery to raise delivery errors. + # config.action_mailer.raise_delivery_errors = false + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation cannot be found). + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners. + config.active_support.deprecation = :notify + + # Use default logging formatter so that PID and timestamp are not suppressed. + config.log_formatter = ::Logger::Formatter.new + + # Do not dump schema after migrations. + config.active_record.dump_schema_after_migration = false +end diff --git a/ChrisCahill-christophercahill/d6/blog/config/environments/test.rb b/ChrisCahill-christophercahill/d6/blog/config/environments/test.rb new file mode 100644 index 0000000..1c19f08 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/config/environments/test.rb @@ -0,0 +1,42 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # The test environment is used exclusively to run your application's + # test suite. You never need to work with it otherwise. Remember that + # your test database is "scratch space" for the test suite and is wiped + # and recreated between test runs. Don't rely on the data there! + config.cache_classes = true + + # Do not eager load code on boot. This avoids loading your whole application + # just for the purpose of running a single test. If you are using a tool that + # preloads Rails for running tests, you may have to set it to true. + config.eager_load = false + + # Configure static file server for tests with Cache-Control for performance. + config.serve_static_files = true + config.static_cache_control = 'public, max-age=3600' + + # Show full error reports and disable caching. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Raise exceptions instead of rendering exception templates. + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment. + config.action_controller.allow_forgery_protection = false + + # Tell Action Mailer not to deliver emails to the real world. + # The :test delivery method accumulates sent emails in the + # ActionMailer::Base.deliveries array. + config.action_mailer.delivery_method = :test + + # Randomize the order test cases are executed. + config.active_support.test_order = :random + + # Print deprecation notices to the stderr. + config.active_support.deprecation = :stderr + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true +end diff --git a/ChrisCahill-christophercahill/d6/blog/config/initializers/assets.rb b/ChrisCahill-christophercahill/d6/blog/config/initializers/assets.rb new file mode 100644 index 0000000..01ef3e6 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/config/initializers/assets.rb @@ -0,0 +1,11 @@ +# Be sure to restart your server when you modify this file. + +# Version of your assets, change this if you want to expire all your assets. +Rails.application.config.assets.version = '1.0' + +# Add additional assets to the asset load path +# Rails.application.config.assets.paths << Emoji.images_path + +# Precompile additional assets. +# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. +# Rails.application.config.assets.precompile += %w( search.js ) diff --git a/ChrisCahill-christophercahill/d6/blog/config/initializers/backtrace_silencers.rb b/ChrisCahill-christophercahill/d6/blog/config/initializers/backtrace_silencers.rb new file mode 100644 index 0000000..59385cd --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/config/initializers/backtrace_silencers.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. +# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } + +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. +# Rails.backtrace_cleaner.remove_silencers! diff --git a/ChrisCahill-christophercahill/d6/blog/config/initializers/cookies_serializer.rb b/ChrisCahill-christophercahill/d6/blog/config/initializers/cookies_serializer.rb new file mode 100644 index 0000000..7f70458 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/config/initializers/cookies_serializer.rb @@ -0,0 +1,3 @@ +# Be sure to restart your server when you modify this file. + +Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/ChrisCahill-christophercahill/d6/blog/config/initializers/filter_parameter_logging.rb b/ChrisCahill-christophercahill/d6/blog/config/initializers/filter_parameter_logging.rb new file mode 100644 index 0000000..4a994e1 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/config/initializers/filter_parameter_logging.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Configure sensitive parameters which will be filtered from the log file. +Rails.application.config.filter_parameters += [:password] diff --git a/ChrisCahill-christophercahill/d6/blog/config/initializers/inflections.rb b/ChrisCahill-christophercahill/d6/blog/config/initializers/inflections.rb new file mode 100644 index 0000000..ac033bf --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/config/initializers/inflections.rb @@ -0,0 +1,16 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format. Inflections +# are locale specific, and you may define rules for as many different +# locales as you wish. All of these examples are active by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.plural /^(ox)$/i, '\1en' +# inflect.singular /^(ox)en/i, '\1' +# inflect.irregular 'person', 'people' +# inflect.uncountable %w( fish sheep ) +# end + +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.acronym 'RESTful' +# end diff --git a/ChrisCahill-christophercahill/d6/blog/config/initializers/mime_types.rb b/ChrisCahill-christophercahill/d6/blog/config/initializers/mime_types.rb new file mode 100644 index 0000000..dc18996 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/config/initializers/mime_types.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Add new mime types for use in respond_to blocks: +# Mime::Type.register "text/richtext", :rtf diff --git a/ChrisCahill-christophercahill/d6/blog/config/initializers/session_store.rb b/ChrisCahill-christophercahill/d6/blog/config/initializers/session_store.rb new file mode 100644 index 0000000..1b9fa32 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/config/initializers/session_store.rb @@ -0,0 +1,3 @@ +# Be sure to restart your server when you modify this file. + +Rails.application.config.session_store :cookie_store, key: '_blog_session' diff --git a/ChrisCahill-christophercahill/d6/blog/config/initializers/wrap_parameters.rb b/ChrisCahill-christophercahill/d6/blog/config/initializers/wrap_parameters.rb new file mode 100644 index 0000000..33725e9 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/config/initializers/wrap_parameters.rb @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. + +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActiveSupport.on_load(:action_controller) do + wrap_parameters format: [:json] if respond_to?(:wrap_parameters) +end + +# To enable root element in JSON for ActiveRecord objects. +# ActiveSupport.on_load(:active_record) do +# self.include_root_in_json = true +# end diff --git a/ChrisCahill-christophercahill/d6/blog/config/locales/en.yml b/ChrisCahill-christophercahill/d6/blog/config/locales/en.yml new file mode 100644 index 0000000..0653957 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/config/locales/en.yml @@ -0,0 +1,23 @@ +# Files in the config/locales directory are used for internationalization +# and are automatically loaded by Rails. If you want to use locales other +# than English, add the necessary files in this directory. +# +# To use the locales, use `I18n.t`: +# +# I18n.t 'hello' +# +# In views, this is aliased to just `t`: +# +# <%= t('hello') %> +# +# To use a different locale, set it with `I18n.locale`: +# +# I18n.locale = :es +# +# This would use the information in config/locales/es.yml. +# +# To learn more, please read the Rails Internationalization guide +# available at http://guides.rubyonrails.org/i18n.html. + +en: + hello: "Hello world" diff --git a/ChrisCahill-christophercahill/d6/blog/config/routes.rb b/ChrisCahill-christophercahill/d6/blog/config/routes.rb new file mode 100644 index 0000000..f27f519 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/config/routes.rb @@ -0,0 +1,60 @@ +Rails.application.routes.draw do + get 'welcome/index' + + # The priority is based upon order of creation: first created -> highest priority. + # See how all your routes lay out with "rake routes". + resources :articles do + resources :comments + end + # 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 +end diff --git a/ChrisCahill-christophercahill/d6/blog/config/secrets.yml b/ChrisCahill-christophercahill/d6/blog/config/secrets.yml new file mode 100644 index 0000000..0423f0d --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/config/secrets.yml @@ -0,0 +1,22 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key is used for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! + +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +# You can use `rake secret` to generate a secure secret key. + +# Make sure the secrets in this file are kept private +# if you're sharing your code publicly. + +development: + secret_key_base: a3e931dba17b7fe85002a347cdba879704c8fd37f4019f579690f76b863624f787ec7f7e22e1879109874a17d1dc4c5211db7d6d77f979867ed1b73f2071f0dc + +test: + secret_key_base: cf3d11c50b389f5bb245400430cec40cded2499a4a9aee33df08ff6ad087f289d9c6f0bba3b5735d9aec65cf474271b9c6d55d19f92725375769f5d14f249b17 + +# Do not keep production secrets in the repository, +# instead read values from the environment. +production: + secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> diff --git a/ChrisCahill-christophercahill/d6/blog/db/migrate/20150622090959_create_articles.rb b/ChrisCahill-christophercahill/d6/blog/db/migrate/20150622090959_create_articles.rb new file mode 100644 index 0000000..a7ffd81 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/db/migrate/20150622090959_create_articles.rb @@ -0,0 +1,10 @@ +class CreateArticles < ActiveRecord::Migration + def change + create_table :articles do |t| + t.string :title + t.text :text + + t.timestamps null: false + end + end +end diff --git a/ChrisCahill-christophercahill/d6/blog/db/migrate/20150622125240_create_comments.rb b/ChrisCahill-christophercahill/d6/blog/db/migrate/20150622125240_create_comments.rb new file mode 100644 index 0000000..ae3c33c --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/db/migrate/20150622125240_create_comments.rb @@ -0,0 +1,11 @@ +class CreateComments < ActiveRecord::Migration + def change + create_table :comments do |t| + t.string :commenter + t.text :body + t.references :article, index: true, foreign_key: true + + t.timestamps null: false + end + end +end diff --git a/ChrisCahill-christophercahill/d6/blog/db/schema.rb b/ChrisCahill-christophercahill/d6/blog/db/schema.rb new file mode 100644 index 0000000..90417fe --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/db/schema.rb @@ -0,0 +1,33 @@ +# 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: 20150622125240) do + + create_table "articles", force: :cascade do |t| + t.string "title" + t.text "text" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "comments", force: :cascade do |t| + t.string "commenter" + t.text "body" + t.integer "article_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "comments", ["article_id"], name: "index_comments_on_article_id" + +end diff --git a/ChrisCahill-christophercahill/d6/blog/db/seeds.rb b/ChrisCahill-christophercahill/d6/blog/db/seeds.rb new file mode 100644 index 0000000..4edb1e8 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/db/seeds.rb @@ -0,0 +1,7 @@ +# This file should contain all the record creation needed to seed the database with its default values. +# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). +# +# Examples: +# +# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) +# Mayor.create(name: 'Emanuel', city: cities.first) diff --git a/ChrisCahill-christophercahill/d6/blog/lib/assets/.keep b/ChrisCahill-christophercahill/d6/blog/lib/assets/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d6/blog/lib/tasks/.keep b/ChrisCahill-christophercahill/d6/blog/lib/tasks/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d6/blog/log/.keep b/ChrisCahill-christophercahill/d6/blog/log/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d6/blog/public/404.html b/ChrisCahill-christophercahill/d6/blog/public/404.html new file mode 100644 index 0000000..b612547 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/public/404.html @@ -0,0 +1,67 @@ + + + + The page you were looking for doesn't exist (404) + + + + + + +
+
+

The page you were looking for doesn't exist.

+

You may have mistyped the address or the page may have moved.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/ChrisCahill-christophercahill/d6/blog/public/422.html b/ChrisCahill-christophercahill/d6/blog/public/422.html new file mode 100644 index 0000000..a21f82b --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/public/422.html @@ -0,0 +1,67 @@ + + + + The change you wanted was rejected (422) + + + + + + +
+
+

The change you wanted was rejected.

+

Maybe you tried to change something you didn't have access to.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/ChrisCahill-christophercahill/d6/blog/public/500.html b/ChrisCahill-christophercahill/d6/blog/public/500.html new file mode 100644 index 0000000..061abc5 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/public/500.html @@ -0,0 +1,66 @@ + + + + We're sorry, but something went wrong (500) + + + + + + +
+
+

We're sorry, but something went wrong.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/ChrisCahill-christophercahill/d6/blog/public/favicon.ico b/ChrisCahill-christophercahill/d6/blog/public/favicon.ico new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d6/blog/public/robots.txt b/ChrisCahill-christophercahill/d6/blog/public/robots.txt new file mode 100644 index 0000000..3c9c7c0 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/public/robots.txt @@ -0,0 +1,5 @@ +# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file +# +# To ban all spiders from the entire site uncomment the next two lines: +# User-agent: * +# Disallow: / diff --git a/ChrisCahill-christophercahill/d6/blog/test/controllers/.keep b/ChrisCahill-christophercahill/d6/blog/test/controllers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d6/blog/test/controllers/articles_controller_test.rb b/ChrisCahill-christophercahill/d6/blog/test/controllers/articles_controller_test.rb new file mode 100644 index 0000000..361aa0f --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/test/controllers/articles_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ArticlesControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/ChrisCahill-christophercahill/d6/blog/test/controllers/comments_controller_test.rb b/ChrisCahill-christophercahill/d6/blog/test/controllers/comments_controller_test.rb new file mode 100644 index 0000000..2ec71b4 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/test/controllers/comments_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class CommentsControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/ChrisCahill-christophercahill/d6/blog/test/controllers/welcome_controller_test.rb b/ChrisCahill-christophercahill/d6/blog/test/controllers/welcome_controller_test.rb new file mode 100644 index 0000000..dff8e9d --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/test/controllers/welcome_controller_test.rb @@ -0,0 +1,9 @@ +require 'test_helper' + +class WelcomeControllerTest < ActionController::TestCase + test "should get index" do + get :index + assert_response :success + end + +end diff --git a/ChrisCahill-christophercahill/d6/blog/test/fixtures/.keep b/ChrisCahill-christophercahill/d6/blog/test/fixtures/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d6/blog/test/fixtures/articles.yml b/ChrisCahill-christophercahill/d6/blog/test/fixtures/articles.yml new file mode 100644 index 0000000..46b01c3 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/test/fixtures/articles.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + title: MyString + text: MyText + +two: + title: MyString + text: MyText diff --git a/ChrisCahill-christophercahill/d6/blog/test/fixtures/comments.yml b/ChrisCahill-christophercahill/d6/blog/test/fixtures/comments.yml new file mode 100644 index 0000000..b133ca1 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/test/fixtures/comments.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + commenter: MyString + body: MyText + article_id: + +two: + commenter: MyString + body: MyText + article_id: diff --git a/ChrisCahill-christophercahill/d6/blog/test/helpers/.keep b/ChrisCahill-christophercahill/d6/blog/test/helpers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d6/blog/test/integration/.keep b/ChrisCahill-christophercahill/d6/blog/test/integration/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d6/blog/test/mailers/.keep b/ChrisCahill-christophercahill/d6/blog/test/mailers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d6/blog/test/models/.keep b/ChrisCahill-christophercahill/d6/blog/test/models/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d6/blog/test/models/article_test.rb b/ChrisCahill-christophercahill/d6/blog/test/models/article_test.rb new file mode 100644 index 0000000..11c8abe --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/test/models/article_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ArticleTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/ChrisCahill-christophercahill/d6/blog/test/models/comment_test.rb b/ChrisCahill-christophercahill/d6/blog/test/models/comment_test.rb new file mode 100644 index 0000000..b6d6131 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/test/models/comment_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class CommentTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/ChrisCahill-christophercahill/d6/blog/test/test_helper.rb b/ChrisCahill-christophercahill/d6/blog/test/test_helper.rb new file mode 100644 index 0000000..92e39b2 --- /dev/null +++ b/ChrisCahill-christophercahill/d6/blog/test/test_helper.rb @@ -0,0 +1,10 @@ +ENV['RAILS_ENV'] ||= 'test' +require File.expand_path('../../config/environment', __FILE__) +require 'rails/test_help' + +class ActiveSupport::TestCase + # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. + fixtures :all + + # Add more helper methods to be used by all tests here... +end diff --git a/ChrisCahill-christophercahill/d6/blog/vendor/assets/javascripts/.keep b/ChrisCahill-christophercahill/d6/blog/vendor/assets/javascripts/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d6/blog/vendor/assets/stylesheets/.keep b/ChrisCahill-christophercahill/d6/blog/vendor/assets/stylesheets/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d6/questions/essays.txt b/ChrisCahill-christophercahill/d6/questions/essays.txt new file mode 100644 index 0000000..522873a --- /dev/null +++ b/ChrisCahill-christophercahill/d6/questions/essays.txt @@ -0,0 +1,29 @@ +1. Explain how a route leads to a controller and renders a view. + + +The collective routes determine which controller and action is used for every request. Different routes relate the requests to different controllers. Once there's a set controller/action, a template is rendered (a view). + +Ex. request: DELETE /photos/17 + + example route: resources :photos + +If there's a request (the sample request), then it has to find a matching route. If the example route is there, then it dispatches the request appropriately (on the pertinent controller). + +2. Explain the difference between a schema, a database, and a model (and give an example). + +Schema are a way to organize data in a database. A model handles interactions +(with) in the database, and the database is where all the data is held. + +Blog app today: + +All data (the articles) are on the database. The schema comes from + +3. Explain the purpose of migration. + +Migrations allow you to alter schema over time, changing the organization of the database. + + +Code Questions: +1. This firstly declares a new REST resource, which is added to config/routes.rb. From here, you can create, read, update and destroy information. +2. Rake routes looks for the Rakefile, which in this case is in Ruby. In our case, this shows all the routing (possible routes). This is helpful to see which routes are in existence (defined). +3. In Rails, you would still have the ERB files, which are the views files. The controller has the routes defined in it. The home page is in the routes.rb file (the index). \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d7/capetownguide/.gitignore b/ChrisCahill-christophercahill/d7/capetownguide/.gitignore new file mode 100644 index 0000000..050c9d9 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/.gitignore @@ -0,0 +1,17 @@ +# See https://help.github.com/articles/ignoring-files for more about ignoring files. +# +# If you find yourself ignoring temporary files generated by your text editor +# or operating system, you probably want to add a global ignore instead: +# git config --global core.excludesfile '~/.gitignore_global' + +# Ignore bundler config. +/.bundle + +# Ignore the default SQLite database. +/db/*.sqlite3 +/db/*.sqlite3-journal + +# Ignore all logfiles and tempfiles. +/log/* +!/log/.keep +/tmp diff --git a/ChrisCahill-christophercahill/d7/capetownguide/Gemfile b/ChrisCahill-christophercahill/d7/capetownguide/Gemfile new file mode 100644 index 0000000..a2b2606 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/Gemfile @@ -0,0 +1,45 @@ +source 'https://rubygems.org' + + +# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' +gem 'rails', '4.2.1' +# Use sqlite3 as the database for Active Record +gem 'sqlite3' +# Use SCSS for stylesheets +gem 'sass-rails', '~> 5.0' +# Use Uglifier as compressor for JavaScript assets +gem 'uglifier', '>= 1.3.0' +# Use CoffeeScript for .coffee assets and views +gem 'coffee-rails', '~> 4.1.0' +# See https://github.com/rails/execjs#readme for more supported runtimes +# gem 'therubyracer', platforms: :ruby + +# Use jquery as the JavaScript library +gem 'jquery-rails' +# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks +gem 'turbolinks' +# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder +gem 'jbuilder', '~> 2.0' +# bundle exec rake doc:rails generates the API under doc/api. +gem 'sdoc', '~> 0.4.0', group: :doc + +# Use ActiveModel has_secure_password +# gem 'bcrypt', '~> 3.1.7' + +# Use Unicorn as the app server +# gem 'unicorn' + +# Use Capistrano for deployment +# gem 'capistrano-rails', group: :development + +group :development, :test do + # Call 'byebug' anywhere in the code to stop execution and get a debugger console + gem 'byebug' + + # Access an IRB console on exception pages or by using <%= console %> in views + gem 'web-console', '~> 2.0' + + # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring + gem 'spring' +end + diff --git a/ChrisCahill-christophercahill/d7/capetownguide/Gemfile.lock b/ChrisCahill-christophercahill/d7/capetownguide/Gemfile.lock new file mode 100644 index 0000000..2520e68 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/Gemfile.lock @@ -0,0 +1,158 @@ +GEM + remote: https://rubygems.org/ + specs: + actionmailer (4.2.1) + actionpack (= 4.2.1) + actionview (= 4.2.1) + activejob (= 4.2.1) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 1.0, >= 1.0.5) + actionpack (4.2.1) + actionview (= 4.2.1) + activesupport (= 4.2.1) + rack (~> 1.6) + rack-test (~> 0.6.2) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.1) + actionview (4.2.1) + activesupport (= 4.2.1) + builder (~> 3.1) + erubis (~> 2.7.0) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.1) + activejob (4.2.1) + activesupport (= 4.2.1) + globalid (>= 0.3.0) + activemodel (4.2.1) + activesupport (= 4.2.1) + builder (~> 3.1) + activerecord (4.2.1) + activemodel (= 4.2.1) + activesupport (= 4.2.1) + arel (~> 6.0) + activesupport (4.2.1) + i18n (~> 0.7) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + arel (6.0.0) + binding_of_caller (0.7.2) + debug_inspector (>= 0.0.1) + builder (3.2.2) + byebug (5.0.0) + columnize (= 0.9.0) + coffee-rails (4.1.0) + coffee-script (>= 2.2.0) + railties (>= 4.0.0, < 5.0) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.9.1.1) + columnize (0.9.0) + debug_inspector (0.0.2) + erubis (2.7.0) + execjs (2.5.2) + globalid (0.3.5) + activesupport (>= 4.1.0) + i18n (0.7.0) + jbuilder (2.3.0) + activesupport (>= 3.0.0, < 5) + multi_json (~> 1.2) + jquery-rails (4.0.4) + rails-dom-testing (~> 1.0) + railties (>= 4.2.0) + thor (>= 0.14, < 2.0) + json (1.8.3) + loofah (2.0.2) + nokogiri (>= 1.5.9) + mail (2.6.3) + mime-types (>= 1.16, < 3) + mime-types (2.6.1) + mini_portile (0.6.2) + minitest (5.7.0) + multi_json (1.11.1) + nokogiri (1.6.6.2) + mini_portile (~> 0.6.0) + rack (1.6.4) + rack-test (0.6.3) + rack (>= 1.0) + rails (4.2.1) + actionmailer (= 4.2.1) + actionpack (= 4.2.1) + actionview (= 4.2.1) + activejob (= 4.2.1) + activemodel (= 4.2.1) + activerecord (= 4.2.1) + activesupport (= 4.2.1) + bundler (>= 1.3.0, < 2.0) + railties (= 4.2.1) + sprockets-rails + rails-deprecated_sanitizer (1.0.3) + activesupport (>= 4.2.0.alpha) + rails-dom-testing (1.0.6) + activesupport (>= 4.2.0.beta, < 5.0) + nokogiri (~> 1.6.0) + rails-deprecated_sanitizer (>= 1.0.1) + rails-html-sanitizer (1.0.2) + loofah (~> 2.0) + railties (4.2.1) + actionpack (= 4.2.1) + activesupport (= 4.2.1) + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (10.4.2) + rdoc (4.2.0) + sass (3.4.15) + sass-rails (5.0.3) + railties (>= 4.0.0, < 5.0) + sass (~> 3.1) + sprockets (>= 2.8, < 4.0) + sprockets-rails (>= 2.0, < 4.0) + tilt (~> 1.1) + sdoc (0.4.1) + json (~> 1.7, >= 1.7.7) + rdoc (~> 4.0) + spring (1.3.6) + sprockets (3.2.0) + rack (~> 1.0) + sprockets-rails (2.3.1) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (>= 2.8, < 4.0) + sqlite3 (1.3.10) + thor (0.19.1) + thread_safe (0.3.5) + tilt (1.4.1) + turbolinks (2.5.3) + coffee-rails + tzinfo (1.2.2) + thread_safe (~> 0.1) + uglifier (2.7.1) + execjs (>= 0.3.0) + json (>= 1.8.0) + web-console (2.1.3) + activemodel (>= 4.0) + binding_of_caller (>= 0.7.2) + railties (>= 4.0) + sprockets-rails (>= 2.0, < 4.0) + +PLATFORMS + ruby + +DEPENDENCIES + byebug + coffee-rails (~> 4.1.0) + jbuilder (~> 2.0) + jquery-rails + rails (= 4.2.1) + sass-rails (~> 5.0) + sdoc (~> 0.4.0) + spring + sqlite3 + turbolinks + uglifier (>= 1.3.0) + web-console (~> 2.0) + +BUNDLED WITH + 1.10.3 diff --git a/ChrisCahill-christophercahill/d7/capetownguide/README.rdoc b/ChrisCahill-christophercahill/d7/capetownguide/README.rdoc new file mode 100644 index 0000000..dd4e97e --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/README.rdoc @@ -0,0 +1,28 @@ +== README + +This README would normally document whatever steps are necessary to get the +application up and running. + +Things you may want to cover: + +* Ruby version + +* System dependencies + +* Configuration + +* Database creation + +* Database initialization + +* How to run the test suite + +* Services (job queues, cache servers, search engines, etc.) + +* Deployment instructions + +* ... + + +Please feel free to use a different markup language if you do not plan to run +rake doc:app. diff --git a/ChrisCahill-christophercahill/d7/capetownguide/Rakefile b/ChrisCahill-christophercahill/d7/capetownguide/Rakefile new file mode 100644 index 0000000..ba6b733 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/Rakefile @@ -0,0 +1,6 @@ +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require File.expand_path('../config/application', __FILE__) + +Rails.application.load_tasks diff --git a/ChrisCahill-christophercahill/d7/capetownguide/app/assets/images/.keep b/ChrisCahill-christophercahill/d7/capetownguide/app/assets/images/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d7/capetownguide/app/assets/javascripts/application.js b/ChrisCahill-christophercahill/d7/capetownguide/app/assets/javascripts/application.js new file mode 100644 index 0000000..e07c5a8 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/app/assets/javascripts/application.js @@ -0,0 +1,16 @@ +// This is a manifest file that'll be compiled into application.js, which will include all the files +// listed below. +// +// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, +// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. +// +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// compiled file. +// +// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details +// about supported directives. +// +//= require jquery +//= require jquery_ujs +//= require turbolinks +//= require_tree . diff --git a/ChrisCahill-christophercahill/d7/capetownguide/app/assets/javascripts/places.coffee b/ChrisCahill-christophercahill/d7/capetownguide/app/assets/javascripts/places.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/app/assets/javascripts/places.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/ChrisCahill-christophercahill/d7/capetownguide/app/assets/javascripts/welcome.coffee b/ChrisCahill-christophercahill/d7/capetownguide/app/assets/javascripts/welcome.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/app/assets/javascripts/welcome.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/ChrisCahill-christophercahill/d7/capetownguide/app/assets/stylesheets/application.css b/ChrisCahill-christophercahill/d7/capetownguide/app/assets/stylesheets/application.css new file mode 100644 index 0000000..f9cd5b3 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/app/assets/stylesheets/application.css @@ -0,0 +1,15 @@ +/* + * This is a manifest file that'll be compiled into application.css, which will include all the files + * listed below. + * + * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, + * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. + * + * You're free to add application-wide styles to this file and they'll appear at the bottom of the + * compiled file so the styles you add here take precedence over styles defined in any styles + * defined in the other CSS/SCSS files in this directory. It is generally better to create a new + * file per style scope. + * + *= require_tree . + *= require_self + */ diff --git a/ChrisCahill-christophercahill/d7/capetownguide/app/assets/stylesheets/places.scss b/ChrisCahill-christophercahill/d7/capetownguide/app/assets/stylesheets/places.scss new file mode 100644 index 0000000..d668e8e --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/app/assets/stylesheets/places.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the places controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/ChrisCahill-christophercahill/d7/capetownguide/app/assets/stylesheets/welcome.scss b/ChrisCahill-christophercahill/d7/capetownguide/app/assets/stylesheets/welcome.scss new file mode 100644 index 0000000..77ce11a --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/app/assets/stylesheets/welcome.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the welcome controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/ChrisCahill-christophercahill/d7/capetownguide/app/controllers/application_controller.rb b/ChrisCahill-christophercahill/d7/capetownguide/app/controllers/application_controller.rb new file mode 100644 index 0000000..d83690e --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/app/controllers/application_controller.rb @@ -0,0 +1,5 @@ +class ApplicationController < ActionController::Base + # Prevent CSRF attacks by raising an exception. + # For APIs, you may want to use :null_session instead. + protect_from_forgery with: :exception +end diff --git a/ChrisCahill-christophercahill/d7/capetownguide/app/controllers/concerns/.keep b/ChrisCahill-christophercahill/d7/capetownguide/app/controllers/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d7/capetownguide/app/controllers/places_controller.rb b/ChrisCahill-christophercahill/d7/capetownguide/app/controllers/places_controller.rb new file mode 100644 index 0000000..08a8fdb --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/app/controllers/places_controller.rb @@ -0,0 +1,43 @@ +class PlacesController < ApplicationController + + def index + @places = ["Lion's Head", "Camps Bay", "Old Biscuit Mill"] + @places_url = { "Lion's Head" => "lion" , + "Camps Bay" => "camp" , "Old Biscuit Mill" => "old" } + end + + def place + place = params[:place] + places = {"lion" => + {"title" => "Lion's Head", + "picture" => "http://www.capetownmagazine.com//media_lib/r2/fa98c334aa8f8907bd2a8595e46c5526.img.jpg", + "map" => "https://www.google.co.za/maps/place/Lion's+Head,+Table+Mountain+National+Park,+Signal+Hill,+Cape+Town,+8001/@-33.935037,18.3889709,15z/data=!4m2!3m1!1s0x1dcc6705adf437ed:0x482833296b600211", + "description" => "Description: \n Lion's head is a mountain in Cape Town, South Africa, located between Table Mountain and Signal Hill. Lion's Head peaks at 669 metres (2,195 ft) above sea level. The mountain is a part of the Table Mountain National Park. The suburbs of the city surround the peak on almost all sides of the Mountain, but strict management by city authorities has kept development of housing off the higher ground. The Lion's Head area is significant to the Cape Malay community, who historically lived in the Bo-Kaap quarter. +\n Activities: \n Lion's head is know for it's beautiful views over both the city and the Atlantic Seaboard. The hour-long walk to the top is extremely popular, especially during the full moon and during sunrise. Its slopes are also a popular launching point for paragliders. +" + }, + "camp" => + {"title" => "Camps Bay", + "picture" => "http://www.savingwater.co.za/wp-content/uploads/2010/02/camps-bay.jpg", + "map" => "https://www.google.co.za/maps/place/Camps+Bay,+Cape+Town/@-33.9520409,18.382408,15z/data=!3m1!4b1!4m2!3m1!1s0x1dcc67ad0e328c89:0xc7a0b241c4464b97", + "description" => "Description/History: \n Camps Bay is an affluent suburb of Cape Town, South Africa. In summer it attracts a large number of foreign visitors as well as South Africans. The first residents of Camps Bay were the San (Hunter Gatherers) and the Goringqhaique, Khoi pastorates. By 1713 the number of Gringqhaique population had been reduced by measles and smallpox. All that was left of their settlement was an old kraal (Oudekraal). For most of the 1800s Camps Bay was undeveloped. Lord Charles Somerset used the area for hunting and used the Roundhouse as his lodge. Kloof Road was built in 1848 and in 1884 Thomas Bain was commissioned to build a road from Sea Point to Camps Bay using convict labour. In 1913 Camps Bay was incorporated into Cape Town although it was still seen as a recreational area rather than a residential area. + \n Activities: \n If you head south from the beaches of Clifton (or north from the buzz of Sea Point), you’ll discover the chic suburb of Camps Bay. The main attraction, Victoria Road, is jam-packed with funky restaurants, trendy pubs, and bucket-and-spade shops on one side, and a palm-fringed beach on the other. If you’re staying over, there’s a wide range of accommodation on offer, from self-catering apartments to stylish villas and the old and gracious The Bay Hotel with its perfect views of Camps Bay beach. + +" + }, + "old" => + {"title" => "Old Biscuit Mill", + "picture" => "http://www.thewrendesign.com/wp-content/uploads/design-goods-market/biscuit-mill-1.jpg", + "map" => "https://www.google.co.za/maps/place/The+Old+Biscuit+Mill/@-33.9275533,18.4574846,17z/data=!3m1!4b1!4m2!3m1!1s0x1dcc5da6b46abd99:0x39cc47e5b0eb6340", + "description" => "Description: There are many markets in Cape Town, but one stands out head and shoulders above all others - The Old Biscuit Mill market in Woodstock. A wide range of food stalls, an excellent vibe, good music and did we mention the excellent wide range of foods? Tucked away in Woodstock, one of Cape Towns poorer suburbs, The Old Biscuit Mill market has managed to attract the young and trendy Cape Town crowd in their droves with an atmosphere similar to Borough Market in London. + +The food stalls represent a wide range of tastes from your standard sandwiches (nothing standard about them though), to Ostrich burgers, Greek kebabs, organic local foods, French food and a wide range of breads, cheeses and wines all locally produced in the Western Cape. Directly outside of the market you will find a treasure-trove of homeware shops that sell those obscure and never thought of knick-knacks that you never knew you needed untill you saw them! The market runs every Saturday what ever the weather from 9am till 2pm, be advised it can get extremely busy and at times finding a parking spot can be a problem so arrive early (before 10:30am) in order to get a decent parking spot." + }} + + @destination = places[place] + @name = @destination["title"] + @image_url = @destination["picture"] + @description = @destination["description"] + @map_url = @destination["map"] + end +end diff --git a/ChrisCahill-christophercahill/d7/capetownguide/app/controllers/welcome_controller.rb b/ChrisCahill-christophercahill/d7/capetownguide/app/controllers/welcome_controller.rb new file mode 100644 index 0000000..f9b859b --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/app/controllers/welcome_controller.rb @@ -0,0 +1,4 @@ +class WelcomeController < ApplicationController + def index + end +end diff --git a/ChrisCahill-christophercahill/d7/capetownguide/app/helpers/application_helper.rb b/ChrisCahill-christophercahill/d7/capetownguide/app/helpers/application_helper.rb new file mode 100644 index 0000000..de6be79 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/ChrisCahill-christophercahill/d7/capetownguide/app/helpers/places_helper.rb b/ChrisCahill-christophercahill/d7/capetownguide/app/helpers/places_helper.rb new file mode 100644 index 0000000..7d8d0ac --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/app/helpers/places_helper.rb @@ -0,0 +1,2 @@ +module PlacesHelper +end diff --git a/ChrisCahill-christophercahill/d7/capetownguide/app/helpers/welcome_helper.rb b/ChrisCahill-christophercahill/d7/capetownguide/app/helpers/welcome_helper.rb new file mode 100644 index 0000000..eeead45 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/app/helpers/welcome_helper.rb @@ -0,0 +1,2 @@ +module WelcomeHelper +end diff --git a/ChrisCahill-christophercahill/d7/capetownguide/app/mailers/.keep b/ChrisCahill-christophercahill/d7/capetownguide/app/mailers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d7/capetownguide/app/models/.keep b/ChrisCahill-christophercahill/d7/capetownguide/app/models/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d7/capetownguide/app/models/concerns/.keep b/ChrisCahill-christophercahill/d7/capetownguide/app/models/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d7/capetownguide/app/views/layouts/application.html.erb b/ChrisCahill-christophercahill/d7/capetownguide/app/views/layouts/application.html.erb new file mode 100644 index 0000000..061ddc2 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/app/views/layouts/application.html.erb @@ -0,0 +1,14 @@ + + + + Capetownguide + <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> + <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> + <%= csrf_meta_tags %> + + + +<%= yield %> + + + diff --git a/ChrisCahill-christophercahill/d7/capetownguide/app/views/places/index.html.erb b/ChrisCahill-christophercahill/d7/capetownguide/app/views/places/index.html.erb new file mode 100644 index 0000000..471f22c --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/app/views/places/index.html.erb @@ -0,0 +1,86 @@ + + + + + + +

Tourist Attractions in Cape Town

+

Click on any of the links below to find out more about each destination

+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+Home + diff --git a/ChrisCahill-christophercahill/d7/capetownguide/app/views/places/place.html.erb b/ChrisCahill-christophercahill/d7/capetownguide/app/views/places/place.html.erb new file mode 100644 index 0000000..687b318 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/app/views/places/place.html.erb @@ -0,0 +1,73 @@ + + + + + + + + +
+

<%= @name %>

+Click here to see the location on Google Maps +
+
+ +
+

<%= @description %>

+ + + \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d7/capetownguide/app/views/welcome/index.html.erb b/ChrisCahill-christophercahill/d7/capetownguide/app/views/welcome/index.html.erb new file mode 100644 index 0000000..9df2b8b --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/app/views/welcome/index.html.erb @@ -0,0 +1,62 @@ + + + + + + +

Welcome to Cape Town

+

A Brief Guide

+
+
+
+
+
+

"This cape is the most stately thing and the fairest cape we saw in the whole circumference of the earth" -Sir Francis Drake, 1580

+
+
+
+
+
+
+
+Attractions + \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d7/capetownguide/bin/bundle b/ChrisCahill-christophercahill/d7/capetownguide/bin/bundle new file mode 100755 index 0000000..66e9889 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/bin/bundle @@ -0,0 +1,3 @@ +#!/usr/bin/env ruby +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +load Gem.bin_path('bundler', 'bundle') diff --git a/ChrisCahill-christophercahill/d7/capetownguide/bin/rails b/ChrisCahill-christophercahill/d7/capetownguide/bin/rails new file mode 100755 index 0000000..4d608ed --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/bin/rails @@ -0,0 +1,8 @@ +#!/usr/bin/env ruby +begin + load File.expand_path("../spring", __FILE__) +rescue LoadError +end +APP_PATH = File.expand_path('../../config/application', __FILE__) +require_relative '../config/boot' +require 'rails/commands' diff --git a/ChrisCahill-christophercahill/d7/capetownguide/bin/rake b/ChrisCahill-christophercahill/d7/capetownguide/bin/rake new file mode 100755 index 0000000..8017a02 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/bin/rake @@ -0,0 +1,8 @@ +#!/usr/bin/env ruby +begin + load File.expand_path("../spring", __FILE__) +rescue LoadError +end +require_relative '../config/boot' +require 'rake' +Rake.application.run diff --git a/ChrisCahill-christophercahill/d7/capetownguide/bin/setup b/ChrisCahill-christophercahill/d7/capetownguide/bin/setup new file mode 100755 index 0000000..acdb2c1 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/bin/setup @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +require 'pathname' + +# path to your application root. +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) + +Dir.chdir APP_ROOT do + # This script is a starting point to setup your application. + # Add necessary setup steps to this file: + + puts "== Installing dependencies ==" + system "gem install bundler --conservative" + system "bundle check || bundle install" + + # puts "\n== Copying sample files ==" + # unless File.exist?("config/database.yml") + # system "cp config/database.yml.sample config/database.yml" + # end + + puts "\n== Preparing database ==" + system "bin/rake db:setup" + + puts "\n== Removing old logs and tempfiles ==" + system "rm -f log/*" + system "rm -rf tmp/cache" + + puts "\n== Restarting application server ==" + system "touch tmp/restart.txt" +end diff --git a/ChrisCahill-christophercahill/d7/capetownguide/bin/spring b/ChrisCahill-christophercahill/d7/capetownguide/bin/spring new file mode 100755 index 0000000..7b45d37 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/bin/spring @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby + +# This file loads spring without using Bundler, in order to be fast. +# It gets overwritten when you run the `spring binstub` command. + +unless defined?(Spring) + require "rubygems" + require "bundler" + + if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m) + Gem.paths = { "GEM_PATH" => [Bundler.bundle_path.to_s, *Gem.path].uniq } + gem "spring", match[1] + require "spring/binstub" + end +end diff --git a/ChrisCahill-christophercahill/d7/capetownguide/config.ru b/ChrisCahill-christophercahill/d7/capetownguide/config.ru new file mode 100644 index 0000000..bd83b25 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/config.ru @@ -0,0 +1,4 @@ +# This file is used by Rack-based servers to start the application. + +require ::File.expand_path('../config/environment', __FILE__) +run Rails.application diff --git a/ChrisCahill-christophercahill/d7/capetownguide/config/application.rb b/ChrisCahill-christophercahill/d7/capetownguide/config/application.rb new file mode 100644 index 0000000..a91704a --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/config/application.rb @@ -0,0 +1,26 @@ +require File.expand_path('../boot', __FILE__) + +require 'rails/all' + +# Require the gems listed in Gemfile, including any gems +# you've limited to :test, :development, or :production. +Bundler.require(*Rails.groups) + +module Capetownguide + class Application < Rails::Application + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. + # config.time_zone = 'Central Time (US & Canada)' + + # 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 + + # Do not swallow errors in after_commit/after_rollback callbacks. + config.active_record.raise_in_transactional_callbacks = true + end +end diff --git a/ChrisCahill-christophercahill/d7/capetownguide/config/boot.rb b/ChrisCahill-christophercahill/d7/capetownguide/config/boot.rb new file mode 100644 index 0000000..6b750f0 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/config/boot.rb @@ -0,0 +1,3 @@ +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) + +require 'bundler/setup' # Set up gems listed in the Gemfile. diff --git a/ChrisCahill-christophercahill/d7/capetownguide/config/database.yml b/ChrisCahill-christophercahill/d7/capetownguide/config/database.yml new file mode 100644 index 0000000..1c1a37c --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/config/database.yml @@ -0,0 +1,25 @@ +# SQLite version 3.x +# gem install sqlite3 +# +# Ensure the SQLite 3 gem is defined in your Gemfile +# gem 'sqlite3' +# +default: &default + adapter: sqlite3 + pool: 5 + timeout: 5000 + +development: + <<: *default + database: db/development.sqlite3 + +# Warning: The database defined as "test" will be erased and +# re-generated from your development database when you run "rake". +# Do not set this db to the same as development or production. +test: + <<: *default + database: db/test.sqlite3 + +production: + <<: *default + database: db/production.sqlite3 diff --git a/ChrisCahill-christophercahill/d7/capetownguide/config/environment.rb b/ChrisCahill-christophercahill/d7/capetownguide/config/environment.rb new file mode 100644 index 0000000..ee8d90d --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/config/environment.rb @@ -0,0 +1,5 @@ +# Load the Rails application. +require File.expand_path('../application', __FILE__) + +# Initialize the Rails application. +Rails.application.initialize! diff --git a/ChrisCahill-christophercahill/d7/capetownguide/config/environments/development.rb b/ChrisCahill-christophercahill/d7/capetownguide/config/environments/development.rb new file mode 100644 index 0000000..b55e214 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/config/environments/development.rb @@ -0,0 +1,41 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # In the development environment your application's code is reloaded on + # every request. This slows down response time but is perfect for development + # since you don't have to restart the web server when you make code changes. + config.cache_classes = false + + # Do not eager load code on boot. + config.eager_load = false + + # Show full error reports and disable caching. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Don't care if the mailer can't send. + config.action_mailer.raise_delivery_errors = false + + # Print deprecation notices to the Rails logger. + config.active_support.deprecation = :log + + # Raise an error on page load if there are pending migrations. + config.active_record.migration_error = :page_load + + # Debug mode disables concatenation and preprocessing of assets. + # This option may cause significant delays in view rendering with a large + # number of complex assets. + config.assets.debug = true + + # Asset digests allow you to set far-future HTTP expiration dates on all assets, + # yet still be able to expire them through the digest params. + config.assets.digest = true + + # Adds additional error checking when serving assets at runtime. + # Checks for improperly declared sprockets dependencies. + # Raises helpful error messages. + config.assets.raise_runtime_errors = true + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true +end diff --git a/ChrisCahill-christophercahill/d7/capetownguide/config/environments/production.rb b/ChrisCahill-christophercahill/d7/capetownguide/config/environments/production.rb new file mode 100644 index 0000000..5c1b32e --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/config/environments/production.rb @@ -0,0 +1,79 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # Code is not reloaded between requests. + config.cache_classes = true + + # Eager load code on boot. This eager loads most of Rails and + # your application in memory, allowing both threaded web servers + # and those relying on copy on write to perform better. + # Rake tasks automatically ignore this option for performance. + config.eager_load = true + + # Full error reports are disabled and caching is turned on. + config.consider_all_requests_local = false + config.action_controller.perform_caching = true + + # Enable Rack::Cache to put a simple HTTP cache in front of your application + # Add `rack-cache` to your Gemfile before enabling this. + # For large-scale production use, consider using a caching reverse proxy like + # NGINX, varnish or squid. + # config.action_dispatch.rack_cache = true + + # Disable serving static files from the `/public` folder by default since + # Apache or NGINX already handles this. + config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? + + # Compress JavaScripts and CSS. + config.assets.js_compressor = :uglifier + # config.assets.css_compressor = :sass + + # Do not fallback to assets pipeline if a precompiled asset is missed. + config.assets.compile = false + + # Asset digests allow you to set far-future HTTP expiration dates on all assets, + # yet still be able to expire them through the digest params. + config.assets.digest = true + + # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb + + # Specifies the header that your server uses for sending files. + # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # Use the lowest log level to ensure availability of diagnostic information + # when problems arise. + config.log_level = :debug + + # Prepend all log lines with the following tags. + # config.log_tags = [ :subdomain, :uuid ] + + # Use a different logger for distributed setups. + # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + + # Use a different cache store in production. + # config.cache_store = :mem_cache_store + + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.action_controller.asset_host = 'http://assets.example.com' + + # Ignore bad email addresses and do not raise email delivery errors. + # Set this to true and configure the email server for immediate delivery to raise delivery errors. + # config.action_mailer.raise_delivery_errors = false + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation cannot be found). + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners. + config.active_support.deprecation = :notify + + # Use default logging formatter so that PID and timestamp are not suppressed. + config.log_formatter = ::Logger::Formatter.new + + # Do not dump schema after migrations. + config.active_record.dump_schema_after_migration = false +end diff --git a/ChrisCahill-christophercahill/d7/capetownguide/config/environments/test.rb b/ChrisCahill-christophercahill/d7/capetownguide/config/environments/test.rb new file mode 100644 index 0000000..1c19f08 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/config/environments/test.rb @@ -0,0 +1,42 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # The test environment is used exclusively to run your application's + # test suite. You never need to work with it otherwise. Remember that + # your test database is "scratch space" for the test suite and is wiped + # and recreated between test runs. Don't rely on the data there! + config.cache_classes = true + + # Do not eager load code on boot. This avoids loading your whole application + # just for the purpose of running a single test. If you are using a tool that + # preloads Rails for running tests, you may have to set it to true. + config.eager_load = false + + # Configure static file server for tests with Cache-Control for performance. + config.serve_static_files = true + config.static_cache_control = 'public, max-age=3600' + + # Show full error reports and disable caching. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Raise exceptions instead of rendering exception templates. + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment. + config.action_controller.allow_forgery_protection = false + + # Tell Action Mailer not to deliver emails to the real world. + # The :test delivery method accumulates sent emails in the + # ActionMailer::Base.deliveries array. + config.action_mailer.delivery_method = :test + + # Randomize the order test cases are executed. + config.active_support.test_order = :random + + # Print deprecation notices to the stderr. + config.active_support.deprecation = :stderr + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true +end diff --git a/ChrisCahill-christophercahill/d7/capetownguide/config/initializers/assets.rb b/ChrisCahill-christophercahill/d7/capetownguide/config/initializers/assets.rb new file mode 100644 index 0000000..01ef3e6 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/config/initializers/assets.rb @@ -0,0 +1,11 @@ +# Be sure to restart your server when you modify this file. + +# Version of your assets, change this if you want to expire all your assets. +Rails.application.config.assets.version = '1.0' + +# Add additional assets to the asset load path +# Rails.application.config.assets.paths << Emoji.images_path + +# Precompile additional assets. +# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. +# Rails.application.config.assets.precompile += %w( search.js ) diff --git a/ChrisCahill-christophercahill/d7/capetownguide/config/initializers/backtrace_silencers.rb b/ChrisCahill-christophercahill/d7/capetownguide/config/initializers/backtrace_silencers.rb new file mode 100644 index 0000000..59385cd --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/config/initializers/backtrace_silencers.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. +# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } + +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. +# Rails.backtrace_cleaner.remove_silencers! diff --git a/ChrisCahill-christophercahill/d7/capetownguide/config/initializers/cookies_serializer.rb b/ChrisCahill-christophercahill/d7/capetownguide/config/initializers/cookies_serializer.rb new file mode 100644 index 0000000..7f70458 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/config/initializers/cookies_serializer.rb @@ -0,0 +1,3 @@ +# Be sure to restart your server when you modify this file. + +Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/ChrisCahill-christophercahill/d7/capetownguide/config/initializers/filter_parameter_logging.rb b/ChrisCahill-christophercahill/d7/capetownguide/config/initializers/filter_parameter_logging.rb new file mode 100644 index 0000000..4a994e1 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/config/initializers/filter_parameter_logging.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Configure sensitive parameters which will be filtered from the log file. +Rails.application.config.filter_parameters += [:password] diff --git a/ChrisCahill-christophercahill/d7/capetownguide/config/initializers/inflections.rb b/ChrisCahill-christophercahill/d7/capetownguide/config/initializers/inflections.rb new file mode 100644 index 0000000..ac033bf --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/config/initializers/inflections.rb @@ -0,0 +1,16 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format. Inflections +# are locale specific, and you may define rules for as many different +# locales as you wish. All of these examples are active by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.plural /^(ox)$/i, '\1en' +# inflect.singular /^(ox)en/i, '\1' +# inflect.irregular 'person', 'people' +# inflect.uncountable %w( fish sheep ) +# end + +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.acronym 'RESTful' +# end diff --git a/ChrisCahill-christophercahill/d7/capetownguide/config/initializers/mime_types.rb b/ChrisCahill-christophercahill/d7/capetownguide/config/initializers/mime_types.rb new file mode 100644 index 0000000..dc18996 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/config/initializers/mime_types.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Add new mime types for use in respond_to blocks: +# Mime::Type.register "text/richtext", :rtf diff --git a/ChrisCahill-christophercahill/d7/capetownguide/config/initializers/session_store.rb b/ChrisCahill-christophercahill/d7/capetownguide/config/initializers/session_store.rb new file mode 100644 index 0000000..321264e --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/config/initializers/session_store.rb @@ -0,0 +1,3 @@ +# Be sure to restart your server when you modify this file. + +Rails.application.config.session_store :cookie_store, key: '_capetownguide_session' diff --git a/ChrisCahill-christophercahill/d7/capetownguide/config/initializers/wrap_parameters.rb b/ChrisCahill-christophercahill/d7/capetownguide/config/initializers/wrap_parameters.rb new file mode 100644 index 0000000..33725e9 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/config/initializers/wrap_parameters.rb @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. + +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActiveSupport.on_load(:action_controller) do + wrap_parameters format: [:json] if respond_to?(:wrap_parameters) +end + +# To enable root element in JSON for ActiveRecord objects. +# ActiveSupport.on_load(:active_record) do +# self.include_root_in_json = true +# end diff --git a/ChrisCahill-christophercahill/d7/capetownguide/config/locales/en.yml b/ChrisCahill-christophercahill/d7/capetownguide/config/locales/en.yml new file mode 100644 index 0000000..0653957 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/config/locales/en.yml @@ -0,0 +1,23 @@ +# Files in the config/locales directory are used for internationalization +# and are automatically loaded by Rails. If you want to use locales other +# than English, add the necessary files in this directory. +# +# To use the locales, use `I18n.t`: +# +# I18n.t 'hello' +# +# In views, this is aliased to just `t`: +# +# <%= t('hello') %> +# +# To use a different locale, set it with `I18n.locale`: +# +# I18n.locale = :es +# +# This would use the information in config/locales/es.yml. +# +# To learn more, please read the Rails Internationalization guide +# available at http://guides.rubyonrails.org/i18n.html. + +en: + hello: "Hello world" diff --git a/ChrisCahill-christophercahill/d7/capetownguide/config/routes.rb b/ChrisCahill-christophercahill/d7/capetownguide/config/routes.rb new file mode 100644 index 0000000..2813b47 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/config/routes.rb @@ -0,0 +1,62 @@ +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" + + get 'welcome/index' + root 'welcome#index' + + get "/places", to: "places#index" + get "/places/:place", to: "places#place", as: "place" + + # 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 +end diff --git a/ChrisCahill-christophercahill/d7/capetownguide/config/secrets.yml b/ChrisCahill-christophercahill/d7/capetownguide/config/secrets.yml new file mode 100644 index 0000000..efa634d --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/config/secrets.yml @@ -0,0 +1,22 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key is used for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! + +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +# You can use `rake secret` to generate a secure secret key. + +# Make sure the secrets in this file are kept private +# if you're sharing your code publicly. + +development: + secret_key_base: 0dcd5b17bc43d7384f59fdbf1c3fb95bc458c5fa28d8d08709ddabf218529ed86ed73045f00e94fcb20e34fb5dd4d88ac061c2eb17ad6e8d8151812e2953bfe7 + +test: + secret_key_base: ae7eebab16f5010e8f10135cadcbc8edc48bad1f33f80ca0cba28a05a6581aa117355b7be55104953dc8042c8fd057064f369d5a2adf44aa3c0ca3167431e4f2 + +# Do not keep production secrets in the repository, +# instead read values from the environment. +production: + secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> diff --git a/ChrisCahill-christophercahill/d7/capetownguide/db/seeds.rb b/ChrisCahill-christophercahill/d7/capetownguide/db/seeds.rb new file mode 100644 index 0000000..4edb1e8 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/db/seeds.rb @@ -0,0 +1,7 @@ +# This file should contain all the record creation needed to seed the database with its default values. +# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). +# +# Examples: +# +# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) +# Mayor.create(name: 'Emanuel', city: cities.first) diff --git a/ChrisCahill-christophercahill/d7/capetownguide/lib/assets/.keep b/ChrisCahill-christophercahill/d7/capetownguide/lib/assets/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d7/capetownguide/lib/tasks/.keep b/ChrisCahill-christophercahill/d7/capetownguide/lib/tasks/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d7/capetownguide/log/.keep b/ChrisCahill-christophercahill/d7/capetownguide/log/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d7/capetownguide/public/404.html b/ChrisCahill-christophercahill/d7/capetownguide/public/404.html new file mode 100644 index 0000000..b612547 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/public/404.html @@ -0,0 +1,67 @@ + + + + The page you were looking for doesn't exist (404) + + + + + + +
+
+

The page you were looking for doesn't exist.

+

You may have mistyped the address or the page may have moved.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/ChrisCahill-christophercahill/d7/capetownguide/public/422.html b/ChrisCahill-christophercahill/d7/capetownguide/public/422.html new file mode 100644 index 0000000..a21f82b --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/public/422.html @@ -0,0 +1,67 @@ + + + + The change you wanted was rejected (422) + + + + + + +
+
+

The change you wanted was rejected.

+

Maybe you tried to change something you didn't have access to.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/ChrisCahill-christophercahill/d7/capetownguide/public/500.html b/ChrisCahill-christophercahill/d7/capetownguide/public/500.html new file mode 100644 index 0000000..061abc5 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/public/500.html @@ -0,0 +1,66 @@ + + + + We're sorry, but something went wrong (500) + + + + + + +
+
+

We're sorry, but something went wrong.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/ChrisCahill-christophercahill/d7/capetownguide/public/favicon.ico b/ChrisCahill-christophercahill/d7/capetownguide/public/favicon.ico new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d7/capetownguide/public/robots.txt b/ChrisCahill-christophercahill/d7/capetownguide/public/robots.txt new file mode 100644 index 0000000..3c9c7c0 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/public/robots.txt @@ -0,0 +1,5 @@ +# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file +# +# To ban all spiders from the entire site uncomment the next two lines: +# User-agent: * +# Disallow: / diff --git a/ChrisCahill-christophercahill/d7/capetownguide/test/controllers/.keep b/ChrisCahill-christophercahill/d7/capetownguide/test/controllers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d7/capetownguide/test/controllers/places_controller_test.rb b/ChrisCahill-christophercahill/d7/capetownguide/test/controllers/places_controller_test.rb new file mode 100644 index 0000000..74549c3 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/test/controllers/places_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PlacesControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/ChrisCahill-christophercahill/d7/capetownguide/test/controllers/welcome_controller_test.rb b/ChrisCahill-christophercahill/d7/capetownguide/test/controllers/welcome_controller_test.rb new file mode 100644 index 0000000..dff8e9d --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/test/controllers/welcome_controller_test.rb @@ -0,0 +1,9 @@ +require 'test_helper' + +class WelcomeControllerTest < ActionController::TestCase + test "should get index" do + get :index + assert_response :success + end + +end diff --git a/ChrisCahill-christophercahill/d7/capetownguide/test/fixtures/.keep b/ChrisCahill-christophercahill/d7/capetownguide/test/fixtures/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d7/capetownguide/test/helpers/.keep b/ChrisCahill-christophercahill/d7/capetownguide/test/helpers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d7/capetownguide/test/integration/.keep b/ChrisCahill-christophercahill/d7/capetownguide/test/integration/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d7/capetownguide/test/mailers/.keep b/ChrisCahill-christophercahill/d7/capetownguide/test/mailers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d7/capetownguide/test/models/.keep b/ChrisCahill-christophercahill/d7/capetownguide/test/models/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d7/capetownguide/test/test_helper.rb b/ChrisCahill-christophercahill/d7/capetownguide/test/test_helper.rb new file mode 100644 index 0000000..92e39b2 --- /dev/null +++ b/ChrisCahill-christophercahill/d7/capetownguide/test/test_helper.rb @@ -0,0 +1,10 @@ +ENV['RAILS_ENV'] ||= 'test' +require File.expand_path('../../config/environment', __FILE__) +require 'rails/test_help' + +class ActiveSupport::TestCase + # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. + fixtures :all + + # Add more helper methods to be used by all tests here... +end diff --git a/ChrisCahill-christophercahill/d7/capetownguide/vendor/assets/javascripts/.keep b/ChrisCahill-christophercahill/d7/capetownguide/vendor/assets/javascripts/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d7/capetownguide/vendor/assets/stylesheets/.keep b/ChrisCahill-christophercahill/d7/capetownguide/vendor/assets/stylesheets/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d8/answers.md b/ChrisCahill-christophercahill/d8/answers.md new file mode 100644 index 0000000..bead0eb --- /dev/null +++ b/ChrisCahill-christophercahill/d8/answers.md @@ -0,0 +1,10 @@ +1. There are 17 routes, as determined via rake routes. +2. There are two models, treasure and comment. +3. There are three controllers, the application controller, the comments controller, and the treasures controller. +4. The CRUD logic takes place in the controllers (and their methods). +5. app/views/treasures/new.html.erb is seemingly the view that creates a new treasure. However, in the treasure controller, there is a def create ... end that actually creates the treasure as well. Regardless, treasures/new.html.erb is the view I think. +6. the _comment.html.erb file in app/views/comments has HTML for the comment to be added. +7. The index.html.erb in treasures. +8. The index.html.erb in treasures also shows all the treasures. +9. Treasure has title, description and updated/created at. Comment has those last two and an id, string (bru), and text. +10. The schema.rb file in db. \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d8/cheetah_watch b/ChrisCahill-christophercahill/d8/cheetah_watch new file mode 160000 index 0000000..33bbd34 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/cheetah_watch @@ -0,0 +1 @@ +Subproject commit 33bbd3432f5f20ff15f40f99d85dc2068535ce7d diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/.gitignore b/ChrisCahill-christophercahill/d8/lekker_plekke/.gitignore new file mode 100644 index 0000000..050c9d9 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/.gitignore @@ -0,0 +1,17 @@ +# See https://help.github.com/articles/ignoring-files for more about ignoring files. +# +# If you find yourself ignoring temporary files generated by your text editor +# or operating system, you probably want to add a global ignore instead: +# git config --global core.excludesfile '~/.gitignore_global' + +# Ignore bundler config. +/.bundle + +# Ignore the default SQLite database. +/db/*.sqlite3 +/db/*.sqlite3-journal + +# Ignore all logfiles and tempfiles. +/log/* +!/log/.keep +/tmp diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/Gemfile b/ChrisCahill-christophercahill/d8/lekker_plekke/Gemfile new file mode 100644 index 0000000..446f755 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/Gemfile @@ -0,0 +1,47 @@ +source 'https://rubygems.org' + + +# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' +gem 'rails', '4.2.1' +# Use sqlite3 as the database for Active Record +gem 'sqlite3' +# Use SCSS for stylesheets +gem 'sass-rails', '~> 5.0' +# Use Uglifier as compressor for JavaScript assets +gem 'uglifier', '>= 1.3.0' +# Use CoffeeScript for .coffee assets and views +gem 'coffee-rails', '~> 4.1.0' +# See https://github.com/rails/execjs#readme for more supported runtimes +# gem 'therubyracer', platforms: :ruby + +# Use jquery as the JavaScript library +gem 'jquery-rails' +# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks +gem 'turbolinks' +# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder +gem 'jbuilder', '~> 2.0' +# bundle exec rake doc:rails generates the API under doc/api. +gem 'sdoc', '~> 0.4.0', group: :doc + +# Use ActiveModel has_secure_password +# gem 'bcrypt', '~> 3.1.7' + +# Use Unicorn as the app server +# gem 'unicorn' + +# Use Capistrano for deployment +# gem 'capistrano-rails', group: :development + +group :development, :test do + # Call 'byebug' anywhere in the code to stop execution and get a debugger console + gem 'byebug' + + gem 'pry-rails' + + # Access an IRB console on exception pages or by using <%= console %> in views + gem 'web-console', '~> 2.0' + + # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring + gem 'spring' +end + diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/Gemfile.lock b/ChrisCahill-christophercahill/d8/lekker_plekke/Gemfile.lock new file mode 100644 index 0000000..315fbf3 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/Gemfile.lock @@ -0,0 +1,168 @@ +GEM + remote: https://rubygems.org/ + specs: + actionmailer (4.2.1) + actionpack (= 4.2.1) + actionview (= 4.2.1) + activejob (= 4.2.1) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 1.0, >= 1.0.5) + actionpack (4.2.1) + actionview (= 4.2.1) + activesupport (= 4.2.1) + rack (~> 1.6) + rack-test (~> 0.6.2) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.1) + actionview (4.2.1) + activesupport (= 4.2.1) + builder (~> 3.1) + erubis (~> 2.7.0) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.1) + activejob (4.2.1) + activesupport (= 4.2.1) + globalid (>= 0.3.0) + activemodel (4.2.1) + activesupport (= 4.2.1) + builder (~> 3.1) + activerecord (4.2.1) + activemodel (= 4.2.1) + activesupport (= 4.2.1) + arel (~> 6.0) + activesupport (4.2.1) + i18n (~> 0.7) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + arel (6.0.0) + binding_of_caller (0.7.2) + debug_inspector (>= 0.0.1) + builder (3.2.2) + byebug (5.0.0) + columnize (= 0.9.0) + coderay (1.1.0) + coffee-rails (4.1.0) + coffee-script (>= 2.2.0) + railties (>= 4.0.0, < 5.0) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.9.1.1) + columnize (0.9.0) + debug_inspector (0.0.2) + erubis (2.7.0) + execjs (2.5.2) + globalid (0.3.5) + activesupport (>= 4.1.0) + i18n (0.7.0) + jbuilder (2.3.0) + activesupport (>= 3.0.0, < 5) + multi_json (~> 1.2) + jquery-rails (4.0.4) + rails-dom-testing (~> 1.0) + railties (>= 4.2.0) + thor (>= 0.14, < 2.0) + json (1.8.3) + loofah (2.0.2) + nokogiri (>= 1.5.9) + mail (2.6.3) + mime-types (>= 1.16, < 3) + method_source (0.8.2) + mime-types (2.6.1) + mini_portile (0.6.2) + minitest (5.7.0) + multi_json (1.11.1) + nokogiri (1.6.6.2) + mini_portile (~> 0.6.0) + pry (0.10.1) + 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) + rails (4.2.1) + actionmailer (= 4.2.1) + actionpack (= 4.2.1) + actionview (= 4.2.1) + activejob (= 4.2.1) + activemodel (= 4.2.1) + activerecord (= 4.2.1) + activesupport (= 4.2.1) + bundler (>= 1.3.0, < 2.0) + railties (= 4.2.1) + sprockets-rails + rails-deprecated_sanitizer (1.0.3) + activesupport (>= 4.2.0.alpha) + rails-dom-testing (1.0.6) + activesupport (>= 4.2.0.beta, < 5.0) + nokogiri (~> 1.6.0) + rails-deprecated_sanitizer (>= 1.0.1) + rails-html-sanitizer (1.0.2) + loofah (~> 2.0) + railties (4.2.1) + actionpack (= 4.2.1) + activesupport (= 4.2.1) + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (10.4.2) + rdoc (4.2.0) + sass (3.4.15) + sass-rails (5.0.3) + railties (>= 4.0.0, < 5.0) + sass (~> 3.1) + sprockets (>= 2.8, < 4.0) + sprockets-rails (>= 2.0, < 4.0) + tilt (~> 1.1) + sdoc (0.4.1) + json (~> 1.7, >= 1.7.7) + rdoc (~> 4.0) + slop (3.6.0) + spring (1.3.6) + sprockets (3.2.0) + rack (~> 1.0) + sprockets-rails (2.3.2) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (>= 2.8, < 4.0) + sqlite3 (1.3.10) + thor (0.19.1) + thread_safe (0.3.5) + tilt (1.4.1) + turbolinks (2.5.3) + coffee-rails + tzinfo (1.2.2) + thread_safe (~> 0.1) + uglifier (2.7.1) + execjs (>= 0.3.0) + json (>= 1.8.0) + web-console (2.1.3) + activemodel (>= 4.0) + binding_of_caller (>= 0.7.2) + railties (>= 4.0) + sprockets-rails (>= 2.0, < 4.0) + +PLATFORMS + ruby + +DEPENDENCIES + byebug + coffee-rails (~> 4.1.0) + jbuilder (~> 2.0) + jquery-rails + pry-rails + rails (= 4.2.1) + sass-rails (~> 5.0) + sdoc (~> 0.4.0) + spring + sqlite3 + turbolinks + uglifier (>= 1.3.0) + web-console (~> 2.0) + +BUNDLED WITH + 1.10.3 diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/README.rdoc b/ChrisCahill-christophercahill/d8/lekker_plekke/README.rdoc new file mode 100644 index 0000000..dd4e97e --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/README.rdoc @@ -0,0 +1,28 @@ +== README + +This README would normally document whatever steps are necessary to get the +application up and running. + +Things you may want to cover: + +* Ruby version + +* System dependencies + +* Configuration + +* Database creation + +* Database initialization + +* How to run the test suite + +* Services (job queues, cache servers, search engines, etc.) + +* Deployment instructions + +* ... + + +Please feel free to use a different markup language if you do not plan to run +rake doc:app. diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/Rakefile b/ChrisCahill-christophercahill/d8/lekker_plekke/Rakefile new file mode 100644 index 0000000..ba6b733 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/Rakefile @@ -0,0 +1,6 @@ +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require File.expand_path('../config/application', __FILE__) + +Rails.application.load_tasks diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/app/assets/images/.keep b/ChrisCahill-christophercahill/d8/lekker_plekke/app/assets/images/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/app/assets/javascripts/application.js b/ChrisCahill-christophercahill/d8/lekker_plekke/app/assets/javascripts/application.js new file mode 100644 index 0000000..e07c5a8 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/app/assets/javascripts/application.js @@ -0,0 +1,16 @@ +// This is a manifest file that'll be compiled into application.js, which will include all the files +// listed below. +// +// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, +// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. +// +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// compiled file. +// +// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details +// about supported directives. +// +//= require jquery +//= require jquery_ujs +//= require turbolinks +//= require_tree . diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/app/assets/stylesheets/application.css b/ChrisCahill-christophercahill/d8/lekker_plekke/app/assets/stylesheets/application.css new file mode 100644 index 0000000..f9cd5b3 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/app/assets/stylesheets/application.css @@ -0,0 +1,15 @@ +/* + * This is a manifest file that'll be compiled into application.css, which will include all the files + * listed below. + * + * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, + * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. + * + * You're free to add application-wide styles to this file and they'll appear at the bottom of the + * compiled file so the styles you add here take precedence over styles defined in any styles + * defined in the other CSS/SCSS files in this directory. It is generally better to create a new + * file per style scope. + * + *= require_tree . + *= require_self + */ diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/app/controllers/application_controller.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/app/controllers/application_controller.rb new file mode 100644 index 0000000..d83690e --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/app/controllers/application_controller.rb @@ -0,0 +1,5 @@ +class ApplicationController < ActionController::Base + # Prevent CSRF attacks by raising an exception. + # For APIs, you may want to use :null_session instead. + protect_from_forgery with: :exception +end diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/app/controllers/comments_controller.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/app/controllers/comments_controller.rb new file mode 100644 index 0000000..1a263a8 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/app/controllers/comments_controller.rb @@ -0,0 +1,20 @@ +class CommentsController < ApplicationController + + def create + @place = Place.find(params[:place_id]) + @comment = @place.comments.create(comment_params) + redirect_to place_path(@place) + end + + def destroy + @place = Place.find(params[:place_id]) + @comment = @place.comments.find(params[:id]) + @comment.destroy + redirect_to place_path(@place) + end + + private + def comment_params + params.require(:comment).permit(:author, :text) + end +end \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/app/controllers/concerns/.keep b/ChrisCahill-christophercahill/d8/lekker_plekke/app/controllers/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/app/controllers/places_controller.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/app/controllers/places_controller.rb new file mode 100644 index 0000000..41ea4e7 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/app/controllers/places_controller.rb @@ -0,0 +1,50 @@ +class PlacesController < ApplicationController + def index + @places = Place.all + end + + def show + @place = Place.find params[:id] + end + + def new + @place = Place.new + end + + def edit + @place = Place.find(params[:id]) + end + + def create + @place = Place.new(place_params) + if @place.save + redirect_to @place + else + render 'new' + end + end + + def update + @place = Place.find(params[:id]) + + if @place.update(place_params) + redirect_to @place + else + render 'edit' + end + end + + def destroy + @place = Place.find(params[:id]) + @place.destroy + + redirect_to places_path + end + + private + + def place_params + params.require(:place).permit(:name, :description, :neighborhood, :funness) + end + +end \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/app/helpers/application_helper.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/app/helpers/application_helper.rb new file mode 100644 index 0000000..de6be79 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/app/mailers/.keep b/ChrisCahill-christophercahill/d8/lekker_plekke/app/mailers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/app/models/.keep b/ChrisCahill-christophercahill/d8/lekker_plekke/app/models/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/app/models/comment.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/app/models/comment.rb new file mode 100644 index 0000000..10b1c80 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/app/models/comment.rb @@ -0,0 +1,5 @@ +class Comment < ActiveRecord::Base + belongs_to :place + validates :text, presence: true + validates :author, presence: true +end diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/app/models/concerns/.keep b/ChrisCahill-christophercahill/d8/lekker_plekke/app/models/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/app/models/place.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/app/models/place.rb new file mode 100644 index 0000000..c89f9c1 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/app/models/place.rb @@ -0,0 +1,4 @@ +class Place < ActiveRecord::Base + has_many :comments, dependent: :destroy + validates :name, presence: true, uniqueness: {case_sensitive: false} +end diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/app/views/comments/_comment.html.erb b/ChrisCahill-christophercahill/d8/lekker_plekke/app/views/comments/_comment.html.erb new file mode 100644 index 0000000..7f95aed --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/app/views/comments/_comment.html.erb @@ -0,0 +1,15 @@ +

+ Author: + <%= comment.author %> +

+ +

+ Text: + <%= comment.text %> +

+ +

+ <%= link_to 'Destroy Comment', [comment.place, comment], + method: :delete, + data: { confirm: 'Are you sure?' } %> +

\ No newline at end of file diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/app/views/comments/_form.html.erb b/ChrisCahill-christophercahill/d8/lekker_plekke/app/views/comments/_form.html.erb new file mode 100644 index 0000000..3bcead6 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/app/views/comments/_form.html.erb @@ -0,0 +1,16 @@ +<%= form_for([@place, @place.comments.build]) do |f| %> + +

+ <%= f.label :author %>
+ <%= f.text_field :author %> +

+

+ <%= f.label :text %>
+ <%= f.text_area :text %> +

+ +

+ <%= f.submit %> +

+ +<% end %> \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/app/views/layouts/application.html.erb b/ChrisCahill-christophercahill/d8/lekker_plekke/app/views/layouts/application.html.erb new file mode 100644 index 0000000..c713e18 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/app/views/layouts/application.html.erb @@ -0,0 +1,14 @@ + + + + LekkerPlekke + <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> + <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> + <%= csrf_meta_tags %> + + + +<%= yield %> + + + diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/app/views/places/_form.html.erb b/ChrisCahill-christophercahill/d8/lekker_plekke/app/views/places/_form.html.erb new file mode 100644 index 0000000..1aa3300 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/app/views/places/_form.html.erb @@ -0,0 +1,41 @@ +<%= form_for @place do |f| %> + + <% if @place.errors.any? %> +
+

+ <%= pluralize(@place.errors.count, "error") %> prohibited + this place from being saved: +

+ +
+ <% end %> + +
+ <%= f.label :name %> + <%= f.text_field :name %> +
+ +
+ <%= f.label :description %> + <%= f.text_field :description %> +
+ +
+ <%= f.label :neighborhood%> + <%= f.text_field :neighborhood%> +
+ +
+ <%= f.label :funness%> + <%= f.text_field :funness%> +
+ +

+ <%= f.submit %> +

+ +<% end %> \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/app/views/places/edit.html.erb b/ChrisCahill-christophercahill/d8/lekker_plekke/app/views/places/edit.html.erb new file mode 100644 index 0000000..350c2c9 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/app/views/places/edit.html.erb @@ -0,0 +1,5 @@ +

Edit Place

+ +<%= render 'form' %> + +<%= link_to 'Back', places_path %> \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/app/views/places/index.html.erb b/ChrisCahill-christophercahill/d8/lekker_plekke/app/views/places/index.html.erb new file mode 100644 index 0000000..623d14e --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/app/views/places/index.html.erb @@ -0,0 +1,23 @@ +

Cape Town Guide

+

<%= link_to "New Place", new_place_path %>

+ + + + + + + + + <% @places.each do |place| %> + + + + + + + <% end %> +
Check out these lekker plekke!
<%= place.name %><%= link_to 'Show', place_path(place) %><%= link_to 'Edit', edit_place_path(place) %><%= link_to 'Destroy', place_path(place), + method: :delete, + data: { confirm: 'Are you sure?' } %>
+ + \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/app/views/places/new.html.erb b/ChrisCahill-christophercahill/d8/lekker_plekke/app/views/places/new.html.erb new file mode 100644 index 0000000..b38ea00 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/app/views/places/new.html.erb @@ -0,0 +1,27 @@ +<%= form_for @place do |f| %> + +
+ <%= f.label :name %> + <%= f.text_field :name %> +
+ +
+ <%= f.label :description %> + <%= f.text_field :description %> +
+ +
+ <%= f.label :neighborhood%> + <%= f.text_field :neighborhood%> +
+ +
+ <%= f.label :funness%> + <%= f.text_field :funness%> +
+ +

<%= f.submit %>

+ +<% end %> + +<%= link_to 'Back', places_path %> \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/app/views/places/show.html.erb b/ChrisCahill-christophercahill/d8/lekker_plekke/app/views/places/show.html.erb new file mode 100644 index 0000000..1f30573 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/app/views/places/show.html.erb @@ -0,0 +1,20 @@ +

<%= @place.name %>

+ +

A few fun facts about this cool place...

+ + + +

Comments

+<%= render @place.comments %> + +

Add a comment:

+<%= render 'comments/form' %> + +<%= link_to 'Edit', edit_place_path(@place) %> +<%= link_to 'Home', places_path %> + diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/bin/bundle b/ChrisCahill-christophercahill/d8/lekker_plekke/bin/bundle new file mode 100755 index 0000000..66e9889 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/bin/bundle @@ -0,0 +1,3 @@ +#!/usr/bin/env ruby +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +load Gem.bin_path('bundler', 'bundle') diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/bin/rails b/ChrisCahill-christophercahill/d8/lekker_plekke/bin/rails new file mode 100755 index 0000000..4d608ed --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/bin/rails @@ -0,0 +1,8 @@ +#!/usr/bin/env ruby +begin + load File.expand_path("../spring", __FILE__) +rescue LoadError +end +APP_PATH = File.expand_path('../../config/application', __FILE__) +require_relative '../config/boot' +require 'rails/commands' diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/bin/rake b/ChrisCahill-christophercahill/d8/lekker_plekke/bin/rake new file mode 100755 index 0000000..8017a02 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/bin/rake @@ -0,0 +1,8 @@ +#!/usr/bin/env ruby +begin + load File.expand_path("../spring", __FILE__) +rescue LoadError +end +require_relative '../config/boot' +require 'rake' +Rake.application.run diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/bin/setup b/ChrisCahill-christophercahill/d8/lekker_plekke/bin/setup new file mode 100755 index 0000000..acdb2c1 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/bin/setup @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +require 'pathname' + +# path to your application root. +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) + +Dir.chdir APP_ROOT do + # This script is a starting point to setup your application. + # Add necessary setup steps to this file: + + puts "== Installing dependencies ==" + system "gem install bundler --conservative" + system "bundle check || bundle install" + + # puts "\n== Copying sample files ==" + # unless File.exist?("config/database.yml") + # system "cp config/database.yml.sample config/database.yml" + # end + + puts "\n== Preparing database ==" + system "bin/rake db:setup" + + puts "\n== Removing old logs and tempfiles ==" + system "rm -f log/*" + system "rm -rf tmp/cache" + + puts "\n== Restarting application server ==" + system "touch tmp/restart.txt" +end diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/bin/spring b/ChrisCahill-christophercahill/d8/lekker_plekke/bin/spring new file mode 100755 index 0000000..7b45d37 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/bin/spring @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby + +# This file loads spring without using Bundler, in order to be fast. +# It gets overwritten when you run the `spring binstub` command. + +unless defined?(Spring) + require "rubygems" + require "bundler" + + if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m) + Gem.paths = { "GEM_PATH" => [Bundler.bundle_path.to_s, *Gem.path].uniq } + gem "spring", match[1] + require "spring/binstub" + end +end diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/config.ru b/ChrisCahill-christophercahill/d8/lekker_plekke/config.ru new file mode 100644 index 0000000..bd83b25 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/config.ru @@ -0,0 +1,4 @@ +# This file is used by Rack-based servers to start the application. + +require ::File.expand_path('../config/environment', __FILE__) +run Rails.application diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/config/application.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/config/application.rb new file mode 100644 index 0000000..a3c8f2e --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/config/application.rb @@ -0,0 +1,26 @@ +require File.expand_path('../boot', __FILE__) + +require 'rails/all' + +# Require the gems listed in Gemfile, including any gems +# you've limited to :test, :development, or :production. +Bundler.require(*Rails.groups) + +module LekkerPlekke + class Application < Rails::Application + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. + # config.time_zone = 'Central Time (US & Canada)' + + # 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 + + # Do not swallow errors in after_commit/after_rollback callbacks. + config.active_record.raise_in_transactional_callbacks = true + end +end diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/config/boot.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/config/boot.rb new file mode 100644 index 0000000..6b750f0 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/config/boot.rb @@ -0,0 +1,3 @@ +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) + +require 'bundler/setup' # Set up gems listed in the Gemfile. diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/config/database.yml b/ChrisCahill-christophercahill/d8/lekker_plekke/config/database.yml new file mode 100644 index 0000000..1c1a37c --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/config/database.yml @@ -0,0 +1,25 @@ +# SQLite version 3.x +# gem install sqlite3 +# +# Ensure the SQLite 3 gem is defined in your Gemfile +# gem 'sqlite3' +# +default: &default + adapter: sqlite3 + pool: 5 + timeout: 5000 + +development: + <<: *default + database: db/development.sqlite3 + +# Warning: The database defined as "test" will be erased and +# re-generated from your development database when you run "rake". +# Do not set this db to the same as development or production. +test: + <<: *default + database: db/test.sqlite3 + +production: + <<: *default + database: db/production.sqlite3 diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/config/environment.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/config/environment.rb new file mode 100644 index 0000000..ee8d90d --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/config/environment.rb @@ -0,0 +1,5 @@ +# Load the Rails application. +require File.expand_path('../application', __FILE__) + +# Initialize the Rails application. +Rails.application.initialize! diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/config/environments/development.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/config/environments/development.rb new file mode 100644 index 0000000..b55e214 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/config/environments/development.rb @@ -0,0 +1,41 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # In the development environment your application's code is reloaded on + # every request. This slows down response time but is perfect for development + # since you don't have to restart the web server when you make code changes. + config.cache_classes = false + + # Do not eager load code on boot. + config.eager_load = false + + # Show full error reports and disable caching. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Don't care if the mailer can't send. + config.action_mailer.raise_delivery_errors = false + + # Print deprecation notices to the Rails logger. + config.active_support.deprecation = :log + + # Raise an error on page load if there are pending migrations. + config.active_record.migration_error = :page_load + + # Debug mode disables concatenation and preprocessing of assets. + # This option may cause significant delays in view rendering with a large + # number of complex assets. + config.assets.debug = true + + # Asset digests allow you to set far-future HTTP expiration dates on all assets, + # yet still be able to expire them through the digest params. + config.assets.digest = true + + # Adds additional error checking when serving assets at runtime. + # Checks for improperly declared sprockets dependencies. + # Raises helpful error messages. + config.assets.raise_runtime_errors = true + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true +end diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/config/environments/production.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/config/environments/production.rb new file mode 100644 index 0000000..5c1b32e --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/config/environments/production.rb @@ -0,0 +1,79 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # Code is not reloaded between requests. + config.cache_classes = true + + # Eager load code on boot. This eager loads most of Rails and + # your application in memory, allowing both threaded web servers + # and those relying on copy on write to perform better. + # Rake tasks automatically ignore this option for performance. + config.eager_load = true + + # Full error reports are disabled and caching is turned on. + config.consider_all_requests_local = false + config.action_controller.perform_caching = true + + # Enable Rack::Cache to put a simple HTTP cache in front of your application + # Add `rack-cache` to your Gemfile before enabling this. + # For large-scale production use, consider using a caching reverse proxy like + # NGINX, varnish or squid. + # config.action_dispatch.rack_cache = true + + # Disable serving static files from the `/public` folder by default since + # Apache or NGINX already handles this. + config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? + + # Compress JavaScripts and CSS. + config.assets.js_compressor = :uglifier + # config.assets.css_compressor = :sass + + # Do not fallback to assets pipeline if a precompiled asset is missed. + config.assets.compile = false + + # Asset digests allow you to set far-future HTTP expiration dates on all assets, + # yet still be able to expire them through the digest params. + config.assets.digest = true + + # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb + + # Specifies the header that your server uses for sending files. + # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # Use the lowest log level to ensure availability of diagnostic information + # when problems arise. + config.log_level = :debug + + # Prepend all log lines with the following tags. + # config.log_tags = [ :subdomain, :uuid ] + + # Use a different logger for distributed setups. + # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + + # Use a different cache store in production. + # config.cache_store = :mem_cache_store + + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.action_controller.asset_host = 'http://assets.example.com' + + # Ignore bad email addresses and do not raise email delivery errors. + # Set this to true and configure the email server for immediate delivery to raise delivery errors. + # config.action_mailer.raise_delivery_errors = false + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation cannot be found). + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners. + config.active_support.deprecation = :notify + + # Use default logging formatter so that PID and timestamp are not suppressed. + config.log_formatter = ::Logger::Formatter.new + + # Do not dump schema after migrations. + config.active_record.dump_schema_after_migration = false +end diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/config/environments/test.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/config/environments/test.rb new file mode 100644 index 0000000..1c19f08 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/config/environments/test.rb @@ -0,0 +1,42 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # The test environment is used exclusively to run your application's + # test suite. You never need to work with it otherwise. Remember that + # your test database is "scratch space" for the test suite and is wiped + # and recreated between test runs. Don't rely on the data there! + config.cache_classes = true + + # Do not eager load code on boot. This avoids loading your whole application + # just for the purpose of running a single test. If you are using a tool that + # preloads Rails for running tests, you may have to set it to true. + config.eager_load = false + + # Configure static file server for tests with Cache-Control for performance. + config.serve_static_files = true + config.static_cache_control = 'public, max-age=3600' + + # Show full error reports and disable caching. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Raise exceptions instead of rendering exception templates. + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment. + config.action_controller.allow_forgery_protection = false + + # Tell Action Mailer not to deliver emails to the real world. + # The :test delivery method accumulates sent emails in the + # ActionMailer::Base.deliveries array. + config.action_mailer.delivery_method = :test + + # Randomize the order test cases are executed. + config.active_support.test_order = :random + + # Print deprecation notices to the stderr. + config.active_support.deprecation = :stderr + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true +end diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/config/initializers/assets.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/config/initializers/assets.rb new file mode 100644 index 0000000..01ef3e6 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/config/initializers/assets.rb @@ -0,0 +1,11 @@ +# Be sure to restart your server when you modify this file. + +# Version of your assets, change this if you want to expire all your assets. +Rails.application.config.assets.version = '1.0' + +# Add additional assets to the asset load path +# Rails.application.config.assets.paths << Emoji.images_path + +# Precompile additional assets. +# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. +# Rails.application.config.assets.precompile += %w( search.js ) diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/config/initializers/backtrace_silencers.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/config/initializers/backtrace_silencers.rb new file mode 100644 index 0000000..59385cd --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/config/initializers/backtrace_silencers.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. +# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } + +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. +# Rails.backtrace_cleaner.remove_silencers! diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/config/initializers/cookies_serializer.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/config/initializers/cookies_serializer.rb new file mode 100644 index 0000000..7f70458 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/config/initializers/cookies_serializer.rb @@ -0,0 +1,3 @@ +# Be sure to restart your server when you modify this file. + +Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/config/initializers/filter_parameter_logging.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/config/initializers/filter_parameter_logging.rb new file mode 100644 index 0000000..4a994e1 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/config/initializers/filter_parameter_logging.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Configure sensitive parameters which will be filtered from the log file. +Rails.application.config.filter_parameters += [:password] diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/config/initializers/inflections.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/config/initializers/inflections.rb new file mode 100644 index 0000000..ac033bf --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/config/initializers/inflections.rb @@ -0,0 +1,16 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format. Inflections +# are locale specific, and you may define rules for as many different +# locales as you wish. All of these examples are active by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.plural /^(ox)$/i, '\1en' +# inflect.singular /^(ox)en/i, '\1' +# inflect.irregular 'person', 'people' +# inflect.uncountable %w( fish sheep ) +# end + +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.acronym 'RESTful' +# end diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/config/initializers/mime_types.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/config/initializers/mime_types.rb new file mode 100644 index 0000000..dc18996 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/config/initializers/mime_types.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Add new mime types for use in respond_to blocks: +# Mime::Type.register "text/richtext", :rtf diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/config/initializers/session_store.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/config/initializers/session_store.rb new file mode 100644 index 0000000..d520510 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/config/initializers/session_store.rb @@ -0,0 +1,3 @@ +# Be sure to restart your server when you modify this file. + +Rails.application.config.session_store :cookie_store, key: '_lekker_plekke_session' diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/config/initializers/wrap_parameters.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/config/initializers/wrap_parameters.rb new file mode 100644 index 0000000..33725e9 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/config/initializers/wrap_parameters.rb @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. + +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActiveSupport.on_load(:action_controller) do + wrap_parameters format: [:json] if respond_to?(:wrap_parameters) +end + +# To enable root element in JSON for ActiveRecord objects. +# ActiveSupport.on_load(:active_record) do +# self.include_root_in_json = true +# end diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/config/locales/en.yml b/ChrisCahill-christophercahill/d8/lekker_plekke/config/locales/en.yml new file mode 100644 index 0000000..0653957 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/config/locales/en.yml @@ -0,0 +1,23 @@ +# Files in the config/locales directory are used for internationalization +# and are automatically loaded by Rails. If you want to use locales other +# than English, add the necessary files in this directory. +# +# To use the locales, use `I18n.t`: +# +# I18n.t 'hello' +# +# In views, this is aliased to just `t`: +# +# <%= t('hello') %> +# +# To use a different locale, set it with `I18n.locale`: +# +# I18n.locale = :es +# +# This would use the information in config/locales/es.yml. +# +# To learn more, please read the Rails Internationalization guide +# available at http://guides.rubyonrails.org/i18n.html. + +en: + hello: "Hello world" diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/config/routes.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/config/routes.rb new file mode 100644 index 0000000..cc5ce62 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/config/routes.rb @@ -0,0 +1,60 @@ +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". + + resources :places do + resources :comments + end + + # 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 +end diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/config/secrets.yml b/ChrisCahill-christophercahill/d8/lekker_plekke/config/secrets.yml new file mode 100644 index 0000000..de99c9d --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/config/secrets.yml @@ -0,0 +1,22 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key is used for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! + +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +# You can use `rake secret` to generate a secure secret key. + +# Make sure the secrets in this file are kept private +# if you're sharing your code publicly. + +development: + secret_key_base: 963389b3ab732a61c52ffeb93e5bc8ef37c781537923c3f225e3de901dcc2de26637be4f6708c0891ba4e626afd5d50b2c0be3e6f67b9983e7da0682d4ae9367 + +test: + secret_key_base: a52b590099b870548959b8ecc99740abc9134c9dc9d96d55b5a1eaf894f6b8ba74ad8a700cb75c14dbcd48f4fce3e0ca759b4d51f7118673e10b452836cf7545 + +# Do not keep production secrets in the repository, +# instead read values from the environment. +production: + secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/db/migrate/20150624151720_create_places.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/db/migrate/20150624151720_create_places.rb new file mode 100644 index 0000000..521a3c5 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/db/migrate/20150624151720_create_places.rb @@ -0,0 +1,12 @@ +class CreatePlaces < ActiveRecord::Migration + def change + create_table :places do |t| + t.string :name + t.string :description + t.string :neighborhood + t.string :funness + + t.timestamps null: false + end + end +end diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/db/migrate/20150625153717_create_comments.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/db/migrate/20150625153717_create_comments.rb new file mode 100644 index 0000000..384f763 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/db/migrate/20150625153717_create_comments.rb @@ -0,0 +1,11 @@ +class CreateComments < ActiveRecord::Migration + def change + create_table :comments do |t| + t.string :author + t.string :title + t.string :text + + t.timestamps null: false + end + end +end diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/db/migrate/20150625154157_add_place_reference_to_places.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/db/migrate/20150625154157_add_place_reference_to_places.rb new file mode 100644 index 0000000..ab2633f --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/db/migrate/20150625154157_add_place_reference_to_places.rb @@ -0,0 +1,4 @@ +class AddPlaceReferenceToPlaces < ActiveRecord::Migration + def change + end +end diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/db/migrate/20150625154441_add_place_to_comment.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/db/migrate/20150625154441_add_place_to_comment.rb new file mode 100644 index 0000000..af920f1 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/db/migrate/20150625154441_add_place_to_comment.rb @@ -0,0 +1,5 @@ +class AddPlaceToComment < ActiveRecord::Migration + def change + add_column :comments, :place, :string + end +end diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/db/migrate/20150625154720_migrationname.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/db/migrate/20150625154720_migrationname.rb new file mode 100644 index 0000000..b02077a --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/db/migrate/20150625154720_migrationname.rb @@ -0,0 +1,4 @@ +class Migrationname < ActiveRecord::Migration + def change + end +end diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/db/migrate/20150625155127_add_comment_to_places.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/db/migrate/20150625155127_add_comment_to_places.rb new file mode 100644 index 0000000..ba6e691 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/db/migrate/20150625155127_add_comment_to_places.rb @@ -0,0 +1,5 @@ +class AddCommentToPlaces < ActiveRecord::Migration + def change + add_reference :places, :comment, index: true, foreign_key: true + end +end diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/db/migrate/20150625161037_add_place_id_to_comments.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/db/migrate/20150625161037_add_place_id_to_comments.rb new file mode 100644 index 0000000..49e4ed2 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/db/migrate/20150625161037_add_place_id_to_comments.rb @@ -0,0 +1,5 @@ +class AddPlaceIdToComments < ActiveRecord::Migration + def change + add_column :comments, :place_id, :integer + end +end diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/db/migrate/20150626071737_remove_place_from_comments.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/db/migrate/20150626071737_remove_place_from_comments.rb new file mode 100644 index 0000000..f3df3a9 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/db/migrate/20150626071737_remove_place_from_comments.rb @@ -0,0 +1,5 @@ +class RemovePlaceFromComments < ActiveRecord::Migration + def change + remove_column :comments, :place, :string + end +end diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/db/migrate/20150626071857_remove_title_from_comments.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/db/migrate/20150626071857_remove_title_from_comments.rb new file mode 100644 index 0000000..a339881 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/db/migrate/20150626071857_remove_title_from_comments.rb @@ -0,0 +1,5 @@ +class RemoveTitleFromComments < ActiveRecord::Migration + def change + remove_column :comments, :title, :string + end +end diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/db/schema.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/db/schema.rb new file mode 100644 index 0000000..eedeac5 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/db/schema.rb @@ -0,0 +1,36 @@ +# 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: 20150626071857) do + + create_table "comments", force: :cascade do |t| + t.string "author" + t.string "text" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "place_id" + end + + create_table "places", force: :cascade do |t| + t.string "name" + t.string "description" + t.string "neighborhood" + t.string "funness" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "comment_id" + end + + add_index "places", ["comment_id"], name: "index_places_on_comment_id" + +end diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/db/seeds.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/db/seeds.rb new file mode 100644 index 0000000..36d4f68 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/db/seeds.rb @@ -0,0 +1,18 @@ +# This file should contain all the record creation needed to seed the database with its default values. +# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). +# +# Examples: +# +# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) +# Mayor.create(name: 'Emanuel', city: cities.first) + +puts "Creating places!" + +Place.delete_all + +Place.create! name: "Camps Bay", description: "text1", neighborhood: "lolidk", funness: "Fun and Trendy" + +Place.create! name: "Lion's Head", description: "text2", neighborhood: "lolidk1", funness: "Fun and Sporty" + +Place.create! name: "Old Biscuit Mill", description: "text3", neighborhood: "lolidk2", funness: "Fun and Foody" + diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/lib/assets/.keep b/ChrisCahill-christophercahill/d8/lekker_plekke/lib/assets/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/lib/tasks/.keep b/ChrisCahill-christophercahill/d8/lekker_plekke/lib/tasks/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/log/.keep b/ChrisCahill-christophercahill/d8/lekker_plekke/log/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/public/404.html b/ChrisCahill-christophercahill/d8/lekker_plekke/public/404.html new file mode 100644 index 0000000..b612547 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/public/404.html @@ -0,0 +1,67 @@ + + + + The page you were looking for doesn't exist (404) + + + + + + +
+
+

The page you were looking for doesn't exist.

+

You may have mistyped the address or the page may have moved.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/public/422.html b/ChrisCahill-christophercahill/d8/lekker_plekke/public/422.html new file mode 100644 index 0000000..a21f82b --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/public/422.html @@ -0,0 +1,67 @@ + + + + The change you wanted was rejected (422) + + + + + + +
+
+

The change you wanted was rejected.

+

Maybe you tried to change something you didn't have access to.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/public/500.html b/ChrisCahill-christophercahill/d8/lekker_plekke/public/500.html new file mode 100644 index 0000000..061abc5 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/public/500.html @@ -0,0 +1,66 @@ + + + + We're sorry, but something went wrong (500) + + + + + + +
+
+

We're sorry, but something went wrong.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/public/favicon.ico b/ChrisCahill-christophercahill/d8/lekker_plekke/public/favicon.ico new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/public/robots.txt b/ChrisCahill-christophercahill/d8/lekker_plekke/public/robots.txt new file mode 100644 index 0000000..3c9c7c0 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/public/robots.txt @@ -0,0 +1,5 @@ +# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file +# +# To ban all spiders from the entire site uncomment the next two lines: +# User-agent: * +# Disallow: / diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/test/controllers/.keep b/ChrisCahill-christophercahill/d8/lekker_plekke/test/controllers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/test/fixtures/.keep b/ChrisCahill-christophercahill/d8/lekker_plekke/test/fixtures/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/test/fixtures/comments.yml b/ChrisCahill-christophercahill/d8/lekker_plekke/test/fixtures/comments.yml new file mode 100644 index 0000000..6cf88c1 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/test/fixtures/comments.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + author: MyString + title: MyString + text: MyString + +two: + author: MyString + title: MyString + text: MyString diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/test/fixtures/places.yml b/ChrisCahill-christophercahill/d8/lekker_plekke/test/fixtures/places.yml new file mode 100644 index 0000000..f38b39b --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/test/fixtures/places.yml @@ -0,0 +1,13 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + name: MyString + description: MyString + neighborhood: MyString + funness: MyString + +two: + name: MyString + description: MyString + neighborhood: MyString + funness: MyString diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/test/helpers/.keep b/ChrisCahill-christophercahill/d8/lekker_plekke/test/helpers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/test/integration/.keep b/ChrisCahill-christophercahill/d8/lekker_plekke/test/integration/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/test/mailers/.keep b/ChrisCahill-christophercahill/d8/lekker_plekke/test/mailers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/test/models/.keep b/ChrisCahill-christophercahill/d8/lekker_plekke/test/models/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/test/models/comment_test.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/test/models/comment_test.rb new file mode 100644 index 0000000..b6d6131 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/test/models/comment_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class CommentTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/test/models/place_test.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/test/models/place_test.rb new file mode 100644 index 0000000..b086a70 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/test/models/place_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PlaceTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/test/test_helper.rb b/ChrisCahill-christophercahill/d8/lekker_plekke/test/test_helper.rb new file mode 100644 index 0000000..92e39b2 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/lekker_plekke/test/test_helper.rb @@ -0,0 +1,10 @@ +ENV['RAILS_ENV'] ||= 'test' +require File.expand_path('../../config/environment', __FILE__) +require 'rails/test_help' + +class ActiveSupport::TestCase + # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. + fixtures :all + + # Add more helper methods to be used by all tests here... +end diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/vendor/assets/javascripts/.keep b/ChrisCahill-christophercahill/d8/lekker_plekke/vendor/assets/javascripts/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d8/lekker_plekke/vendor/assets/stylesheets/.keep b/ChrisCahill-christophercahill/d8/lekker_plekke/vendor/assets/stylesheets/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d8/treasure_hunt b/ChrisCahill-christophercahill/d8/treasure_hunt new file mode 160000 index 0000000..6898979 --- /dev/null +++ b/ChrisCahill-christophercahill/d8/treasure_hunt @@ -0,0 +1 @@ +Subproject commit 689897995a3c10f8bb6905f79d27797eda47bb3a diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/.gitignore b/ChrisCahill-christophercahill/d9/lekker_plekke/.gitignore new file mode 100644 index 0000000..050c9d9 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/.gitignore @@ -0,0 +1,17 @@ +# See https://help.github.com/articles/ignoring-files for more about ignoring files. +# +# If you find yourself ignoring temporary files generated by your text editor +# or operating system, you probably want to add a global ignore instead: +# git config --global core.excludesfile '~/.gitignore_global' + +# Ignore bundler config. +/.bundle + +# Ignore the default SQLite database. +/db/*.sqlite3 +/db/*.sqlite3-journal + +# Ignore all logfiles and tempfiles. +/log/* +!/log/.keep +/tmp diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/Gemfile b/ChrisCahill-christophercahill/d9/lekker_plekke/Gemfile new file mode 100644 index 0000000..446f755 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/Gemfile @@ -0,0 +1,47 @@ +source 'https://rubygems.org' + + +# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' +gem 'rails', '4.2.1' +# Use sqlite3 as the database for Active Record +gem 'sqlite3' +# Use SCSS for stylesheets +gem 'sass-rails', '~> 5.0' +# Use Uglifier as compressor for JavaScript assets +gem 'uglifier', '>= 1.3.0' +# Use CoffeeScript for .coffee assets and views +gem 'coffee-rails', '~> 4.1.0' +# See https://github.com/rails/execjs#readme for more supported runtimes +# gem 'therubyracer', platforms: :ruby + +# Use jquery as the JavaScript library +gem 'jquery-rails' +# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks +gem 'turbolinks' +# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder +gem 'jbuilder', '~> 2.0' +# bundle exec rake doc:rails generates the API under doc/api. +gem 'sdoc', '~> 0.4.0', group: :doc + +# Use ActiveModel has_secure_password +# gem 'bcrypt', '~> 3.1.7' + +# Use Unicorn as the app server +# gem 'unicorn' + +# Use Capistrano for deployment +# gem 'capistrano-rails', group: :development + +group :development, :test do + # Call 'byebug' anywhere in the code to stop execution and get a debugger console + gem 'byebug' + + gem 'pry-rails' + + # Access an IRB console on exception pages or by using <%= console %> in views + gem 'web-console', '~> 2.0' + + # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring + gem 'spring' +end + diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/Gemfile.lock b/ChrisCahill-christophercahill/d9/lekker_plekke/Gemfile.lock new file mode 100644 index 0000000..315fbf3 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/Gemfile.lock @@ -0,0 +1,168 @@ +GEM + remote: https://rubygems.org/ + specs: + actionmailer (4.2.1) + actionpack (= 4.2.1) + actionview (= 4.2.1) + activejob (= 4.2.1) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 1.0, >= 1.0.5) + actionpack (4.2.1) + actionview (= 4.2.1) + activesupport (= 4.2.1) + rack (~> 1.6) + rack-test (~> 0.6.2) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.1) + actionview (4.2.1) + activesupport (= 4.2.1) + builder (~> 3.1) + erubis (~> 2.7.0) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.1) + activejob (4.2.1) + activesupport (= 4.2.1) + globalid (>= 0.3.0) + activemodel (4.2.1) + activesupport (= 4.2.1) + builder (~> 3.1) + activerecord (4.2.1) + activemodel (= 4.2.1) + activesupport (= 4.2.1) + arel (~> 6.0) + activesupport (4.2.1) + i18n (~> 0.7) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + arel (6.0.0) + binding_of_caller (0.7.2) + debug_inspector (>= 0.0.1) + builder (3.2.2) + byebug (5.0.0) + columnize (= 0.9.0) + coderay (1.1.0) + coffee-rails (4.1.0) + coffee-script (>= 2.2.0) + railties (>= 4.0.0, < 5.0) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.9.1.1) + columnize (0.9.0) + debug_inspector (0.0.2) + erubis (2.7.0) + execjs (2.5.2) + globalid (0.3.5) + activesupport (>= 4.1.0) + i18n (0.7.0) + jbuilder (2.3.0) + activesupport (>= 3.0.0, < 5) + multi_json (~> 1.2) + jquery-rails (4.0.4) + rails-dom-testing (~> 1.0) + railties (>= 4.2.0) + thor (>= 0.14, < 2.0) + json (1.8.3) + loofah (2.0.2) + nokogiri (>= 1.5.9) + mail (2.6.3) + mime-types (>= 1.16, < 3) + method_source (0.8.2) + mime-types (2.6.1) + mini_portile (0.6.2) + minitest (5.7.0) + multi_json (1.11.1) + nokogiri (1.6.6.2) + mini_portile (~> 0.6.0) + pry (0.10.1) + 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) + rails (4.2.1) + actionmailer (= 4.2.1) + actionpack (= 4.2.1) + actionview (= 4.2.1) + activejob (= 4.2.1) + activemodel (= 4.2.1) + activerecord (= 4.2.1) + activesupport (= 4.2.1) + bundler (>= 1.3.0, < 2.0) + railties (= 4.2.1) + sprockets-rails + rails-deprecated_sanitizer (1.0.3) + activesupport (>= 4.2.0.alpha) + rails-dom-testing (1.0.6) + activesupport (>= 4.2.0.beta, < 5.0) + nokogiri (~> 1.6.0) + rails-deprecated_sanitizer (>= 1.0.1) + rails-html-sanitizer (1.0.2) + loofah (~> 2.0) + railties (4.2.1) + actionpack (= 4.2.1) + activesupport (= 4.2.1) + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (10.4.2) + rdoc (4.2.0) + sass (3.4.15) + sass-rails (5.0.3) + railties (>= 4.0.0, < 5.0) + sass (~> 3.1) + sprockets (>= 2.8, < 4.0) + sprockets-rails (>= 2.0, < 4.0) + tilt (~> 1.1) + sdoc (0.4.1) + json (~> 1.7, >= 1.7.7) + rdoc (~> 4.0) + slop (3.6.0) + spring (1.3.6) + sprockets (3.2.0) + rack (~> 1.0) + sprockets-rails (2.3.2) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (>= 2.8, < 4.0) + sqlite3 (1.3.10) + thor (0.19.1) + thread_safe (0.3.5) + tilt (1.4.1) + turbolinks (2.5.3) + coffee-rails + tzinfo (1.2.2) + thread_safe (~> 0.1) + uglifier (2.7.1) + execjs (>= 0.3.0) + json (>= 1.8.0) + web-console (2.1.3) + activemodel (>= 4.0) + binding_of_caller (>= 0.7.2) + railties (>= 4.0) + sprockets-rails (>= 2.0, < 4.0) + +PLATFORMS + ruby + +DEPENDENCIES + byebug + coffee-rails (~> 4.1.0) + jbuilder (~> 2.0) + jquery-rails + pry-rails + rails (= 4.2.1) + sass-rails (~> 5.0) + sdoc (~> 0.4.0) + spring + sqlite3 + turbolinks + uglifier (>= 1.3.0) + web-console (~> 2.0) + +BUNDLED WITH + 1.10.3 diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/README.rdoc b/ChrisCahill-christophercahill/d9/lekker_plekke/README.rdoc new file mode 100644 index 0000000..dd4e97e --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/README.rdoc @@ -0,0 +1,28 @@ +== README + +This README would normally document whatever steps are necessary to get the +application up and running. + +Things you may want to cover: + +* Ruby version + +* System dependencies + +* Configuration + +* Database creation + +* Database initialization + +* How to run the test suite + +* Services (job queues, cache servers, search engines, etc.) + +* Deployment instructions + +* ... + + +Please feel free to use a different markup language if you do not plan to run +rake doc:app. diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/Rakefile b/ChrisCahill-christophercahill/d9/lekker_plekke/Rakefile new file mode 100644 index 0000000..ba6b733 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/Rakefile @@ -0,0 +1,6 @@ +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require File.expand_path('../config/application', __FILE__) + +Rails.application.load_tasks diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/app/assets/images/.keep b/ChrisCahill-christophercahill/d9/lekker_plekke/app/assets/images/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/app/assets/javascripts/application.js b/ChrisCahill-christophercahill/d9/lekker_plekke/app/assets/javascripts/application.js new file mode 100644 index 0000000..e07c5a8 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/app/assets/javascripts/application.js @@ -0,0 +1,16 @@ +// This is a manifest file that'll be compiled into application.js, which will include all the files +// listed below. +// +// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, +// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. +// +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// compiled file. +// +// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details +// about supported directives. +// +//= require jquery +//= require jquery_ujs +//= require turbolinks +//= require_tree . diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/app/assets/stylesheets/application.css b/ChrisCahill-christophercahill/d9/lekker_plekke/app/assets/stylesheets/application.css new file mode 100644 index 0000000..f9cd5b3 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/app/assets/stylesheets/application.css @@ -0,0 +1,15 @@ +/* + * This is a manifest file that'll be compiled into application.css, which will include all the files + * listed below. + * + * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, + * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. + * + * You're free to add application-wide styles to this file and they'll appear at the bottom of the + * compiled file so the styles you add here take precedence over styles defined in any styles + * defined in the other CSS/SCSS files in this directory. It is generally better to create a new + * file per style scope. + * + *= require_tree . + *= require_self + */ diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/app/controllers/application_controller.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/app/controllers/application_controller.rb new file mode 100644 index 0000000..d83690e --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/app/controllers/application_controller.rb @@ -0,0 +1,5 @@ +class ApplicationController < ActionController::Base + # Prevent CSRF attacks by raising an exception. + # For APIs, you may want to use :null_session instead. + protect_from_forgery with: :exception +end diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/app/controllers/comments_controller.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/app/controllers/comments_controller.rb new file mode 100644 index 0000000..1a263a8 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/app/controllers/comments_controller.rb @@ -0,0 +1,20 @@ +class CommentsController < ApplicationController + + def create + @place = Place.find(params[:place_id]) + @comment = @place.comments.create(comment_params) + redirect_to place_path(@place) + end + + def destroy + @place = Place.find(params[:place_id]) + @comment = @place.comments.find(params[:id]) + @comment.destroy + redirect_to place_path(@place) + end + + private + def comment_params + params.require(:comment).permit(:author, :text) + end +end \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/app/controllers/concerns/.keep b/ChrisCahill-christophercahill/d9/lekker_plekke/app/controllers/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/app/controllers/places_controller.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/app/controllers/places_controller.rb new file mode 100644 index 0000000..41ea4e7 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/app/controllers/places_controller.rb @@ -0,0 +1,50 @@ +class PlacesController < ApplicationController + def index + @places = Place.all + end + + def show + @place = Place.find params[:id] + end + + def new + @place = Place.new + end + + def edit + @place = Place.find(params[:id]) + end + + def create + @place = Place.new(place_params) + if @place.save + redirect_to @place + else + render 'new' + end + end + + def update + @place = Place.find(params[:id]) + + if @place.update(place_params) + redirect_to @place + else + render 'edit' + end + end + + def destroy + @place = Place.find(params[:id]) + @place.destroy + + redirect_to places_path + end + + private + + def place_params + params.require(:place).permit(:name, :description, :neighborhood, :funness) + end + +end \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/app/helpers/application_helper.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/app/helpers/application_helper.rb new file mode 100644 index 0000000..de6be79 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/app/mailers/.keep b/ChrisCahill-christophercahill/d9/lekker_plekke/app/mailers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/app/models/.keep b/ChrisCahill-christophercahill/d9/lekker_plekke/app/models/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/app/models/comment.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/app/models/comment.rb new file mode 100644 index 0000000..10b1c80 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/app/models/comment.rb @@ -0,0 +1,5 @@ +class Comment < ActiveRecord::Base + belongs_to :place + validates :text, presence: true + validates :author, presence: true +end diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/app/models/concerns/.keep b/ChrisCahill-christophercahill/d9/lekker_plekke/app/models/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/app/models/place.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/app/models/place.rb new file mode 100644 index 0000000..c89f9c1 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/app/models/place.rb @@ -0,0 +1,4 @@ +class Place < ActiveRecord::Base + has_many :comments, dependent: :destroy + validates :name, presence: true, uniqueness: {case_sensitive: false} +end diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/app/views/comments/_comment.html.erb b/ChrisCahill-christophercahill/d9/lekker_plekke/app/views/comments/_comment.html.erb new file mode 100644 index 0000000..7f95aed --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/app/views/comments/_comment.html.erb @@ -0,0 +1,15 @@ +

+ Author: + <%= comment.author %> +

+ +

+ Text: + <%= comment.text %> +

+ +

+ <%= link_to 'Destroy Comment', [comment.place, comment], + method: :delete, + data: { confirm: 'Are you sure?' } %> +

\ No newline at end of file diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/app/views/comments/_form.html.erb b/ChrisCahill-christophercahill/d9/lekker_plekke/app/views/comments/_form.html.erb new file mode 100644 index 0000000..3bcead6 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/app/views/comments/_form.html.erb @@ -0,0 +1,16 @@ +<%= form_for([@place, @place.comments.build]) do |f| %> + +

+ <%= f.label :author %>
+ <%= f.text_field :author %> +

+

+ <%= f.label :text %>
+ <%= f.text_area :text %> +

+ +

+ <%= f.submit %> +

+ +<% end %> \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/app/views/layouts/application.html.erb b/ChrisCahill-christophercahill/d9/lekker_plekke/app/views/layouts/application.html.erb new file mode 100644 index 0000000..c713e18 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/app/views/layouts/application.html.erb @@ -0,0 +1,14 @@ + + + + LekkerPlekke + <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> + <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> + <%= csrf_meta_tags %> + + + +<%= yield %> + + + diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/app/views/places/_form.html.erb b/ChrisCahill-christophercahill/d9/lekker_plekke/app/views/places/_form.html.erb new file mode 100644 index 0000000..1aa3300 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/app/views/places/_form.html.erb @@ -0,0 +1,41 @@ +<%= form_for @place do |f| %> + + <% if @place.errors.any? %> +
+

+ <%= pluralize(@place.errors.count, "error") %> prohibited + this place from being saved: +

+ +
+ <% end %> + +
+ <%= f.label :name %> + <%= f.text_field :name %> +
+ +
+ <%= f.label :description %> + <%= f.text_field :description %> +
+ +
+ <%= f.label :neighborhood%> + <%= f.text_field :neighborhood%> +
+ +
+ <%= f.label :funness%> + <%= f.text_field :funness%> +
+ +

+ <%= f.submit %> +

+ +<% end %> \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/app/views/places/edit.html.erb b/ChrisCahill-christophercahill/d9/lekker_plekke/app/views/places/edit.html.erb new file mode 100644 index 0000000..350c2c9 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/app/views/places/edit.html.erb @@ -0,0 +1,5 @@ +

Edit Place

+ +<%= render 'form' %> + +<%= link_to 'Back', places_path %> \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/app/views/places/index.html.erb b/ChrisCahill-christophercahill/d9/lekker_plekke/app/views/places/index.html.erb new file mode 100644 index 0000000..623d14e --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/app/views/places/index.html.erb @@ -0,0 +1,23 @@ +

Cape Town Guide

+

<%= link_to "New Place", new_place_path %>

+ + + + + + + + + <% @places.each do |place| %> + + + + + + + <% end %> +
Check out these lekker plekke!
<%= place.name %><%= link_to 'Show', place_path(place) %><%= link_to 'Edit', edit_place_path(place) %><%= link_to 'Destroy', place_path(place), + method: :delete, + data: { confirm: 'Are you sure?' } %>
+ + \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/app/views/places/new.html.erb b/ChrisCahill-christophercahill/d9/lekker_plekke/app/views/places/new.html.erb new file mode 100644 index 0000000..b38ea00 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/app/views/places/new.html.erb @@ -0,0 +1,27 @@ +<%= form_for @place do |f| %> + +
+ <%= f.label :name %> + <%= f.text_field :name %> +
+ +
+ <%= f.label :description %> + <%= f.text_field :description %> +
+ +
+ <%= f.label :neighborhood%> + <%= f.text_field :neighborhood%> +
+ +
+ <%= f.label :funness%> + <%= f.text_field :funness%> +
+ +

<%= f.submit %>

+ +<% end %> + +<%= link_to 'Back', places_path %> \ No newline at end of file diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/app/views/places/show.html.erb b/ChrisCahill-christophercahill/d9/lekker_plekke/app/views/places/show.html.erb new file mode 100644 index 0000000..1f30573 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/app/views/places/show.html.erb @@ -0,0 +1,20 @@ +

<%= @place.name %>

+ +

A few fun facts about this cool place...

+ + + +

Comments

+<%= render @place.comments %> + +

Add a comment:

+<%= render 'comments/form' %> + +<%= link_to 'Edit', edit_place_path(@place) %> +<%= link_to 'Home', places_path %> + diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/bin/bundle b/ChrisCahill-christophercahill/d9/lekker_plekke/bin/bundle new file mode 100755 index 0000000..66e9889 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/bin/bundle @@ -0,0 +1,3 @@ +#!/usr/bin/env ruby +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +load Gem.bin_path('bundler', 'bundle') diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/bin/rails b/ChrisCahill-christophercahill/d9/lekker_plekke/bin/rails new file mode 100755 index 0000000..4d608ed --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/bin/rails @@ -0,0 +1,8 @@ +#!/usr/bin/env ruby +begin + load File.expand_path("../spring", __FILE__) +rescue LoadError +end +APP_PATH = File.expand_path('../../config/application', __FILE__) +require_relative '../config/boot' +require 'rails/commands' diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/bin/rake b/ChrisCahill-christophercahill/d9/lekker_plekke/bin/rake new file mode 100755 index 0000000..8017a02 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/bin/rake @@ -0,0 +1,8 @@ +#!/usr/bin/env ruby +begin + load File.expand_path("../spring", __FILE__) +rescue LoadError +end +require_relative '../config/boot' +require 'rake' +Rake.application.run diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/bin/setup b/ChrisCahill-christophercahill/d9/lekker_plekke/bin/setup new file mode 100755 index 0000000..acdb2c1 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/bin/setup @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +require 'pathname' + +# path to your application root. +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) + +Dir.chdir APP_ROOT do + # This script is a starting point to setup your application. + # Add necessary setup steps to this file: + + puts "== Installing dependencies ==" + system "gem install bundler --conservative" + system "bundle check || bundle install" + + # puts "\n== Copying sample files ==" + # unless File.exist?("config/database.yml") + # system "cp config/database.yml.sample config/database.yml" + # end + + puts "\n== Preparing database ==" + system "bin/rake db:setup" + + puts "\n== Removing old logs and tempfiles ==" + system "rm -f log/*" + system "rm -rf tmp/cache" + + puts "\n== Restarting application server ==" + system "touch tmp/restart.txt" +end diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/bin/spring b/ChrisCahill-christophercahill/d9/lekker_plekke/bin/spring new file mode 100755 index 0000000..7b45d37 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/bin/spring @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby + +# This file loads spring without using Bundler, in order to be fast. +# It gets overwritten when you run the `spring binstub` command. + +unless defined?(Spring) + require "rubygems" + require "bundler" + + if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m) + Gem.paths = { "GEM_PATH" => [Bundler.bundle_path.to_s, *Gem.path].uniq } + gem "spring", match[1] + require "spring/binstub" + end +end diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/config.ru b/ChrisCahill-christophercahill/d9/lekker_plekke/config.ru new file mode 100644 index 0000000..bd83b25 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/config.ru @@ -0,0 +1,4 @@ +# This file is used by Rack-based servers to start the application. + +require ::File.expand_path('../config/environment', __FILE__) +run Rails.application diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/config/application.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/config/application.rb new file mode 100644 index 0000000..a3c8f2e --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/config/application.rb @@ -0,0 +1,26 @@ +require File.expand_path('../boot', __FILE__) + +require 'rails/all' + +# Require the gems listed in Gemfile, including any gems +# you've limited to :test, :development, or :production. +Bundler.require(*Rails.groups) + +module LekkerPlekke + class Application < Rails::Application + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. + # config.time_zone = 'Central Time (US & Canada)' + + # 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 + + # Do not swallow errors in after_commit/after_rollback callbacks. + config.active_record.raise_in_transactional_callbacks = true + end +end diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/config/boot.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/config/boot.rb new file mode 100644 index 0000000..6b750f0 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/config/boot.rb @@ -0,0 +1,3 @@ +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) + +require 'bundler/setup' # Set up gems listed in the Gemfile. diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/config/database.yml b/ChrisCahill-christophercahill/d9/lekker_plekke/config/database.yml new file mode 100644 index 0000000..1c1a37c --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/config/database.yml @@ -0,0 +1,25 @@ +# SQLite version 3.x +# gem install sqlite3 +# +# Ensure the SQLite 3 gem is defined in your Gemfile +# gem 'sqlite3' +# +default: &default + adapter: sqlite3 + pool: 5 + timeout: 5000 + +development: + <<: *default + database: db/development.sqlite3 + +# Warning: The database defined as "test" will be erased and +# re-generated from your development database when you run "rake". +# Do not set this db to the same as development or production. +test: + <<: *default + database: db/test.sqlite3 + +production: + <<: *default + database: db/production.sqlite3 diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/config/environment.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/config/environment.rb new file mode 100644 index 0000000..ee8d90d --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/config/environment.rb @@ -0,0 +1,5 @@ +# Load the Rails application. +require File.expand_path('../application', __FILE__) + +# Initialize the Rails application. +Rails.application.initialize! diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/config/environments/development.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/config/environments/development.rb new file mode 100644 index 0000000..b55e214 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/config/environments/development.rb @@ -0,0 +1,41 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # In the development environment your application's code is reloaded on + # every request. This slows down response time but is perfect for development + # since you don't have to restart the web server when you make code changes. + config.cache_classes = false + + # Do not eager load code on boot. + config.eager_load = false + + # Show full error reports and disable caching. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Don't care if the mailer can't send. + config.action_mailer.raise_delivery_errors = false + + # Print deprecation notices to the Rails logger. + config.active_support.deprecation = :log + + # Raise an error on page load if there are pending migrations. + config.active_record.migration_error = :page_load + + # Debug mode disables concatenation and preprocessing of assets. + # This option may cause significant delays in view rendering with a large + # number of complex assets. + config.assets.debug = true + + # Asset digests allow you to set far-future HTTP expiration dates on all assets, + # yet still be able to expire them through the digest params. + config.assets.digest = true + + # Adds additional error checking when serving assets at runtime. + # Checks for improperly declared sprockets dependencies. + # Raises helpful error messages. + config.assets.raise_runtime_errors = true + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true +end diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/config/environments/production.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/config/environments/production.rb new file mode 100644 index 0000000..5c1b32e --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/config/environments/production.rb @@ -0,0 +1,79 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # Code is not reloaded between requests. + config.cache_classes = true + + # Eager load code on boot. This eager loads most of Rails and + # your application in memory, allowing both threaded web servers + # and those relying on copy on write to perform better. + # Rake tasks automatically ignore this option for performance. + config.eager_load = true + + # Full error reports are disabled and caching is turned on. + config.consider_all_requests_local = false + config.action_controller.perform_caching = true + + # Enable Rack::Cache to put a simple HTTP cache in front of your application + # Add `rack-cache` to your Gemfile before enabling this. + # For large-scale production use, consider using a caching reverse proxy like + # NGINX, varnish or squid. + # config.action_dispatch.rack_cache = true + + # Disable serving static files from the `/public` folder by default since + # Apache or NGINX already handles this. + config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? + + # Compress JavaScripts and CSS. + config.assets.js_compressor = :uglifier + # config.assets.css_compressor = :sass + + # Do not fallback to assets pipeline if a precompiled asset is missed. + config.assets.compile = false + + # Asset digests allow you to set far-future HTTP expiration dates on all assets, + # yet still be able to expire them through the digest params. + config.assets.digest = true + + # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb + + # Specifies the header that your server uses for sending files. + # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # Use the lowest log level to ensure availability of diagnostic information + # when problems arise. + config.log_level = :debug + + # Prepend all log lines with the following tags. + # config.log_tags = [ :subdomain, :uuid ] + + # Use a different logger for distributed setups. + # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + + # Use a different cache store in production. + # config.cache_store = :mem_cache_store + + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.action_controller.asset_host = 'http://assets.example.com' + + # Ignore bad email addresses and do not raise email delivery errors. + # Set this to true and configure the email server for immediate delivery to raise delivery errors. + # config.action_mailer.raise_delivery_errors = false + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation cannot be found). + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners. + config.active_support.deprecation = :notify + + # Use default logging formatter so that PID and timestamp are not suppressed. + config.log_formatter = ::Logger::Formatter.new + + # Do not dump schema after migrations. + config.active_record.dump_schema_after_migration = false +end diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/config/environments/test.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/config/environments/test.rb new file mode 100644 index 0000000..1c19f08 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/config/environments/test.rb @@ -0,0 +1,42 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # The test environment is used exclusively to run your application's + # test suite. You never need to work with it otherwise. Remember that + # your test database is "scratch space" for the test suite and is wiped + # and recreated between test runs. Don't rely on the data there! + config.cache_classes = true + + # Do not eager load code on boot. This avoids loading your whole application + # just for the purpose of running a single test. If you are using a tool that + # preloads Rails for running tests, you may have to set it to true. + config.eager_load = false + + # Configure static file server for tests with Cache-Control for performance. + config.serve_static_files = true + config.static_cache_control = 'public, max-age=3600' + + # Show full error reports and disable caching. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Raise exceptions instead of rendering exception templates. + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment. + config.action_controller.allow_forgery_protection = false + + # Tell Action Mailer not to deliver emails to the real world. + # The :test delivery method accumulates sent emails in the + # ActionMailer::Base.deliveries array. + config.action_mailer.delivery_method = :test + + # Randomize the order test cases are executed. + config.active_support.test_order = :random + + # Print deprecation notices to the stderr. + config.active_support.deprecation = :stderr + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true +end diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/config/initializers/assets.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/config/initializers/assets.rb new file mode 100644 index 0000000..01ef3e6 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/config/initializers/assets.rb @@ -0,0 +1,11 @@ +# Be sure to restart your server when you modify this file. + +# Version of your assets, change this if you want to expire all your assets. +Rails.application.config.assets.version = '1.0' + +# Add additional assets to the asset load path +# Rails.application.config.assets.paths << Emoji.images_path + +# Precompile additional assets. +# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. +# Rails.application.config.assets.precompile += %w( search.js ) diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/config/initializers/backtrace_silencers.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/config/initializers/backtrace_silencers.rb new file mode 100644 index 0000000..59385cd --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/config/initializers/backtrace_silencers.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. +# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } + +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. +# Rails.backtrace_cleaner.remove_silencers! diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/config/initializers/cookies_serializer.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/config/initializers/cookies_serializer.rb new file mode 100644 index 0000000..7f70458 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/config/initializers/cookies_serializer.rb @@ -0,0 +1,3 @@ +# Be sure to restart your server when you modify this file. + +Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/config/initializers/filter_parameter_logging.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/config/initializers/filter_parameter_logging.rb new file mode 100644 index 0000000..4a994e1 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/config/initializers/filter_parameter_logging.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Configure sensitive parameters which will be filtered from the log file. +Rails.application.config.filter_parameters += [:password] diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/config/initializers/inflections.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/config/initializers/inflections.rb new file mode 100644 index 0000000..ac033bf --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/config/initializers/inflections.rb @@ -0,0 +1,16 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format. Inflections +# are locale specific, and you may define rules for as many different +# locales as you wish. All of these examples are active by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.plural /^(ox)$/i, '\1en' +# inflect.singular /^(ox)en/i, '\1' +# inflect.irregular 'person', 'people' +# inflect.uncountable %w( fish sheep ) +# end + +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.acronym 'RESTful' +# end diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/config/initializers/mime_types.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/config/initializers/mime_types.rb new file mode 100644 index 0000000..dc18996 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/config/initializers/mime_types.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Add new mime types for use in respond_to blocks: +# Mime::Type.register "text/richtext", :rtf diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/config/initializers/session_store.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/config/initializers/session_store.rb new file mode 100644 index 0000000..d520510 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/config/initializers/session_store.rb @@ -0,0 +1,3 @@ +# Be sure to restart your server when you modify this file. + +Rails.application.config.session_store :cookie_store, key: '_lekker_plekke_session' diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/config/initializers/wrap_parameters.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/config/initializers/wrap_parameters.rb new file mode 100644 index 0000000..33725e9 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/config/initializers/wrap_parameters.rb @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. + +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActiveSupport.on_load(:action_controller) do + wrap_parameters format: [:json] if respond_to?(:wrap_parameters) +end + +# To enable root element in JSON for ActiveRecord objects. +# ActiveSupport.on_load(:active_record) do +# self.include_root_in_json = true +# end diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/config/locales/en.yml b/ChrisCahill-christophercahill/d9/lekker_plekke/config/locales/en.yml new file mode 100644 index 0000000..0653957 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/config/locales/en.yml @@ -0,0 +1,23 @@ +# Files in the config/locales directory are used for internationalization +# and are automatically loaded by Rails. If you want to use locales other +# than English, add the necessary files in this directory. +# +# To use the locales, use `I18n.t`: +# +# I18n.t 'hello' +# +# In views, this is aliased to just `t`: +# +# <%= t('hello') %> +# +# To use a different locale, set it with `I18n.locale`: +# +# I18n.locale = :es +# +# This would use the information in config/locales/es.yml. +# +# To learn more, please read the Rails Internationalization guide +# available at http://guides.rubyonrails.org/i18n.html. + +en: + hello: "Hello world" diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/config/routes.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/config/routes.rb new file mode 100644 index 0000000..cc5ce62 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/config/routes.rb @@ -0,0 +1,60 @@ +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". + + resources :places do + resources :comments + end + + # 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 +end diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/config/secrets.yml b/ChrisCahill-christophercahill/d9/lekker_plekke/config/secrets.yml new file mode 100644 index 0000000..de99c9d --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/config/secrets.yml @@ -0,0 +1,22 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key is used for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! + +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +# You can use `rake secret` to generate a secure secret key. + +# Make sure the secrets in this file are kept private +# if you're sharing your code publicly. + +development: + secret_key_base: 963389b3ab732a61c52ffeb93e5bc8ef37c781537923c3f225e3de901dcc2de26637be4f6708c0891ba4e626afd5d50b2c0be3e6f67b9983e7da0682d4ae9367 + +test: + secret_key_base: a52b590099b870548959b8ecc99740abc9134c9dc9d96d55b5a1eaf894f6b8ba74ad8a700cb75c14dbcd48f4fce3e0ca759b4d51f7118673e10b452836cf7545 + +# Do not keep production secrets in the repository, +# instead read values from the environment. +production: + secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/db/migrate/20150624151720_create_places.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/db/migrate/20150624151720_create_places.rb new file mode 100644 index 0000000..521a3c5 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/db/migrate/20150624151720_create_places.rb @@ -0,0 +1,12 @@ +class CreatePlaces < ActiveRecord::Migration + def change + create_table :places do |t| + t.string :name + t.string :description + t.string :neighborhood + t.string :funness + + t.timestamps null: false + end + end +end diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/db/migrate/20150625153717_create_comments.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/db/migrate/20150625153717_create_comments.rb new file mode 100644 index 0000000..384f763 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/db/migrate/20150625153717_create_comments.rb @@ -0,0 +1,11 @@ +class CreateComments < ActiveRecord::Migration + def change + create_table :comments do |t| + t.string :author + t.string :title + t.string :text + + t.timestamps null: false + end + end +end diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/db/migrate/20150625154157_add_place_reference_to_places.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/db/migrate/20150625154157_add_place_reference_to_places.rb new file mode 100644 index 0000000..ab2633f --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/db/migrate/20150625154157_add_place_reference_to_places.rb @@ -0,0 +1,4 @@ +class AddPlaceReferenceToPlaces < ActiveRecord::Migration + def change + end +end diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/db/migrate/20150625154441_add_place_to_comment.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/db/migrate/20150625154441_add_place_to_comment.rb new file mode 100644 index 0000000..af920f1 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/db/migrate/20150625154441_add_place_to_comment.rb @@ -0,0 +1,5 @@ +class AddPlaceToComment < ActiveRecord::Migration + def change + add_column :comments, :place, :string + end +end diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/db/migrate/20150625154720_migrationname.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/db/migrate/20150625154720_migrationname.rb new file mode 100644 index 0000000..b02077a --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/db/migrate/20150625154720_migrationname.rb @@ -0,0 +1,4 @@ +class Migrationname < ActiveRecord::Migration + def change + end +end diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/db/migrate/20150625155127_add_comment_to_places.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/db/migrate/20150625155127_add_comment_to_places.rb new file mode 100644 index 0000000..ba6e691 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/db/migrate/20150625155127_add_comment_to_places.rb @@ -0,0 +1,5 @@ +class AddCommentToPlaces < ActiveRecord::Migration + def change + add_reference :places, :comment, index: true, foreign_key: true + end +end diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/db/migrate/20150625161037_add_place_id_to_comments.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/db/migrate/20150625161037_add_place_id_to_comments.rb new file mode 100644 index 0000000..49e4ed2 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/db/migrate/20150625161037_add_place_id_to_comments.rb @@ -0,0 +1,5 @@ +class AddPlaceIdToComments < ActiveRecord::Migration + def change + add_column :comments, :place_id, :integer + end +end diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/db/migrate/20150626071737_remove_place_from_comments.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/db/migrate/20150626071737_remove_place_from_comments.rb new file mode 100644 index 0000000..f3df3a9 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/db/migrate/20150626071737_remove_place_from_comments.rb @@ -0,0 +1,5 @@ +class RemovePlaceFromComments < ActiveRecord::Migration + def change + remove_column :comments, :place, :string + end +end diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/db/migrate/20150626071857_remove_title_from_comments.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/db/migrate/20150626071857_remove_title_from_comments.rb new file mode 100644 index 0000000..a339881 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/db/migrate/20150626071857_remove_title_from_comments.rb @@ -0,0 +1,5 @@ +class RemoveTitleFromComments < ActiveRecord::Migration + def change + remove_column :comments, :title, :string + end +end diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/db/schema.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/db/schema.rb new file mode 100644 index 0000000..eedeac5 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/db/schema.rb @@ -0,0 +1,36 @@ +# 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: 20150626071857) do + + create_table "comments", force: :cascade do |t| + t.string "author" + t.string "text" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "place_id" + end + + create_table "places", force: :cascade do |t| + t.string "name" + t.string "description" + t.string "neighborhood" + t.string "funness" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "comment_id" + end + + add_index "places", ["comment_id"], name: "index_places_on_comment_id" + +end diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/db/seeds.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/db/seeds.rb new file mode 100644 index 0000000..36d4f68 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/db/seeds.rb @@ -0,0 +1,18 @@ +# This file should contain all the record creation needed to seed the database with its default values. +# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). +# +# Examples: +# +# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) +# Mayor.create(name: 'Emanuel', city: cities.first) + +puts "Creating places!" + +Place.delete_all + +Place.create! name: "Camps Bay", description: "text1", neighborhood: "lolidk", funness: "Fun and Trendy" + +Place.create! name: "Lion's Head", description: "text2", neighborhood: "lolidk1", funness: "Fun and Sporty" + +Place.create! name: "Old Biscuit Mill", description: "text3", neighborhood: "lolidk2", funness: "Fun and Foody" + diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/lib/assets/.keep b/ChrisCahill-christophercahill/d9/lekker_plekke/lib/assets/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/lib/tasks/.keep b/ChrisCahill-christophercahill/d9/lekker_plekke/lib/tasks/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/log/.keep b/ChrisCahill-christophercahill/d9/lekker_plekke/log/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/public/404.html b/ChrisCahill-christophercahill/d9/lekker_plekke/public/404.html new file mode 100644 index 0000000..b612547 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/public/404.html @@ -0,0 +1,67 @@ + + + + The page you were looking for doesn't exist (404) + + + + + + +
+
+

The page you were looking for doesn't exist.

+

You may have mistyped the address or the page may have moved.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/public/422.html b/ChrisCahill-christophercahill/d9/lekker_plekke/public/422.html new file mode 100644 index 0000000..a21f82b --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/public/422.html @@ -0,0 +1,67 @@ + + + + The change you wanted was rejected (422) + + + + + + +
+
+

The change you wanted was rejected.

+

Maybe you tried to change something you didn't have access to.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/public/500.html b/ChrisCahill-christophercahill/d9/lekker_plekke/public/500.html new file mode 100644 index 0000000..061abc5 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/public/500.html @@ -0,0 +1,66 @@ + + + + We're sorry, but something went wrong (500) + + + + + + +
+
+

We're sorry, but something went wrong.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/public/favicon.ico b/ChrisCahill-christophercahill/d9/lekker_plekke/public/favicon.ico new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/public/robots.txt b/ChrisCahill-christophercahill/d9/lekker_plekke/public/robots.txt new file mode 100644 index 0000000..3c9c7c0 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/public/robots.txt @@ -0,0 +1,5 @@ +# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file +# +# To ban all spiders from the entire site uncomment the next two lines: +# User-agent: * +# Disallow: / diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/test/controllers/.keep b/ChrisCahill-christophercahill/d9/lekker_plekke/test/controllers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/test/fixtures/.keep b/ChrisCahill-christophercahill/d9/lekker_plekke/test/fixtures/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/test/fixtures/comments.yml b/ChrisCahill-christophercahill/d9/lekker_plekke/test/fixtures/comments.yml new file mode 100644 index 0000000..6cf88c1 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/test/fixtures/comments.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + author: MyString + title: MyString + text: MyString + +two: + author: MyString + title: MyString + text: MyString diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/test/fixtures/places.yml b/ChrisCahill-christophercahill/d9/lekker_plekke/test/fixtures/places.yml new file mode 100644 index 0000000..f38b39b --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/test/fixtures/places.yml @@ -0,0 +1,13 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + name: MyString + description: MyString + neighborhood: MyString + funness: MyString + +two: + name: MyString + description: MyString + neighborhood: MyString + funness: MyString diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/test/helpers/.keep b/ChrisCahill-christophercahill/d9/lekker_plekke/test/helpers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/test/integration/.keep b/ChrisCahill-christophercahill/d9/lekker_plekke/test/integration/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/test/mailers/.keep b/ChrisCahill-christophercahill/d9/lekker_plekke/test/mailers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/test/models/.keep b/ChrisCahill-christophercahill/d9/lekker_plekke/test/models/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/test/models/comment_test.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/test/models/comment_test.rb new file mode 100644 index 0000000..b6d6131 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/test/models/comment_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class CommentTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/test/models/place_test.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/test/models/place_test.rb new file mode 100644 index 0000000..b086a70 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/test/models/place_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PlaceTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/test/test_helper.rb b/ChrisCahill-christophercahill/d9/lekker_plekke/test/test_helper.rb new file mode 100644 index 0000000..92e39b2 --- /dev/null +++ b/ChrisCahill-christophercahill/d9/lekker_plekke/test/test_helper.rb @@ -0,0 +1,10 @@ +ENV['RAILS_ENV'] ||= 'test' +require File.expand_path('../../config/environment', __FILE__) +require 'rails/test_help' + +class ActiveSupport::TestCase + # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. + fixtures :all + + # Add more helper methods to be used by all tests here... +end diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/vendor/assets/javascripts/.keep b/ChrisCahill-christophercahill/d9/lekker_plekke/vendor/assets/javascripts/.keep new file mode 100644 index 0000000..e69de29 diff --git a/ChrisCahill-christophercahill/d9/lekker_plekke/vendor/assets/stylesheets/.keep b/ChrisCahill-christophercahill/d9/lekker_plekke/vendor/assets/stylesheets/.keep new file mode 100644 index 0000000..e69de29