Compiling and Serving Assets (JavaScript/CSS) in Production Environment -Rails 6

In order to server assets in Production environment; assets are first compiled and put into /public/assets directory. So, first you need to run the following command to compile the assets.

RAILS_ENV=production rails assets:precompile

It is encouraged to serve static content using NGINX/Apache. But if you want rails to serve the contents add/modify the following line on production.rb

config.public_file_server.enabled = true

In case you are facing anomaly and confident your code is correct then try clearing the cache using

rails tmp:cache:clear

 151 total views,  2 views today

Ruby Method for encoding Bangla Unicode Text to Hex Value to Send Bangla SMS using SSLWireless

The following ruby method converts an Bengali Text to Hex value.

def encode_for_bangla_sms( text )
	text.encode('utf-16be').unpack('H*').to_s.gsub!(/\W/,'').upcase
end

text_bangla = "১ ২ ৩, ১ ২ ৩ "
text_encoded = encode_for_bangla_sms text_bangla
#09E7002009E8002009E9002C002009E7002009E8002009E90020

SSLWireless providers a different stakeholder id for Bangla SMS. So if you use that along with the hex value, you should receive the Bangla text.

 50 total views,  2 views today

Adding Ruby SDK to RubyMine from rbenv wsl

Run the following to get the ruby bin path

rbenv which ruby

You should get a path like the following

/home/user/.rbenv/versions/2.6.1/bin/ruby

Now on RubyMine type Alt + Ctl + S to open settings and search for ‘sdk’. Under Languages & Frameworks you will find Ruby SDK and GEM; select it. Now click on the + icon and select ‘New Remote’. Now Select WSL, choose the linux invironment and paste the link we copied earlier. Now your SDK should be added to RubyMine.

 34 total views,  3 views today