diff --git a/Gemfile b/Gemfile index a8f356b..1a63529 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,7 @@ git_source(:github) do |repo_name| end # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '~> 5.0.6' +gem 'rails', '5.2.0.beta2' # Use Puma as the app server gem 'puma', '~> 3.0' # Use SCSS for stylesheets diff --git a/Gemfile.lock b/Gemfile.lock index 340c706..c304431 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: git://github.com/stympy/faker.git - revision: 56b19f27e7d0db07b74c7d94d0235492815cb760 + revision: 679fd508c9f41f41b6df62024d67bc2281953395 branch: master specs: faker (1.8.7) @@ -9,45 +9,48 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (5.0.6) - actionpack (= 5.0.6) - nio4r (>= 1.2, < 3.0) + actioncable (5.2.0.beta2) + actionpack (= 5.2.0.beta2) + nio4r (~> 2.0) websocket-driver (~> 0.6.1) - actionmailer (5.0.6) - actionpack (= 5.0.6) - actionview (= 5.0.6) - activejob (= 5.0.6) + actionmailer (5.2.0.beta2) + actionpack (= 5.2.0.beta2) + actionview (= 5.2.0.beta2) + activejob (= 5.2.0.beta2) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.0.6) - actionview (= 5.0.6) - activesupport (= 5.0.6) + actionpack (5.2.0.beta2) + actionview (= 5.2.0.beta2) + activesupport (= 5.2.0.beta2) rack (~> 2.0) - rack-test (~> 0.6.3) + rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.0.6) - activesupport (= 5.0.6) + actionview (5.2.0.beta2) + activesupport (= 5.2.0.beta2) builder (~> 3.1) - erubis (~> 2.7.0) + erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.0.6) - activesupport (= 5.0.6) + activejob (5.2.0.beta2) + activesupport (= 5.2.0.beta2) globalid (>= 0.3.6) - activemodel (5.0.6) - activesupport (= 5.0.6) - activerecord (5.0.6) - activemodel (= 5.0.6) - activesupport (= 5.0.6) - arel (~> 7.0) - activesupport (5.0.6) + activemodel (5.2.0.beta2) + activesupport (= 5.2.0.beta2) + activerecord (5.2.0.beta2) + activemodel (= 5.2.0.beta2) + activesupport (= 5.2.0.beta2) + arel (>= 9.0) + activestorage (5.2.0.beta2) + actionpack (= 5.2.0.beta2) + activerecord (= 5.2.0.beta2) + activesupport (5.2.0.beta2) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) minitest (~> 5.1) tzinfo (~> 1.1) - arel (7.1.4) - autoprefixer-rails (7.2.3) + arel (9.0.0) + autoprefixer-rails (7.2.5) execjs axiom-types (0.1.1) descendants_tracker (~> 0.0.4) @@ -76,11 +79,11 @@ GEM coffee-script-source (1.12.2) concurrent-ruby (1.0.5) crass (1.0.3) - csv-importer (0.4.0) + csv-importer (0.5.0) virtus descendants_tracker (0.0.4) thread_safe (~> 0.3, >= 0.3.1) - devise (4.3.0) + devise (4.4.1) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0, < 5.2) @@ -88,6 +91,7 @@ GEM warden (~> 1.2.3) diff-lcs (1.3) equalizer (0.0.11) + erubi (1.7.0) erubis (2.7.0) execjs (2.7.0) factory_bot (4.8.2) @@ -112,7 +116,7 @@ GEM haml (>= 4.0, < 6) nokogiri (>= 1.6.0) ruby_parser (~> 3.5) - i18n (0.9.1) + i18n (0.9.3) concurrent-ruby (~> 1.0) ice_nine (0.11.2) jbuilder (2.7.0) @@ -138,28 +142,29 @@ GEM mini_magick (4.8.0) mini_mime (1.0.0) mini_portile2 (2.3.0) - minitest (5.10.3) - multi_json (1.12.2) - nio4r (2.1.0) + minitest (5.11.1) + multi_json (1.13.1) + nio4r (2.2.0) nokogiri (1.8.1) mini_portile2 (~> 2.3.0) orm_adapter (0.5.0) - pg (0.21.0) - puma (3.11.0) + pg (1.0.0) + puma (3.11.2) rack (2.0.3) - rack-test (0.6.3) - rack (>= 1.0) - rails (5.0.6) - actioncable (= 5.0.6) - actionmailer (= 5.0.6) - actionpack (= 5.0.6) - actionview (= 5.0.6) - activejob (= 5.0.6) - activemodel (= 5.0.6) - activerecord (= 5.0.6) - activesupport (= 5.0.6) + rack-test (0.8.2) + rack (>= 1.0, < 3) + rails (5.2.0.beta2) + actioncable (= 5.2.0.beta2) + actionmailer (= 5.2.0.beta2) + actionpack (= 5.2.0.beta2) + actionview (= 5.2.0.beta2) + activejob (= 5.2.0.beta2) + activemodel (= 5.2.0.beta2) + activerecord (= 5.2.0.beta2) + activestorage (= 5.2.0.beta2) + activesupport (= 5.2.0.beta2) bundler (>= 1.3.0) - railties (= 5.0.6) + railties (= 5.2.0.beta2) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.2) actionpack (~> 5.x, >= 5.0.1) @@ -175,9 +180,9 @@ GEM rails_stdout_logging rails_serve_static_assets (0.0.5) rails_stdout_logging (0.0.5) - railties (5.0.6) - actionpack (= 5.0.6) - activesupport (= 5.0.6) + railties (5.2.0.beta2) + actionpack (= 5.2.0.beta2) + activesupport (= 5.2.0.beta2) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) @@ -188,7 +193,7 @@ GEM responders (2.4.0) actionpack (>= 4.2.0, < 5.3) railties (>= 4.2.0, < 5.3) - rspec-core (3.7.0) + rspec-core (3.7.1) rspec-support (~> 3.7.0) rspec-expectations (3.7.0) diff-lcs (>= 1.2.0, < 2.0) @@ -207,7 +212,7 @@ GEM rspec-support (3.7.0) ruby_parser (3.10.1) sexp_processor (~> 4.9) - sass (3.5.4) + sass (3.5.5) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) @@ -239,12 +244,12 @@ GEM thor (0.20.0) thread_safe (0.3.6) tilt (2.0.8) - turbolinks (5.0.1) - turbolinks-source (~> 5) - turbolinks-source (5.0.3) + turbolinks (5.1.0) + turbolinks-source (~> 5.1) + turbolinks-source (5.1.0) tzinfo (1.2.4) thread_safe (~> 0.1) - uglifier (4.0.2) + uglifier (4.1.4) execjs (>= 0.3.0, < 3) virtus (1.0.5) axiom-types (~> 0.1) @@ -281,7 +286,7 @@ DEPENDENCIES mini_magick (~> 4.3) pg puma (~> 3.0) - rails (~> 5.0.6) + rails (= 5.2.0.beta2) rails-controller-testing rails_12factor rspec-rails (~> 3.0) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f7c8924..237879c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,5 +1,6 @@ class ApplicationController < ActionController::Base protect_from_forgery with: :exception + before_action :configure_permitted_parameters, if: :devise_controller? def after_sign_in_path_for(resource_or_scope) # case resource @@ -16,4 +17,26 @@ def after_sign_in_path_for(resource_or_scope) def after_sign_out_path_for(resource_or_scope) root_path end + + protected + + def configure_permitted_parameters + devise_parameter_sanitizer.permit(:sign_up, keys: [ + :first_name, + :last_name, + :title, + :gender, + :city, + :state, + :country, + :personal_website, + :instagram_handle, + :twitter_handle, + :workshop, + :speaker, + :business, + :business_name, + :business_website, + ]) + end end diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb new file mode 100644 index 0000000..5a6ac95 --- /dev/null +++ b/app/controllers/registrations_controller.rb @@ -0,0 +1,23 @@ +class RegistrationsController < Devise::RegistrationsController + def new + super + end + + def edit + super + end + + def update + super + byebug + image.attach(params[:user][:image]) + end + + def create + super + end + + def destroy + super + end +end diff --git a/app/models/user.rb b/app/models/user.rb index ebbbd69..4527c47 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -6,9 +6,9 @@ class User < ApplicationRecord has_many :attendees has_many :events, through: :attendees - has_many :skills has_many :categories, through: :skills + has_one_attached :image def full_name "#{first_name} #{last_name}" diff --git a/app/views/attendees/_list.html.haml b/app/views/attendees/_list.html.haml index 54e01ca..3e552f2 100644 --- a/app/views/attendees/_list.html.haml +++ b/app/views/attendees/_list.html.haml @@ -10,6 +10,7 @@ %tbody - attendees.each do |attendee| %tr + %td= attendee.user.image %td= attendee.user %td= link_to 'Destroy', attendee, method: :delete, data: { confirm: 'Are you sure?' } diff --git a/app/views/attendees/show.html.haml b/app/views/attendees/show.html.haml index f1047f4..677d0e6 100644 --- a/app/views/attendees/show.html.haml +++ b/app/views/attendees/show.html.haml @@ -1,5 +1,7 @@ = link_to 'Back', :back += image_tag @attendee.image + %p %strong First Name: = @attendee.first_name diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index d7fdcf9..0bbea03 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -4,6 +4,7 @@ <%= f.error_notification %>