Sha256: eb7524ccdc6f44ecb41fccc8dba55ea469dcd3312884d615d0984d862b6c1adb

Contents?: true

Size: 705 Bytes

Versions: 5

Compression:

Stored size: 705 Bytes

Contents

class AddOrdersWidget
  
  def self.up
    #insert data here
    if Widget.find_by_internal_identifier('order_management').nil?
      app = Application.find_by_internal_identifier('crm')

      orders = Widget.create(
          :description => 'Order Managament',
          :internal_identifier => 'order_management',
          :icon => 'icon-grid',
          :xtype => 'partyorderstab'
        )

      unless app.nil?
        app.widgets << orders
        app.save
      end
      
      orders.roles << Role.find_by_internal_identifier('admin')
      orders.save      
    end
  end
  
  def self.down
    #remove data here
    Widget.find_by_internal_identifier('order_management').destroy
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
erp_orders-3.0.5 db/data_migrations/20120229174343_add_orders_widget.rb
erp_orders-3.0.4 db/data_migrations/20120229174343_add_orders_widget.rb
erp_orders-3.0.3 db/data_migrations/20120229174343_add_orders_widget.rb
erp_orders-3.0.2 db/data_migrations/20120229174343_add_orders_widget.rb
erp_orders-3.0.1 db/data_migrations/20120229174343_add_orders_widget.rb