Rails .where() query not working

Thanks a lot for your help. I have a locations and ads table. Location has_many :ads I perform the following query on Location Model. @locations = Location.joins(:ads).where(@location_params.require(:location).permit(:id)).includes(:ads) Then I wa...
more »

2017-03-13 10:03 (1) Answers

Rails 5 Server Issues (Windows 10)

Newbie to Ruby on Rails here, I just did a fresh install of Ruby & Rails on Windows 10 (Bash on Ubuntu shell). I seems to having issues on starting the Rails server. Already checked the other threads on the issue, but everyone else is using OSX. ...
more »

2017-03-10 06:03 (1) Answers

Sidetiq not working post Rails 5.0 upgrade

I am in process of migrating a rails app to Rails 5 / ruby 2.4 from Rails 4.2 / ruby 2.2.2. Most of the "issues" that I've encountered have been straightforward to address, but this one has me a bit stumped. I have a number of recurring jobs that I...
more »

2017-03-07 17:03 (0) Answers

How to group and sum all currencies

I hope the title is correct. I need to sum all currencies ie all of $, £ etc, but not to combine all into one sum. Basically if I have 2x $4 and 3x £10, that will be $8 and £30 I have an Income model with attributes :currency (string) and :amoun...
more »

2017-03-05 21:03 (1) Answers

can't use polymer gem in rails 5.02

I'm new to using rails and polymer, and I followed the instruction in the README.md, but $rails g polymer:install command did not work. Here is the output from running $rails g polymer:install /Users/someuser/.rvm/gems/ruby-2.3.3/gems/bundler-1.14...
more »

2017-03-04 05:03 (0) Answers

How to get started with the gmail-ruby-api gem

I working with Gmail using the Gmail for Ruby gem, but can't figure out how to get started with it. The documentation say: I could do something like: require "gmail" Gmail.client_id = "...Your app client id..." Gmail.client_secret = "…app secret...
more »

2017-03-03 19:03 (1) Answers

Rails Localhost not working

So when I run "rails server" and try to open any project, i get this error when trying to open localhost:3000 : Error But this is what my terminal says: The thing is I thought it was because me pushing to git heroku was causing it to fail so anot...
more »

2017-02-27 20:02 (1) Answers

Use a namespace only as param

At the moment my routes are looking like this: search_index GET /search(.:format) search#index But I want to get routes like these: search_index GET /topic1/search(.:format) search#index search_index GET /topic2/search(.:format) s...
more »

2017-02-21 08:02 (1) Answers

Can't dup NilClass (TypeError)

I am trying to run my cucumber tests, but I get this error. I am wondering what is the source of the problem and how I can go about debugging it? can't dup NilClass (TypeError) /Users/jeffreyyong/.rbenv/versions/2.4.0-preview1/lib/ruby/gems...
more »

2017-02-08 11:02 (0) Answers

How to implement composite primary keys in rails

I have a User model that looks like this: class User < ApplicationRecord belongs_to :organization belongs_to :department end The users table in the database has the two foreign keys organization_id and department_id. How can I make these tw...
more »

2017-01-27 08:01 (1) Answers

What does f.object do in the Rails form builder?

I am learning Rails 5.0 from a tutorial, and in that tutorial it uses f.object, which I am unfamiliar with. The f.object is being passed into ERb, into a method that handles error processing. I know that f is the object/instance of a record being pa...
more »

2017-01-09 22:01 (3) Answers

Not sure how this code reads

I'm browsing github looking at cool code, but don't understand what this code does: I understand that there are 2 belongs_to associations, but I don't understand what the 'self.request' method means and what it does. Also, isn't 'transaction' meant...
more »

2017-01-08 08:01 (2) Answers