Tuesday, August 23, 2016

Ruby Aha's

Commenting out in ERB file

single line
<%-# commented line -%>
whole block 
<% if false %>
code to comment
<% end %>

To run Rails in PRODUCTION mode

RAILS_ENV=production rails server
If you see css or javascript files being lost make sure to execute

rake assets:precompile


and then start it via

RAILS_SERVE_STATIC_FILES=true rails server -b <ip.address> -e production

Move your dev database to use posgres instead of default sqllite

Install postgress gem - Update your Gemfile 
gem "pg"

Connect it via database.yml file where you to provide database information (host, user/pass, port, etc)

Migrate database scripts into it
rake db:migrate RAILS_ENV=development

Populate sample data via seed
rake db:seed

fsff

No comments:

Post a Comment