Bundler not recognizing local gem path

For a site on its current server, running bundle install --path vendor/bundle --full-index runs with no issues. However, when I run this for the same site on my new server (same version of Bundler), I get: NoMethodError: undefined method `spec' for ...
more »

2017-06-20 23:06 (1) Answers

what locale does I18n.locale.to_s in rails return

I am not able to get what locale string I18n.locale.to_s returns. Is it the locale where the code runs (ie. the locale of the server where the code is deployed) or is it fetching locale from the request (the locale from where the URL is requested)? ...
more »

2017-06-20 19:06 (1) Answers

Rails - In-app "database seed" button?

I'm building a Rails app for my company. My seeds.rb file contains code to sync my list of users with our Office 365 directory, which needs to happen every time something changes in the directory, and I'm trying to build an in-app "seed" button so th...
more »

2017-06-20 17:06 (2) Answers

El Capitan: Can't install capybara-webkit

I couldn't bundle since there was an error occurred while installing capybara-webkit (1.11.1). So I tried gem install capybara-webkit -v '1.11.1', but it returned en error: Failed to build gem native extension. I'm not even sure what does it mean. T...
more »

2017-06-19 11:06 (2) Answers

How to find a object and insert it in a database

I’m trying to pick up the shop_id and subscription_id from a cart and insert/save them into the purchase database. I have a cart, line_items and subscriptions. And this is how I’m trying to do this: @purchase = @cart.line_items.build @purcha...
more »

2017-06-18 15:06 (1) Answers

PG::ConnectionBad, could not connect to server

I'm having issues with a rails app me and few others are working on. I just cloned the repo, and doing either rails db:migrate or trying to reach a page (while the server is running) leads to this error: Started GET "/" for at 2017-06-18 1...
more »

2017-06-18 13:06 (1) Answers

Removing gem elasticsearch-extensions

In Rails 5, I've had the following gems in my Gemfile: gem 'chewy' gem 'elasticsearch-model' gem 'elasticsearch-extensions' I'm trying to remove elasticsearch from my project but after removing the 'elasticsearch-extensions' gem, and then bundli...
more »

2017-06-17 23:06 (0) Answers

De duplication of hashes and arrays

I have an array of hashes lets say offers = {offer1,...,offer6}. Each offer is a hash. Each offer has various keys one of which is a price hash: offer1 = {..., :price => {:amount => 400, :amount2 => 300, :currency => "INR",...} Now I want to retur...
more »

2017-06-17 15:06 (0) Answers

Rails 5 Active Record Record Invalid Error

I have two Rails model namely Invoice and Invoice_details. An Invoice_details belongs to Invoice, and an Invoice has many Invoice_details. I'm not able to save Invoice_details via Invoice model using accepts_nested_attributes_for in Invoice. I get t...
more »

2017-06-17 15:06 (2) Answers

Enter key to send works only once in java script

I have a code that submits the form, whenever we press enter key on text area... it works, but code runs only 1 time. whenever I press enter again to submit it doesn't work. here is my javascript code $('.comment_ta').on("keypress" , function(e){ ...
more »

2017-06-16 15:06 (1) Answers

check if url can be loaded in an iframe

Snip.ly nicely checks if the entered web address can be used in an iframe. I'd like to replicate it in ruby. Looking through their code they send an ajax request to their server and thats where they do the validation. Even after extensive googling c...
more »

2017-06-16 05:06 (0) Answers

Rails server not working after changing gemfile

After I changed my Gemfile in rails and ran bundle install and update, I tried to run the rails s but then I got this error: C:\Users\alouf\Sites\fapp>rails s C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.11-x64-mingw32/lib/bcrypt.rb:16:in `r...
more »

2017-06-15 22:06 (0) Answers

How to merge two array objects in ruby?

If I start with two arrays such as: array1 = [{"ID":"1","name":"Dog"}] array2 = [{"ID":"2","name":"Cat"}] How to merge this array into one array like this? arraymerge = [{"ID":"1","name":"Dog"}, {"ID":"2","name":"Cat"}] ...
more »

2017-06-15 02:06 (4) Answers

Scrape an entire API or rely heavily on it?

I'm building a resort review site in rails. Currently, a User has many reviews, and each Review belongs to a User. The reviews table contains an expedia_id field. All data - the hotel name, images, description, etc. are pulled dynamically from the ...
more »

2017-06-14 21:06 (1) Answers