- def self.show rid, opt = {}
- r = LicenseGroup.find(rid, :include => self.show_include_opt(opt))
-# raise ActiveRecord::Forbidden unless c.visible?(au)
+ 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