Skip to content

Instantly share code, notes, and snippets.

import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
@constantm
constantm / application.controller.js
Last active September 13, 2015 11:27
opportunity-select
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
@constantm
constantm / gist:0aa3d8398e72e4f5e7fe
Created August 21, 2015 14:18
Check whether paperclip attachment is exists in callback
In our app, we need to work out user profile completeness when a profile is saved. This is done via a callback. In this callback, we also check for the existance of Paperclip attachments.
This should supposedly be done with the following:
`@user.document.exists?`
That, however, returns false in the callback while a file is being uploaded. It looks like it's stuck in limbo between deleting the old file and saving the new one. A solution to this is to simply use the following:
`@user.document?`
@constantm
constantm / Ruby countries hash
Last active October 27, 2016 01:52 — forked from vxnick/gist:380904
Ruby countries hash
countries = {
'AF' => 'Afghanistan',
'AX' => 'Aland Islands',
'AL' => 'Albania',
'DZ' => 'Algeria',
'AS' => 'American Samoa',
'AD' => 'Andorra',
'AO' => 'Angola',
'AI' => 'Anguilla',
'AQ' => 'Antarctica',