RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: ericboehs
Site: http://ericboehs.com
Building on your response, I replaced Ryan's with_last_state with this MAX(id) solution:
with_last_state
MAX(id)
class OrderEvent def self.with_last_state state where state: state, id: select('MAX(id)').group(:order_id) end end
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:
validate :can_comment? def can_comment? if Ability.new(user).cannot?(:comment, commentable_type.classify.constantize.find(commentable_id)) errors.add(:base, :cannot_comment) end end
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);
Building on your response, I replaced Ryan's
with_last_state
with thisMAX(id)
solution: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:
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.