/categories/ruby/index.xml

Ruby on Rails CORS setup for Heroku with Passenger 5.0.28

Ruby on Rails CORS setup for Heroku with Passenger 5.0.28

If you are using cloudfront with Heroku, chances are you will encounter some problems if you are using something like font-awesome. I won’t go into the details of how to setup cloudfont, but your heroku passenger should have the following. First, read the Passenger Documentation for Nginx configuration template.

These are the correct steps:

1. Copy the default ngnix config

Do this in the root directory of your Rails application.

cp $(passenger-config about resourcesdir)/templates/standalone/config.erb config/passenger_config.erb

Read More

Find a Ruby hash key by value

Find a Ruby hash key by value

Let’s take a very simple Ruby hash with some US state abbreviations to their names

us_states = {
  'AK' => 'Alaska',
  'AL' => 'Alabama',
  'AR' => 'Arkansas',
  'AZ' => 'Arizona',
  'CA' => 'California',
  'CO' => 'Colorado',
  'CT' => 'Connecticut'
}

Read More

Browserify-rails vs react-rails: Winner both

Browserify-rails vs  react-rails: Winner both

Recently, I have installed browserify-rails and react-rails together in the same Ruby on Rails project. This give the best of both worlds since I can still use the react_component helper provided by react-rails but use npm to manage my versions of different React.js components. However, if you install react-rails, make sure you do not run any of the generators.

Read More