美好的一天
我有模特儿 餐饮 Dayoffer我们食堂里记录所有食物的食物
// hc is HiveContext, df is DataFrame.
df.write.mode(SaveMode.Overwrite).parquet(path)
val sql =
s"""
|alter table $targetTable
|add if not exists partition
|(year=$year,month=$month)
|location "$path"
""".stripMargin
hc.sql(sql)
Dailyoffer是一天限量提供的限制食品。
class Food < ApplicationRecord
belongs_to :supplier
has_many :dayoffer
end
我不知道如何有效地保存一天的选择 我有想法在表单collection_check_boxes中使用,但不知道如何有效地处理它。
db的架构 https://gist.github.com/netmoleCBA/089950c54a4b8e066da8afc54fa5a62e
答案 0 :(得分:0)
添加一个WeekDay模型,该模型在您的数据库中有许多商品和种子七周工作日:
以食物形式:
<%= f.collection_check_boxes(:week_day_ids, WeekDay.all, :id, :name) do |week_day| %>
<%= week_day.label { week_day.check_box } %>
<% end %>
忘记在控制器的强力参数中添加week_day_ids
params.require(:food).permit(:name, week_day_ids:[])