Solidus: Enable checkout in Indian currency and setting up Shipping Methods

add Lines

# Change default country and currency
# Check if table already exists
if ActiveRecord::Base.connection.tables.include?('spree_countries')
Spree.config do |config|
config.currency = 'INR'
country = Spree::Country.find_by_name('India')
config.default_country_id = if country.present?
# Change default country and currency

Checking for existence of spree_countries table is required. When you run migration for the first time, there will be no table, therefore migration will not work.

Rails 4: hack for creating mysql table without auto_increment

I came across an issue when I was trying to create a zipcodes table with `code` as primary key and I didn’t want AUTO_INCREMENT.

I wrote below migration-

class CreateZipcodesTable < ActiveRecord::Migration def change create_table :zipcodes, :id => false do |t|
t.integer :code, :null => false
t.integer :state_id, null: false
t.string :city, limit: 255
t.string :state_code, limit: 2, null: false
add_index :zipcodes, :code, :unique => true