Mks::Rate::UnitOfCharge.create(name: 'M2/Day', unit_variables: JSON({ Meter: 'number', Day: 'number' })) Mks::Rate::UnitOfCharge.create(name: 'M3/Hr', unit_variables: JSON({Meter: 'number', Hour: 'number'})) app_module = Mks::Auth::ApplicationModule.where(code: 'RMM', name: 'Rate Management Module').first_or_create rate_owner = Mks::Auth::UserRole.where(name: 'RATE_OWNER', application_module_id: app_module.id).first_or_create rate_staff = Mks::Auth::UserRole.where(name: 'RATE_STAFF', application_module_id: app_module.id).first_or_create menu1 = Mks::Auth::Menu.where(text: 'Service Definition', icon_cls: 'fa-calendar', application_module_id: app_module.id).first_or_create menu5 = Mks::Auth::Menu.where(text: 'Rate Definition', application_module_id: app_module.id).first_or_create Mks::Auth::Menu.where(text: 'Service Delivery Unit', parent_id: menu1.id, location: 'service-delivery-units', icon_cls: 'fa-list', application_module_id: app_module.id).first_or_create Mks::Auth::Menu.where(text: 'Service Bundle', parent_id: menu1.id, location: 'service-bundles', icon_cls: 'fa-clone', application_module_id: app_module.id).first_or_create Mks::Auth::Menu.where(text: 'Chargeable Service', parent_id: menu1.id, location: 'chargeable-services', icon_cls: 'fa-list-alt', application_module_id: app_module.id).first_or_create m = Mks::Auth::Menu.where(text: 'Rate Change Request', parent_id: menu5.id, location: 'rate-change-requests', icon_cls: 'fa-stack-exchange', application_module_id: app_module.id).first_or_create m1 = Mks::Auth::Menu.where(text: 'Working Rates', parent_id: menu5.id, location: 'working-rates', icon_cls: 'fa-stack-exchange', application_module_id: app_module.id).first_or_create rate_owner_menu = rate_owner.menus.where(application_module_id: app_module.id) rate_owner.menus.delete(rate_owner_menu) rate_owner.menus << menu5 rate_owner.menus << menu5.children rate_staff_menu = rate_staff.menus.where(application_module_id: app_module.id) rate_staff.menus.delete(rate_staff_menu) rate_staff.menus << menu1 rate_staff.menus << menu1.children rate_staff.menus << m u3 = Mks::Auth::User.where(first_name: 'Bisrat', last_name: 'R.') if u3.empty? u3 = Mks::Auth::User.create(first_name: 'Bisrat', last_name: 'R.', email: 'bisrat@gmail.com', active: true, application_modules: [app_module], password: 'bisrat123') u3.roles << rate_owner u3.roles << rate_staff end