- def self.show_include_opt opt = {}
- res = {:licenses => {}}
- res.push(opt[:include]) if opt[:include]
- res
+ def self.store name, attr
+ #ライセンスデータがあるとライセンスグループのデータ生成で邪魔するので移しておく
+ lattr = attr["licenses_attributes"]
+ attr.delete "licenses_attributes"
+ #ライセンスグループを先に保存してidを決める
+ r = LicenseGroup.modify_object name, attr
+ r.save
+ #取っておいたライセンスデータとidでライセンス作成
+ if (c = License.stores(lattr, r.id)) > 0
+ r.errors.add :base, License.model_name.human + I18n.t('errors.not_create')
+ end
+ r