
I recently ran into this following code in a project that I inherited:
def get_company_doc_file(company_doc)
if Rails.env.development?
company_doc.company_file.path
else
company_doc.company_file.url
end
end
/categories/rails/index.xml

I recently ran into this following code in a project that I inherited:
def get_company_doc_file(company_doc)
if Rails.env.development?
company_doc.company_file.path
else
company_doc.company_file.url
end
end

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.

If you have recently removed ‘coffee-rails’ from your project and locally, you are getting the error LoadError - cannot load such file -- coffee_script
You need to clear the local cache:
rake tmp:cache:clear

ActiveAdmin is Rails Engine that provides an Admin Framework with tons of functionality. ActiveAdmin wraps around ActiveRecord Models and provides a standardized CRUD (create-read-update-delete) interface. Sometimes you may want a form that isn’t tied to an existing model in your Rails, to accomplish this, you can use a Form

You can find all this in the Heroku docs, I’m just filtering out the stuff I use very frequently. I will keep updating this so check back later. ALl of my examples include the -a myapp at the end because 95% of my apps have both staging and production environments so I have gotten in the habit of using this option.
Download current database:
heroku pgbackups:capture --expire
curl -o latest.dump `heroku pgbackups:url`
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U postgres -d myapp_development latest.dump

I see this in the code of others
fields = [ :last_name, :first_name, :order_number, :total, :order_date, :ship_date ]
Please don’t waste :‘s and commas because as of Ruby 2, you can simply do this: