Download all gems dependencies

That’s precisely the problem I had. After searching around for a while I found a solution that works using Bundler https://bundler.io/ Getting Gem with Dependencies: Create a new Folder with a File named Gemfile. Write a Source and the Gem you want to have the dependencies for into the File Example: source “http://rubygems.org” gem ‘rails’, … Read more

Ruby’s double colon (::) operator usage differences

Constants in Ruby are nested like files and directories in filesystem. So, constants are uniquely identified by their paths. To draw an analogy with the file system: ::Rails::Engine #is an absolute path to the constant. # like /Rails/Engine in FS. Rails::Engine #is a path relative to the current tree level. # like ./Rails/Engine in FS. … Read more

Retrieving array of ids in Mongoid

Remember that the ID is stored as :_id and not :id . There is an id helper method, but when you do queries, you should use :_id: User.where(:_id.in => arr) Often I find it useful to get a list of ids to do complex queries, so I do something like: user_ids = User.only(:_id).where(:foo => :bar).distinct(:_id) … Read more

Ruby / Sinatra – serving up css, javascript, or image files

Sinatra and Rails use the path public for static content – e.g., ./public/javascripts/. All files in these paths would then be served by the web server (e.g. Thin, Passenger), but without the need for /public in the URL (e.g. the file at #{my_app_root}/public/javascripts/application.js would be available via the Web at the URL http://#{my_domain}/javascripts/application.js).

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)