Chris Oliver

Joined

291,530 Experience
86 Lessons Completed
296 Questions Solved

Activity

Posted in Capistrano Rbenv Bundle Failed

Go right ahead. :D

Posted in Setup Windows 10 Discussion

I will try doing that! I've gotta get my Windows 10 install back working again. :S

Posted in Code Review: Run Number Refactoring Discussion

Sorta useful but if we wanted a simple increment always we could just use the database for that. Since we have more logic like years restart the count (or the numbers could be not successive in a lot of cases) that won't help in every case.

Always great to use those little ruby niceties when you can though! Thanks for the reminder!

Posted in Code Review: Run Number Refactoring Discussion

Either one would be great or JS samples even!

Posted in Capistrano Rbenv Bundle Failed

This is fantastic, keep hustling on it! :D Having more native screencasts is going to help so much!

Posted in Capistrano Rbenv Bundle Failed

Great work detective! :D

Posted in On what server is Gorails hosted?

Yep, and just for reference I use a 2GB server for it, but was on a 1GB server for a long time.

Posted in 2 sites... 1 DB?

Oh the good old Joomla days! I tried to experiment with that and Drupal a bit and never could quite wrap my head around them.

You guys should both check out ActiveResource sometime btw. It's like the best API implementation you can get between Rails apps because of how seamless it ends up being. That's one that I always wished had turned into more of a thing, but at the very least it can make for a fanastic influence for the way you design your API clients.

This API thing actually came up recently with GoRails because as I was building Hatch I was like man, it'd sure be nice if you were automatically signed in because you were logged into your GoRails account...I never did end up doing anything with it, but it's certainly something I would like to address in the future. It would be similar to what Alan needs to do.

Posted in How can I setup Cloudfront CDN for Rails App ?!

That's where I got the snippet from actually. Forgot to paste the link. :)

Posted in Capistrano Rbenv Bundle Failed

Your nginx config is probably not pointing to the right directory or something for the Rails app or you just needed to restart nginx after you changed the config.

Posted in Capistrano Rbenv Bundle Failed

It says "Killed" on the last line which means your server ran out of memory while installing gems. You can just try redeploying and that should help, but you'll keep having this problem until you upgrade to have a bit more RAM.

Posted in 2 sites... 1 DB?

There are a bunch of ways you could tackle this. One of the neater ones is actually with ActiveResource where you can treat a remote Rails app as if it were in the database (for the most part). It got extracted to its own gem that still seems maintained. It's pretty slick if you use it, but you gotta follow the Rails conventions which not everyone wants to do.

Another option could be building 3 separate Rails apps that all use the same database server and database. Each one could then point to that and consume it as if they were inside the same Rails app. You would share your model files across the apps migrations would be accessible to each one of them. Basically for this you'd just simply share the model files and the database.yml between apps. That's about it. This is probably the easiest option, but you'll have to be aware of some of the annoyances of copying over validations for a model into every app. You could of course extract the models to a gem you share and require that gem in each app as well. Or as a git submodule so you wouldn't have to mess with gem updates.

And of course, the custom API for this is the last option. You'd hit that API from your apps instead of the database. It could be the sole place connected to the db to control any changes and the other apps could consume content from it. They might have their own ancillary databases to store extra stuff in that the others would never need. This one is probably the most work of them all, but could give you the most flexibility between them all.

The good thing is you can definitely start easy here with 3 separate apps that connect to the same db and as you grow migrate your way into an additional API service if you want. I would definitely start simple with this at first and start expanding it as you need.

Posted in How can I setup Cloudfront CDN for Rails App ?!

Yeah, good ol' CORS. You can add rack-cors to your gemfile and create this initializer to take care of it:

# config/initializers/cors.rb
Rails.application.config.middleware.insert_before 0, Rack::Cors do
  allow do
    origins '*'

    resource '/assets/*',
      headers: :any,
      methods: [:get]
  end
end

Basically what's happening is you're including now your stylesheets from a different domain (cloudfront's domain, not yours anymore) and the browser won't allow it unless you tell it that it's okay.

Yeah, you could do that, but also coffeescript does much more than adding classes to Javascript. It added a lot of other things that ES6 has now come to include (like finally a decent way for string interpolation) so ES6 what people will generally be using these days over coffeescript anytime. Mind you this video is 2 years old.

Posted in How can I setup Cloudfront CDN for Rails App ?!

I've been meaning to do a screencast on this at some point.

This tutorial is pretty good for walking through all the steps needed to setup Cloudfront: https://www.happybearsoftware.com/use-cloudfront-and-the-rails-asset-pipeline-to-speed-up-your-app.html

For the most part it's super easy with Rails since all you need to really change is the asset_host config option. Rails will still serve up assets so that Cloudfront will always get the latest copy. It works really well.

Well, the reason is because that is not supported in any browsers right now. See: https://developer.mozilla.o...

You can only use modules if you're using a transpiler like babel / webpack to convert it to code the browser can understand today.

Posted in EAV Rails way?

I'm not up to speed with much of the json(b) column indexing. This talks a bit about it briefly: https://blog.codeship.com/unleash-the-power-of-storing-json-in-postgres/

Posted in EAV Rails way?

Ah ha! So EAV is what that's called. I had always known about this but never know what to call it. :)

It looks like the eav_hashes gem might be worth a shot since it's been updated relatively recently. There might be a fork that's been created more recently that has some other fixes or new features with someone maintaining it.

One alternative that I'd suggest looking into is actually the json or jsonb columns in Postgres. They are similar to the serialized text columns, but they're fully queryable. It's a little different but may be worth checking out as a solution as well.

I need to read up on EAV a little bit more myself.

Do you know if there were any recent changes with times and dates in Rails 5? I think for the most part this stuff should be the same as it has been.