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

Namespacing within `app` directory

In our app directory, we want some of the sub-directories to contain namespaced classes, and some that contain top-level classes. For example: app/models/user.rb defines ::User app/operations/foo.rb defines ::Operations::Foo app/operations/user/foo...
more »

2017-01-05 13:01 (0) Answers

Rails: Omniauth solution for Microsoft

Does a working omniauth solution for Microsoft exist? I did quite a bit of research and every gem I tried did not work. I tried numerous gems, each of which led to an authentication issue on Microsofts servers. ...
more »

2017-01-04 22:01 (0) Answers

Why do people use `Module.send(:prepend, …)`?

I'm learning how to use Module.prepend instead of alias_method_chain in my Ruby code, and I've noticed that some people use send to call it (example): ActionView::TemplateRenderer.send(:prepend, ActionViewTemplateRendererWithCurrentTemplate) W...
more »

2017-01-03 09:01 (1) Answers

Rails 5 SQL Injection

I've read about this for some time now on various SO threads, guides, etc... but all the answers are conflicting and contradictory. It seems there's many similar methods, and a lot of the answers say to use a different one. sanitize sanitize_condi...
more »

2016-12-31 19:12 (1) Answers

Rails 5 RESTful API with advanced relations

I have many resources with advanced relations (habtm/hm/hmt etc..), everything you can imagine, but now it's time to write a beautiful routing for this API. The problem is, I can't fin the best practices about nested resource + advanced relations ro ...
more »

2016-12-14 13:12 (1) Answers

Cannot start up rails server or rails console

I have a rails project. I run command rails server and rails console, but both give me this error: So, I ran the command sudo gem install polyglot. It successfully installed polyglot-0.3.5, but the same error still persists. I am wondering what th...
more »

2016-12-13 08:12 (1) Answers

Filterrific and how to add subdomain to reset url

I'm creating a rails application and installed the filterrific gem to handle filterring of table records. It's an amazing gem and setting it up is super simple. I am stuck on one little issue. My application uses subdomains (A company slug). All my ...
more »

2016-12-09 08:12 (0) Answers

Nested records using join Rails

I have these models class Car < ApplicationRecord has_many :car_locations ,:dependent=>:destroy has_many :rides,:dependent=>:destroy end class CarLocation < ApplicationRecord belongs_to :car end class Ride < ApplicationRecord ...
more »

2016-12-08 13:12 (1) Answers

After setting up Spree, cannot start new Rails App

I completed the Spree tutorial and and set-up an extension named spree_simple_sales. I created it in the directory of the Spree App I was creating, but problem is now I'm getting this message when I try rails new new_app_name (obviously not in same ...
more »

2016-12-01 18:12 (1) Answers

How do I fix Error loading RubyGems plugin?

My original purpose was to start a new rails project by getting the most updated versions of rails and ruby. In doing so I broke something. My question seems to be often repeated in one form or another. I've spent much of the morning going over the ...
more »

2016-11-30 19:11 (0) Answers

How to track additional post data using Ahoy gem?

I am using Ahoy gem to track article visits on my rails app. Ahoy save lot of visit data by default, for example landing_page url. Is there way to get and save to visits table additional post data, for example post title, which not comes by default? ...
more »

2016-11-27 17:11 (0) Answers

What does resource mean in Devise?

I want to change what happenes in devise when a user logs in.. When I look at the source code the word resource is everywhere, but I can't understand what it is a stand in for. Does it only pertain to devise and warden? def after_sign_in_path_for(re...
more »

2016-11-27 05:11 (1) Answers