From 59a48f43efa4f86a69a45beffc8e8fd59934a5a7 Mon Sep 17 00:00:00 2001 From: ParisZX Date: Sun, 25 Aug 2013 14:33:49 +0300 Subject: [PATCH 1/2] update for rails 4.0.0 --- Gemfile | 6 +- Gemfile.lock | 157 +++++++++--------- .../bootstrap_and_overrides.css.less | 13 +- app/controllers/uploads_controller.rb | 7 +- app/models/upload.rb | 1 - 5 files changed, 96 insertions(+), 88 deletions(-) diff --git a/Gemfile b/Gemfile index e39d153..de326f7 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' -gem 'rails', '3.2.13' +gem 'rails', '4.0.0' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' @@ -10,9 +10,9 @@ gem 'sqlite3' # Gems used only for assets and not required # in production environments by default. group :assets do - gem 'sass-rails', '~> 3.2.3' + gem 'sass-rails', '4.0.0' gem 'less-rails' - gem 'coffee-rails', '~> 3.2.1' + gem 'coffee-rails', '4.0.0' # See https://github.com/sstephenson/execjs#readme for more supported runtimes gem 'therubyracer', :platforms => :ruby diff --git a/Gemfile.lock b/Gemfile.lock index 71a3dc0..c8182fd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,130 +1,123 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (3.2.13) - actionpack (= 3.2.13) + actionmailer (4.0.0) + actionpack (= 4.0.0) mail (~> 2.5.3) - actionpack (3.2.13) - activemodel (= 3.2.13) - activesupport (= 3.2.13) - builder (~> 3.0.0) + actionpack (4.0.0) + activesupport (= 4.0.0) + builder (~> 3.1.0) erubis (~> 2.7.0) - journey (~> 1.0.4) - rack (~> 1.4.5) - rack-cache (~> 1.2) - rack-test (~> 0.6.1) - sprockets (~> 2.2.1) - activemodel (3.2.13) - activesupport (= 3.2.13) - builder (~> 3.0.0) - activerecord (3.2.13) - activemodel (= 3.2.13) - activesupport (= 3.2.13) - arel (~> 3.0.2) - tzinfo (~> 0.3.29) - activeresource (3.2.13) - activemodel (= 3.2.13) - activesupport (= 3.2.13) - activesupport (3.2.13) - i18n (= 0.6.1) - multi_json (~> 1.0) - arel (3.0.2) - builder (3.0.4) + rack (~> 1.5.2) + rack-test (~> 0.6.2) + activemodel (4.0.0) + activesupport (= 4.0.0) + builder (~> 3.1.0) + activerecord (4.0.0) + activemodel (= 4.0.0) + activerecord-deprecated_finders (~> 1.0.2) + activesupport (= 4.0.0) + arel (~> 4.0.0) + activerecord-deprecated_finders (1.0.3) + activesupport (4.0.0) + i18n (~> 0.6, >= 0.6.4) + minitest (~> 4.2) + multi_json (~> 1.3) + thread_safe (~> 0.1) + tzinfo (~> 0.3.37) + arel (4.0.0) + atomic (1.1.13) + builder (3.1.4) climate_control (0.0.3) activesupport (>= 3.0) cocaine (0.5.1) climate_control (>= 0.0.3, < 1.0) - coffee-rails (3.2.2) + coffee-rails (4.0.0) coffee-script (>= 2.2.0) - railties (~> 3.2.0) + railties (>= 4.0.0.beta, < 5.0) coffee-script (2.2.0) coffee-script-source execjs - coffee-script-source (1.6.2) + coffee-script-source (1.6.3) commonjs (0.2.6) erubis (2.7.0) - execjs (1.4.0) - multi_json (~> 1.0) - hike (1.2.2) - i18n (0.6.1) - journey (1.0.4) + execjs (2.0.0) + hike (1.2.3) + i18n (0.6.5) jquery-fileupload-rails (0.4.1) actionpack (>= 3.1) railties (>= 3.1) - jquery-rails (2.2.1) + jquery-rails (3.0.4) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) - json (1.7.7) less (2.3.2) commonjs (~> 0.2.6) less-rails (2.3.3) actionpack (>= 3.1) less (~> 2.3.1) - libv8 (3.11.8.17) - mail (2.5.3) - i18n (>= 0.4.0) + libv8 (3.16.14.3) + mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) - mime-types (1.22) - multi_json (1.7.2) - paperclip (3.4.1) + mime-types (1.24) + minitest (4.7.5) + multi_json (1.7.9) + paperclip (3.5.1) activemodel (>= 3.0.0) - activerecord (>= 3.0.0) activesupport (>= 3.0.0) cocaine (~> 0.5.0) mime-types polyglot (0.3.3) - rack (1.4.5) - rack-cache (1.2) - rack (>= 0.4) - rack-ssl (1.3.3) - rack + rack (1.5.2) rack-test (0.6.2) rack (>= 1.0) - rails (3.2.13) - actionmailer (= 3.2.13) - actionpack (= 3.2.13) - activerecord (= 3.2.13) - activeresource (= 3.2.13) - activesupport (= 3.2.13) - bundler (~> 1.0) - railties (= 3.2.13) - railties (3.2.13) - actionpack (= 3.2.13) - activesupport (= 3.2.13) - rack-ssl (~> 1.3.2) + rails (4.0.0) + actionmailer (= 4.0.0) + actionpack (= 4.0.0) + activerecord (= 4.0.0) + activesupport (= 4.0.0) + bundler (>= 1.3.0, < 2.0) + railties (= 4.0.0) + sprockets-rails (~> 2.0.0) + railties (4.0.0) + actionpack (= 4.0.0) + activesupport (= 4.0.0) rake (>= 0.8.7) - rdoc (~> 3.4) - thor (>= 0.14.6, < 2.0) - rake (10.0.4) - rdoc (3.12.2) - json (~> 1.4) - ref (1.0.4) - sass (3.2.7) - sass-rails (3.2.6) - railties (~> 3.2.0) + thor (>= 0.18.1, < 2.0) + rake (10.1.0) + ref (1.0.5) + sass (3.2.10) + sass-rails (4.0.0) + railties (>= 4.0.0.beta, < 5.0) sass (>= 3.1.10) - tilt (~> 1.3) - sprockets (2.2.2) + sprockets-rails (~> 2.0.0) + sprockets (2.10.0) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - sqlite3 (1.3.7) - therubyracer (0.11.4) - libv8 (~> 3.11.8.12) + sprockets-rails (2.0.0) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (~> 2.8) + sqlite3 (1.3.8) + therubyracer (0.12.0) + libv8 (~> 3.16.14.0) ref thor (0.18.1) - tilt (1.3.7) - treetop (1.4.12) + thread_safe (0.1.2) + atomic + tilt (1.4.1) + treetop (1.4.15) polyglot polyglot (>= 0.3.1) - twitter-bootstrap-rails (2.2.6) + twitter-bootstrap-rails (2.2.8) actionpack (>= 3.1) execjs + rails (>= 3.1) railties (>= 3.1) tzinfo (0.3.37) - uglifier (2.0.1) + uglifier (2.1.2) execjs (>= 0.3.0) multi_json (~> 1.0, >= 1.0.2) @@ -132,13 +125,13 @@ PLATFORMS ruby DEPENDENCIES - coffee-rails (~> 3.2.1) + coffee-rails (= 4.0.0) jquery-fileupload-rails jquery-rails less-rails paperclip - rails (= 3.2.13) - sass-rails (~> 3.2.3) + rails (= 4.0.0) + sass-rails (= 4.0.0) sqlite3 therubyracer twitter-bootstrap-rails diff --git a/app/assets/stylesheets/bootstrap_and_overrides.css.less b/app/assets/stylesheets/bootstrap_and_overrides.css.less index 94bc140..a0174e3 100644 --- a/app/assets/stylesheets/bootstrap_and_overrides.css.less +++ b/app/assets/stylesheets/bootstrap_and_overrides.css.less @@ -18,7 +18,7 @@ body { @fontAwesomeTtfPath: asset-path("fontawesome-webfont.ttf?v=3.0.2"); // Font Awesome -@import "fontawesome"; +@import "fontawesome/font-awesome"; // Glyphicons //@import "twitter/bootstrap/sprites.less"; @@ -33,3 +33,14 @@ body { // // Example: // @linkColor: #ff0000; + +// Set the correct sprite paths +@iconSpritePath: asset-path("twitter/bootstrap/glyphicons-halflings"); +@iconWhiteSpritePath: asset-path("twitter/bootstrap/glyphicons-halflings-white"); + +// Set the Font Awesome (Font Awesome is default. You can disable by commenting below lines) +@fontAwesomeEotPath: asset-url("fontawesome-webfont.eot"); +@fontAwesomeEotPath_iefix: asset-url("fontawesome-webfont.eot#iefix"); +@fontAwesomeWoffPath: asset-url("fontawesome-webfont.woff"); +@fontAwesomeTtfPath: asset-url("fontawesome-webfont.ttf"); +@fontAwesomeSvgPath: asset-url("fontawesome-webfont.svg#fontawesomeregular"); \ No newline at end of file diff --git a/app/controllers/uploads_controller.rb b/app/controllers/uploads_controller.rb index 4f7ea64..afdfb32 100644 --- a/app/controllers/uploads_controller.rb +++ b/app/controllers/uploads_controller.rb @@ -40,7 +40,7 @@ def edit # POST /uploads # POST /uploads.json def create - @upload = Upload.new(params[:upload]) + @upload = Upload.new(upload_params) respond_to do |format| if @upload.save @@ -84,4 +84,9 @@ def destroy format.json { head :no_content } end end + + private + def upload_params + params.require(:upload).permit(:upload) + end end diff --git a/app/models/upload.rb b/app/models/upload.rb index d2049d6..4dce87d 100644 --- a/app/models/upload.rb +++ b/app/models/upload.rb @@ -1,5 +1,4 @@ class Upload < ActiveRecord::Base - attr_accessible :upload has_attached_file :upload include Rails.application.routes.url_helpers From 47015d21030c8b18427c83573be9db0ea701b40b Mon Sep 17 00:00:00 2001 From: Paraskevas Lagakis Date: Sun, 25 Aug 2013 14:39:35 +0300 Subject: [PATCH 2/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b0591a0..ee099c5 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ This is an example app that uses the following gems to upload files for your Rai This app also uses [twitter-bootstrap-rails](https://github.com/seyhunak/twitter-bootstrap-rails) but is not required. -This app uses Rails 3.2.13. +This app uses Rails 4.0.0. ## Running the app