当新用户提交新的用户注册表单时,他们会收到以下错误消息.我怀疑它是因为devise/registrations_controller.rb不存在.
我是否需要创建此文件夹结构和控制器,还是可以修改routes.rb以避免搜索不存在的控制器?
错误:
ArgumentError in Devise::RegistrationsController#create
wrong number of arguments (0 for 1)
Rails.root: C:/Users/COMPAQ/Documents/NetBeansProjects/RailsBlog
Parameters:
{"utf8"=>"?",
"authenticity_token"=>"xxxxxxxxxxxxxxxxxxxxxx/c=",
"user"=>{"email"=>"foo@bar.com",
"password"=>"[FILTERED]",
"password_confirmation"=>"[FILTERED]"},
"commit"=>"Sign up"}
Run Code Online (Sandbox Code Playgroud)
routes.rb中:
RailsBlog::Application.routes.draw do
devise_for :users
Run Code Online (Sandbox Code Playgroud)
User.rb(型号):
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable,
# :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me
attr_accessible :name, :email, :password, :password_confirmation
has_secure_password
#has_many :microposts, dependent: :destroy …Run Code Online (Sandbox Code Playgroud) 我正在尝试运行一个从Github上取下的应用程序.
我已经开始bundle install从中安装所需的宝石了Gemfile.但是,在运行应用程序时,一条错误消息告诉我安装的gem是错误的版本.
在检查时Gemfile.lock我注意到版本比安装的宝石旧.(即我安装了更新版本的宝石,应用程序需要较旧的宝石.)
有没有根据Gemfile.lock文件中描述的版本快速安装所有gem?或者有一种方法可以忽略该文件吗?
的Gemfile:
source 'http://rubygems.org'
gem 'rails', "3.0.9"
gem "sass"
..
Run Code Online (Sandbox Code Playgroud)
Gemfile.lock的:
sass (3.1.1)
..
Run Code Online (Sandbox Code Playgroud)
在上面的示例中,即使安装了sass,该应用程序也特别需要3.1.1版本.
我目前正在运行安装了WAMP的Windows 7.
我正在尝试安装PHP Simple HTML DOM Parser(http://simplehtmldom.sourceforge.net/)来运行以下代码.
我收到致命的错误消息.这很可能是因为DOM Parser未安装或未安装在正确的位置.
如何安装Parser?我只是将其复制到WAMP文件夹中,还是从php文件中调用它?
错误:
Fatal error: Call to undefined function file_get_html() in
C:\wamp\www\PHP_SCRAPER\_jobs\jobs_dom.php on line 4
<?php
Run Code Online (Sandbox Code Playgroud)
码:
// Create DOM from URL or file
$html = file_get_html('http://www.google.com');
// Find all images
foreach($html->find('img') as $element)
echo $element->src . '<br>';
// Find all links
foreach($html->find('a') as $element)
echo $element->href . '<br>';
?>
Run Code Online (Sandbox Code Playgroud)