Chris Oliver

Joined

292,890 Experience
93 Lessons Completed
295 Questions Solved

Activity

In-app notifications is actually going to be my next episode!

Posted in Setup Ubuntu 14.04 Trusty Tahr Discussion

Fun fact! You don't need ~ because it will default to that if you don't put it in. I learned that not too long ago. :)

Never used that. I'll check it out. From everything I've read, I think that you can use the "autoload" method somehow, but I've never gotten it to work.

I'm not sure I have this exactly how it was in this episode, but I continued refactoring it and it's now inside:

https://github.com/excid3/s...
https://github.com/excid3/s...

Posted in Pair Programming on Rails Scopes Discussion

The EXTRACT is required because you need something to pull out the week day inside the database so you can make the comparison. The Ruby method unfortunately can't help you here because this is running a query inside the database.

Posted in Setup Ubuntu 14.04 Trusty Tahr Discussion

Yeah no worries! The times when you see text in square brackes means that's the default value if you hit enter. You'd probably see something like [~/.ssh/id_rsa] which means it will store to that file by default if you don't type a file in. Just one of those little Unix annoyances.

Posted in Setup Ubuntu 14.04 Trusty Tahr Discussion

You want to save it to the default location by just hitting ENTER. What's the failure say?

Posted in API TOKEN DEVISE

Ah perfect. In that case, I think you'd be best off with devise_token_auth. It's designed more for that use case.

Posted in API TOKEN DEVISE

Hey Saul,

I've never actually used devise_token_auth but it sounds like it might do the same thing. I'm not entirely sure. It seems to do the same thing as devise_token_authenticatable but provides more functionality. It definitely seems to be helpful if you're using React or Angular.

I guess maybe the best question is what are you trying to accomplish?

Ha! Thanks for catching that typo :)

I'm actually using a suite of Vim plugins called Janus and I'm not sure what plugin it is that does that. It's definitely one of them listed here. Also I'm using MacVim which probably helps to provide that functionality. http://github.com/carlhuda/...

Posted in What happen to the search field for the videos?

It's now back in the navbar! :)

Posted in What happen to the search field for the videos?

Yes, very soon! I'm going to add that this morning. Totally forgot I deleted that during the design and that was my bad. :)

Posted in How can I grow this search object?

That's much better! I'd clean this up too slightly since you're repeating the exclude every time.

  def search
    @images = Image.excluding(@excluded_image_ids)
    if @params[:commit] == "View Uncategorized Images"
      @images.unfinished
    elsif @tags.empty? && @year.empty?
      @images.default
    else
      @images.by_tags(@tags).by_year(@year).none_if_all
    end
  end

Posted in Activity Feed From Scratch Discussion

Absolutely! Just posted it here: https://github.com/excid3/g...

Posted in Setup Ubuntu 15.04 Vivid Vervet Discussion

The difference is just that the PPA gets updated more often (if the maintainer keeps up to date) vs the Ubuntu repo which only gets updated once every major version change. You'll get a stable version of Nodejs, but it will only receive small updates and security fixes, not major version changes.

Posted in Multitenancy with the Apartment gem

  1. I think the key piece there is modifying the find_for_authentication method. You'll have to join the user and company tables to get only the users for that company. Adjusting that query so that you work through the associated company will do the trick.

  2. What's up with background jobs? If you do need background jobs, there's a apartment-sidekiq gem that can help by switching background jobs into the correct tenant.

Posted in Multitenancy with Apartment Gem

Actually I just found this: https://github.com/influitive/apartment/pull/208

Looks like you might need to set the environment variables he mentioned in order to get pg_dump to run correctly. Wish I had found this earlier for you!

Posted in Deploy Ubuntu 14.04 Trusty Tahr Discussion

Read the Rails and Nginx logs to check for errors. I didn't cover the part of setting up the database.yml and secrets.yml files.

Posted in How can I grow this search object?

There's actually a lot going on here and I can see several bugs because there is logic smattered all over. My impression is that you've extracted lines of code into their own methods too early before you knew exactly what you were trying to accomplish. That left you with a bunch of methods and several of them having their own little bits of logic. There's no clear path that anything flows which makes it hard to understand at a glance.

I think you have felt this and recognized it, so the question is how do I get back to sanity? And the answer is by making your code uglier. Remove all these method calls and put the code back inline. You only call most of these methods from a single place so removing the methods and putting them back inline clarifies things a lot. You can then see what's duplicated. Make the search method contain all the logic and then refactor it.

From what I can tell you always want to exclude the image ids, yet you do this in many different places so it's hard to realize that. Your search method could actually start by calling Image.excluding first and then tack on the other scopes instead. I'd do a refactoring myself and maybe a video of it if I had the time, but hopefully that makes sense as an approach to start refactoring.