Tag: ruby-on-rails

Gem needs to append column to passed model

I cannot find out how to have my gem append a column to an existing model/table. My gem needs to check the created_at attribute of a model, and based on time passed, set an active column from true to false. I’m assuming that, upon install, it will end up needing a $ rails {gem_name}:install type […]

paperclip-dropbox gem throws wrong argument type

I’m trying to use the paperclip-dropbox gem here, and I’m having issues with the setup and passing my credentials. In the documentation, the setup in the model is done like so: class User < ActiveRecord::Base has_attached_file :avatar, :storage => :dropbox, :dropbox_credentials => “#{Rails.root}/config/dropbox.yml”, :dropbox_options => {…} end I have configured my dropbox.yml file and put […]

Best way to categorize products in rails 4 app

So, I’m trying to create a product categorization ‘system’ in my rails 4 app. Here’s what I have so far: class Category < ActiveRecord::Base has_many :products, through: :categorizations has_many :categorizations end class Product < ActiveRecord::Base include ActionView::Helpers has_many :categories, through: :categorizations has_many :categorizations end class Categorization < ActiveRecord::Base belongs_to :category belongs_to :product end Also, what […]

image not showing if there is a space between image name in rails with carrierwave

I am using carrierwave gem to upload images in rails. But my images are not showing in a slider if there a space between image name. Any help?

what is ruby-LDAP , what are its applications?

I am just about to finish my ruby book , quite stuck on LDAP topic. Does it require a server (localhost/active on internet) what is it for ?

Avatar rails generator

I am trying to find some rails gem or any API delivering some random (non figurative) picture for avatar users, as the one that SO uses. I tried gravatar but when I create some random hash and that I call the api via http://www.gravatar.com/avatar/#{hash}, I always get the same default image (independently of the hash) […]

Use HTML instead of HAML with Ruby on Rails Happy Seed

How can I use html.erb instead of haml when using a rails application that is generated using happy seed?

specify db in gemfile rails app

I want to use postgres db for my local and production environment both. How should my gemfile look like for this case? Should I completely remove sqlite and just put gem pg or the development and production environment is required with pg? Please help.

How to scrape specific strings

I want to scrape a website, for the terms (“cats”, “dogs”, “zebra”), how do I do this? I want it the result to be all the instances of the given string, & maybe even a count. I could only find ways to do it by tags, but not inside of the tags. What program or […]

centos 6 vps ruby rake issue

I am using vps centos6, ruby 1.8.7 and gem 1.3.7 when I do rake db:migrate –trace following error appear ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment rake aborted! no such file to load — readline /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original _require’ /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require’ /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/depende ncies.rb:156:in `require’ /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/depende ncies.rb:521:in `new_constants_in’ /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/depende ncies.rb:156:in `require’ /usr/local/lib/ruby/gems/1.8/gems/rush-0.6.8/lib/rush/shell.rb:1 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in […]

Ruby is the best programming language in the world - Ruby on Rails.