嗨,我是RoR的初学者,在生成特定模型时遇到了一些麻烦.
我想创建2个模型 - 列表和项目.列表has_many项目和项目belongs_to列表.
我希望Item模型有3个属性. rails g model Item name:string desc:string date:????
1.要添加的数据类型 date:???
2.日期属性的格式是什么?(MM/DD/YY)?
3.它应该有什么样的表格输入?
f.date_field :date?
提前致谢!
按照教程我将基本的rails应用程序添加用户身份验证.
有一个步骤,我必须将以下代码添加到setup_mail.rb文件中
if Rails.env.development?
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
address: 'smtp.sendgrid.net',
port: '587',
authentication: :plain,
user_name: ENV['SENDGRID_USERNAME'],
password: ENV['SENDGRID_PASSWORD'],
domain: 'heroku.com',
enable_starttls_auto: true
}
end
Run Code Online (Sandbox Code Playgroud)
我添加了sendgrid插件,并将用户ID和密码也放在application.yml文件中.
但是当我注册时,我没有收到确认邮件.
交叉检查development.rb文件并确保以下代码存在
....
config.action_mailer.default_url_options = { host: 'localhost:3000' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
end
Run Code Online (Sandbox Code Playgroud)
遵循教程中的单词.因此真的很难过!谷歌把我指向了几个地方,让我更加困惑!
这就是我的迁移db文件目前的样子
class DeviseCreateUsers < ActiveRecord::Migration
def change
create_table(:users) do |t|
## Customization
t.string :name
## Database authenticatable
t.string :email, null: false, default: ""
t.string :encrypted_password, null: false, default: ""
## Recoverable
t.string …Run Code Online (Sandbox Code Playgroud)