我在我的项目中使用了rails 4和postgresql 9.4.当我运行"rdd && rdc && rdm && rds"时我得到了这个错误PG :: UndefinedObject:错误:类型"jsonb"不存在如何解决这个错误?告诉我.
我的迁移文件:
class CreateConsultingLocationDoctorSchedules < ActiveRecord::Migration
def change
create_table :consulting_location_doctor_schedules do |t|
t.belongs_to :consulting_location_doctor
t.datetime :schedule_date, null: false
t.jsonb :slot_details, index: true, default: {}
t.daterange :start_and_end_time, null: false
t.datetime :deleted_at
t.belongs_to :deleted_by
t.timestamps
end
end
end
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助!
我已经使用wicked pdf gem for html to pdf generate in rails 4.它对我不起作用,它会在/events/calendar_month_print.pdf中抛出类似于ActionView :: MissingTemplate的错误.缺少模板事件/ calendar_month_print.html.erb with { :locale => [:en],:formats => [:pdf],:variants => [],:handlers => [:erb,:builder,:raw,:ruby,:rabl,:rxls,:" xls.rxls",:jbuilder]}.搜索:我也在我的应用程序中创建了calendar_month_print.html.erb文件.我不知道我在哪里丢失.
我的宝石文件
gem 'wicked_pdf'
gem 'wkhtmltopdf-binary'
Run Code Online (Sandbox Code Playgroud)
我的Controller文件
respond_to do |format|
format.html
format.pdf do
render :pdf => "monthly_events.pdf",:template => "events/calendar_month_print.html.erb"
end
end
Run Code Online (Sandbox Code Playgroud)
我的视图文件
<%= button_to "Print as pdf", calendar_month_print_events_path(format: "pdf"), :class => "btn btn-primary button monthly_print pull-right",:method => :get,target: '_blank' %>
Run Code Online (Sandbox Code Playgroud)
我的config/initializers/mime_types.rb
Mime::Type.register "application/pdf", :pdf
Run Code Online (Sandbox Code Playgroud)
我的config/initializers/wicked_pdf.rb
WickedPdf.config = { …Run Code Online (Sandbox Code Playgroud)