Ruby on rails

Best way to alter user input in rails

What i’ve got currently is a textarea that takes in a comma separated string of words that i want to serialize as an array in the DB. I’ve got a model that serializes an array class Ipsum < ActiveRecord::Base serialize :words, Array validates :title, presence: true, uniqueness: true end Currently in my controller, I take the user input from the…
Read more

The best technology to use when generating pictures

I want to generate some picture, graphs to be more specific. I would like them to render in a webpage. I figured out that it’s fairly easy to generate graph as pictures using javascript and HTML5 canvas. But I realized that this might not be a good option, because javascript renders at client’s side and calculating the graph may be…
Read more

Rails exists? Case insensitive

Model.exists?(“lower(email) = ?”, params[:email].downcase) Returns error: ArgumentError (wrong number of arguments (2 for 0..1)): Is it possible to do a exists? with a case insensitive match? Source: ruby

Fetching all user’s pictures with the Instagram gem

I’d like to fetch all my pictures using the instagram gem (https://github.com/Instagram/instagram-ruby-gem) but I’m not able to find out how. This is what I’m trying so far: client = Instagram.client(access_token: token) client.user_recent_media.each do |media| puts media.images.thumbnail.url end It apparently works (those are my Instagram images) but I’m not able to fetch all of them or to select in any way…
Read more