From 0a207dc9d5c8c1c56366e2e3f6ceb53070c61976 Mon Sep 17 00:00:00 2001 From: Aaron Tian Date: Sat, 21 Mar 2009 22:37:12 +0800 Subject: [PATCH] update to rails 2.3.2 --- ...{application.rb => application_controller.rb} | 0 app/controllers/users_controller.rb | 4 ++-- app/views/parts/new.html.haml | 4 ++-- app/views/users/new.html.haml | 3 +++ config/environment.rb | 6 ++++-- config/preinitializer.rb | 16 ++++++++-------- 6 files changed, 19 insertions(+), 14 deletions(-) rename app/controllers/{application.rb => application_controller.rb} (100%) diff --git a/app/controllers/application.rb b/app/controllers/application_controller.rb similarity index 100% rename from app/controllers/application.rb rename to app/controllers/application_controller.rb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 69d345a..f808fc0 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -5,10 +5,10 @@ def new end def create - User.create!(params[:user]) + @user = User.new(params[:user]) + @user.save! redirect_to account_url rescue - @user = User.new render :action => :new end diff --git a/app/views/parts/new.html.haml b/app/views/parts/new.html.haml index c785a81..c900249 100644 --- a/app/views/parts/new.html.haml +++ b/app/views/parts/new.html.haml @@ -5,8 +5,8 @@ .upload-part - form_for @part, :html => {:multipart => true} do |f| .field - = f.label :desc, '名称' - = f.text_field :desc + = f.label :name, '名称' + = f.text_field :name .field = f.label :upload_file, '选择图纸' = f.file_field :upload_file diff --git a/app/views/users/new.html.haml b/app/views/users/new.html.haml index 8cee152..9d9d8b2 100644 --- a/app/views/users/new.html.haml +++ b/app/views/users/new.html.haml @@ -4,6 +4,9 @@ .field = f.label :login, '用户名:' = f.text_field :login + .field + = f.label :login, 'E-mail:' + = f.text_field :email .field = f.label :password, '密码:' = f.password_field :password diff --git a/config/environment.rb b/config/environment.rb index e6413fe..e5f6d12 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,6 +1,6 @@ #APP_ROOT = 'E:/workspace/pps' -RAILS_GEM_VERSION = '2.2.2' unless defined? RAILS_GEM_VERSION +RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION require File.join(File.dirname(__FILE__), 'boot') @@ -15,7 +15,7 @@ # use numeric prefix migration name conventions config.active_record.timestamped_migrations = false - config.gem 'haml', :version => '>= 2.0.4' + config.gem 'haml', :version => '>= 2.0.9' config.gem 'authlogic', :version => '>= 1.4.3' config.gem 'mini_magick', :version => '>= 1.2.3' config.gem 'sqlite3-ruby', :lib => 'sqlite3' @@ -25,3 +25,5 @@ # ? 'application/octet-stream' # SolidWorks Part's MimeType is 'application/presentations' or 'image/x-presentations' Mime::Type.register 'application/octet-stream', :sldprt +ActionView::Helpers::InstanceTag.const_set(:DEFAULT_FIELD_OPTIONS, {}) +ActionView::Helpers::InstanceTag.const_set(:DEFAULT_TEXT_AREA_OPTIONS, {:rows => 5}) diff --git a/config/preinitializer.rb b/config/preinitializer.rb index d0609c4..aca31f1 100644 --- a/config/preinitializer.rb +++ b/config/preinitializer.rb @@ -1,9 +1,9 @@ # overwite the defaults text_field options -module ActionView - module Helpers - class InstanceTag - DEFAULT_FIELD_OPTIONS = {} - DEFAULT_TEXT_AREA_OPTIONS = {:rows => 5} - end - end -end +#module ActionView +# module Helpers +# class InstanceTag +# DEFAULT_FIELD_OPTIONS = {} +# DEFAULT_TEXT_AREA_OPTIONS = {:rows => 5} +# end +# end +#end