Ruby on rails 在我的应用程序中使用design
我随后介绍了Desive的教程: 我问这个问题是因为localhost:3000/users/registration/sign\u让我看到一个错误页面:Ruby on rails 在我的应用程序中使用design,ruby-on-rails,devise,Ruby On Rails,Devise,我随后介绍了Desive的教程: 我问这个问题是因为localhost:3000/users/registration/sign\u让我看到一个错误页面: Showing /home/alon/.rvm/gems/ruby-1.9.3-p327/gems/devise-1.1.rc0/app/views/devise/registrations/new.html.erb where line #3 raised: undefined method `user_registration_path
Showing /home/alon/.rvm/gems/ruby-1.9.3-p327/gems/devise-1.1.rc0/app/views/devise/registrations/new.html.erb where line #3 raised:
undefined method `user_registration_path' for #<#<Class:0xb6388a90>:0xb63874b0>
Extracted source (around line #3):
1: <h2>Sign up</h2>
2:
3: <%= form_for(resource_name, resource, :url => registration_path(resource_name)) do |f| %>
4: <%= f.error_messages %>
5: <p><%= f.label :email %></p>
6: <p><%= f.text_field :email %></p>
Rails.root: /home/alon/projects/TODOLIST
我不能退出他的项目吗:github.com/plataformatec/designe?如果是这样,我会得到我所需要的一切,对吗?
我是通过:git克隆来实现的git@github.com:josevalim/designe.git
如果答案是否定的
以下是我执行的步骤:
步骤1)rails新TODOLIST
步骤2)轨道-v
Rails 3.2.9
步骤3)sudo gem安装装置——版本=1.1.rc0
[sudo] password for alon:
sudo: gem: command not found
步骤4)编辑GEM文件
:
source 'https://rubygems.org'
gem 'rails', '3.2.9'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'devise', '1.1.rc0'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
步骤5)捆绑安装
步骤6)rails生成设备安装
步骤7)编辑routes.rb:
TODOLIST::Application.routes.draw do
devise_for :users
root :to => "home#index"
end
步骤8)编辑development.rb:
TODOLIST::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
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# 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
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
# Raise exception on mass assignment protection for Active Record models
config.active_record.mass_assignment_sanitizer = :strict
# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
config.active_record.auto_explain_threshold_in_seconds = 0.5
# Do not compress assets
config.assets.compress = false
# Expands the lines which load the assets
config.assets.debug = true
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
end
步骤9)rails生成设计用户
步骤10)编辑user.rb:
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :lockable, :timeoutable, :confirmable and :activatable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation
# attr_accessible :title, :body
end
这与您的设计版本有关
不要将Desive 1与rails 3.2一起使用。。。将设备版本升级到2>这与设备版本相关 不要将Desive 1与rails 3.2一起使用。。。将您的Desive版本升级到2>
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :lockable, :timeoutable, :confirmable and :activatable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation
# attr_accessible :title, :body
end
class DeviseCreateUsers < ActiveRecord::Migration
def self.up
create_table(:users) do |t|
t.database_authenticatable :null => false
# t.confirmable
t.recoverable
t.rememberable
t.trackable
# t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
t.timestamps
end
add_index :users, :email, :unique => true
#add_index :users, :confirmation_token, :unique => true
add_index :users, :reset_password_token, :unique => true
# add_index :users, :unlock_token, :unique => true
end
def self.down
drop_table :users
end
end
new_user_session GET /users/sign_in(.:format) devise/sessions#new
user_session POST /users/sign_in(.:format) devise/sessions#create
destroy_user_session GET /users/sign_out(.:format) devise/sessions#destroy
password POST /users/password(.:format) devise/passwords#create {:name_prefix=>:user}
new_password GET /users/password/new(.:format) devise/passwords#new {:name_prefix=>:user}
edit_password GET /users/password/edit(.:format) devise/passwords#edit {:name_prefix=>:user}
PUT /users/password(.:format) devise/passwords#update {:name_prefix=>:user}
POST /users/registration(.:format) devise/registrations#create {:name_prefix=>"user_registration"}
new GET /users/registration/sign_up(.:format) devise/registrations#new {:name_prefix=>"user_registration"}
edit GET /users/registration/edit(.:format) devise/registrations#edit {:name_prefix=>"user_registration"}
PUT /users/registration(.:format) devise/registrations#update {:name_prefix=>"user_registration"}
DELETE /users/registration(.:format) devise/registrations#destroy {:name_prefix=>"user_registration"}
root / home#index