RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: ericboehs
Building on your response, I replaced Ryan's with_last_state with this MAX(id) solution:
def self.with_last_state state
where state: state, id: select('MAX(id)').group(:order_id)
It sounds like you don't have your CORS setup right (or at all). Check that you're using the right Origin Domain (as specified in the CORS policy).
Also you should use https://s3.amazonaws.com/xyz instead as you'll get invalid certs for https://xyz.s3.amazonaws.com.
How would you go about allowing file uploads to S3 from an API (e.g. I want to allow users of my site to upload images to my service through our API)?
I'd do an upload via fog but we're using Heroku and the connection times out after 30 seconds.
I needed to validate permission of a polymorphic association with CanCan.
Hope this helps someone:
if Ability.new(user).cannot?(:comment, commentable_type.classify.constantize.find(commentable_id))
Better explanation in this Gist.
Make sure you are using the latest homebrew install of postgres (9.1.x) on Mac.
On Ubuntu/Debian you will probably need the postgres-contrib package installed for extensions.
scss has a asset-url method you can call.
background: asset-url('body-bg.gif', image);