(See below for link to sample project)
WHAT I HAVE WORKING:
I have many user types which I am handling using Single Table Inheritance in Rails, e.g.:
class User < ActiveRecord::Base
self.inheritance_column = :meta_type
scope :doctors, -> { where(meta_type: 'Doctor') }
scope :patients, -> { where(meta_type: 'Patient') }
scope :nurses, -> { where(meta_type: 'Nurse') }
scope :employees, -> { where(meta_type: 'Employee') }
end
class Doctor < User
has_many :doctor_patient_relations
has_many :patients, :through => :doctor_patient_relations
has_many :doctor_nurse_relations
has_many :nurses, :through => …Run Code Online (Sandbox Code Playgroud) 我试图在我的图表中添加一条水平线,相对于y轴值,问题是它们出现在错误的位置.
2条线应相对于y轴值显示在值90和140处.
我用来添加该行的代码如下:
if (before_meal !== null || after_meal !== null) {
svg.append("svg:line")
.attr("x1", 0)
.attr("x2", width)
.attr("y1", before_meal)
.attr("y2", before_meal)
.style("stroke", "rgb(189, 189, 189)");
svg.append("svg:line")
.attr("x1", 0)
.attr("x2", width)
.attr("y1", after_meal)
.attr("y2", after_meal)
.style("stroke", "rgb(189, 189, 189)");
}
Run Code Online (Sandbox Code Playgroud)
请在这里查看我的工作示例:JSFiddle
我的JSON中有两个字段:first_name和last_name.
我想使用Angular-UI使用Bootstrap typeahead.js.
<script type="text/ng-template" id="customTemplate.html">
<a>
<span bind-html-unsafe="match.label | typeaheadHighlight:query"></span>
</a>
</script>
<input type="text" ng-model="result" typeahead="patient as patient.first_name for patient in ngGridUsersData.patients | filter:{first_name:$viewValue}" typeahead-template-url="customTemplate.html">
Run Code Online (Sandbox Code Playgroud)
我还要在typeahead字段中添加什么来搜索last_name?我会在模板中添加什么来在选择时显示名字和姓氏?
如果angular-ui指令没有这个功能,那么我想我只会将名字和姓氏连接成一个字符串.
更新: 9/15/14知道如何在搜索结果中显示名字和姓氏吗?
javascript twitter-bootstrap angularjs typeahead.js angular-ui-typeahead
我正在尝试使用html模板发送邀请电子邮件.目前我正在使用像这样的aws-ses gem:
ses = AWS::SES::Base.new(
:access_key_id => 'XXXXXXXXXXXXXXX',
:secret_access_key => 'XXXXXXXXXXXXXXX')
ses.send_email(:to => ..., :source => ..., :subject => ..., :html_body => <p> Hi how are you</p>)
Run Code Online (Sandbox Code Playgroud)
我将html代码作为字符串发送到:html_body.这很好用.
我想要做的是使用一个模板,并将其存储在一个单独的文件中,例如invite_email.html.erb,该文件将存储在其中app/views/user_mailer/.
所以我想我必须使用动作邮件来使用渲染视图.我设置动作邮件程序以使用AWS :: SES gem,并按照rails指南设置动作邮件程序rails g mailer UserMailer.我有一个UserMailer,一个布局,我重新启动了服务器.我developement.rb看起来像这样:
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :ses
Run Code Online (Sandbox Code Playgroud)
我:ses在这样初始化initializers/action_mailer.rb:
ActionMailer::Base.add_delivery_method :ses, AWS::SES::Base,
access_key_id: 'XXXXX',
secret_access_key: 'XXXXX'
Run Code Online (Sandbox Code Playgroud)
服务器响应: UserMailer#invite_email: processed outbound mail in 184.0ms
问题是,我仍然没有收到任何电子邮件.我在测试环境中尝试使用相同的设置在environments/test.rb另一台机器上,但仍然没有电子邮件.服务器显示正在呈现布局并正在处理电子邮件.我错过了一个设置吗?
ruby ruby-on-rails actionmailer amazon-web-services ruby-on-rails-4