i’m using Ruby on Rails and i want to store images into the cassandra database directly.
How can i store files with the cassandra-cql gem into the cassandra database?
And how can i display this file in an image_tag?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
First make sure that your column family validator is BytesType. Then you could insert your img into Cassandra like so:
To fetch it back out:
To serve this from rails you will need to make a controller with an action to stream the img using
send_datawithdisposition => 'inline':Then you can use image_tag to link to that controller. Take a look at this question for more info on streaming images from a controller.