我正在使用设计用户身份验证,但我有很好的模型用于注册,登录等页面.我已经完成了rails generate devise:views User命令并拥有了views文件夹中的所有视图,但是,当我用自己的new.html.erb替换registration/new.html.erb时,没有任何变化也没有看起来不同.就好像我做了什么.
任何人都知道我做错了什么或者至少知道如何成功定制设计视图
PS重要的是要注意我改变了设计路线/注册#new to/signup?
所以我是AngularJS的新手,我正在尝试构建一个非常简单的列表应用程序,我可以创建一个ng-repeat项目列表,然后将所选项目推送到另一个ng-repeat列表中.虽然我的问题似乎很简单,但我还是找不到合适的解决方案.
所以这是简化的标记:
<body ng-app="MyApp">
<div id="MyApp" ng-controller="mainController">
<div id="AddItem">
<h3>Add Item</h3>
<input value="1" type="number" placeholder="1" ng-model="itemAmount">
<input value="" type="text" placeholder="Name of Item" ng-model="itemName">
<br/>
<button ng-click="addItem()">Add to list</button>
</div>
<!-- begin: LIST OF CHECKED ITEMS -->
<div id="CheckedList">
<h3>Checked Items: {{getTotalCheckedItems()}}</h3>
<h4>Checked:</h4>
<table>
<tr ng-repeat="item in checked" class="item-checked">
<td><b>amount:</b> {{item.amount}} -</td>
<td><b>name:</b> {{item.name}} -</td>
<td>
<i>this item is checked!</i>
</td>
</tr>
</table>
</div>
<!-- end: LIST OF CHECKED ITEMS -->
<!-- begin: LIST OF UNCHECKED ITEMS -->
<div id="UncheckedList">
<h3>Unchecked …Run Code Online (Sandbox Code Playgroud) 在Eclipse + Counterclockwise中,当我想连接到REPL时,对话框告诉我可以通过HTTP使用nREPL:

如何设置?这是否与吊桥有关?虽然lein repl :connect http://my.url/repl为我工作,但我无法将这些工作整合在一起.
为清楚起见,与传统REPL相比,为什么这是有用的:经典REPL仅适用于localhost.您可以通过SSH端口隧道来桥接它,但是这个 - 通过HTTP的REPL - 是远程"实时"服务器的可行替代方案.
为了完整性,服务器端:
从Rails 3.2升级到4.1后,以下的代码现在失败了:
在控制器/规范中:
post = user.posts.build
post.contacts << contact # contact is a persisted record
post.save! # now fails
Run Code Online (Sandbox Code Playgroud)
我基本上试图保存帖子及其相关的联系人,这应该是contact_publishment即时创建一个记录.错误在新contact_publishment记录上:"可发布不能为空"
该模型:
class Contact
...
has_many :contact_publishments
...
end
class ContactPublishment
...
belongs_to :publishable, polymorphic: true
belongs_to :contact
validates_uniqueness_of :publishable_id, :scope => [:contact_id, :publishable_type]
validates_presence_of :contact, :publishable
...
end
class Post
...
has_many :contact_publishments, as: :publishable
has_many :contacts, through: :contact_publishments
...
end
Run Code Online (Sandbox Code Playgroud) ruby-on-rails has-many-through polymorphic-associations ruby-on-rails-4
我在两者中设置了smtp设置,config/environments/production.rb并且development.rb我在`config/initializers/setup_mail.rb中添加了设置
config.action_mailer.default_url_options = { :host => 'ipaddress' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => 'smtp.gmail.com',
:port => 587,
:domain => 'gmail.com',
:user_name => 'EMAIL_ADDRESS@gmail.com',
:password => 'pass',
:authentication => :plain,
:enable_starttls_auto => true,
:openssl_verify_mode => 'none'
}
Run Code Online (Sandbox Code Playgroud)
配置/初始化/为setup_mail.rb
ActionMailer::Base.smtp_settings = {
:address => 'smtp.gmail.com',
:port => 587,
:domain => 'gmail.com',
:user_name => 'EMAIL_ADDRESS@gmail.com',
:password => 'pass',
:authentication => :plain,
:enable_starttls_auto => true,
:openssl_verify_mode => 'none'
}
ActionMailer::Base.default_url_options[:host] = "ipaddress"
Run Code Online (Sandbox Code Playgroud)
我收到了错误 Connection refused - connect(2) …
我只是在我的应用程序中配置了强参数,一切似乎都很好.但我的设计登录失败了.我仍然可以注册一个用户,然后登录用户.我在设计3.1.1
我添加到application_controller:
before_filter :configure_permitted_parameters, if: :devise_controller?
protected
def configure_permitted_parameters
devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:email, :password, :remember_me) }
devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:username, :email, :password) }
end
Run Code Online (Sandbox Code Playgroud)
在我的模型中
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable, :token_authenticatable, :invitable, :invite_for => 2.weeks, :authentication_keys => [:username]
Run Code Online (Sandbox Code Playgroud)
而我的日志,有一个DEPRECATION WARNING:devise:token_authenticatable已被弃用.不确定这是不是问题?
Started POST "/users/login" for 127.0.0.1 at 2013-10-09 21:54:13 +1300
DEPRECATION WARNING: devise :token_authenticatable is deprecated. Please check Devise 3.1 release notes for more information on how to upgrade. (called from <class:User> at /home/jcui/Desktop/workspace/iv/app/models/user.rb:6)
Configuration Load (0.4ms) SELECT "configurations".* …Run Code Online (Sandbox Code Playgroud) 我正在使用rails 4。我想以pdf格式显示图像,所以我安装了prawn gem文件,我的代码是
def index
text "something"
image "#{Rails.root}/images/logo.jpg"
end
Run Code Online (Sandbox Code Playgroud)
但我收到一个错误undefined method image
我想在Groovy中覆盖> =运算符,找到了这个页面,但我仍然不知道该怎么做.我有一个带有属性序列和金额的班级钞票,我希望在金额属性上实施比较基础.
基于这一个https://devcenter.heroku.com/articles/heroku-postgres-plans heroku指定数据库中的最大连接数.
我的问题是,最大连接数是否等于登录用户数?
如果我的最大限制为60,是否意味着我可以拥有最多60个登录用户?