Chris Oliver

Joined

292,490 Experience
93 Lessons Completed
295 Questions Solved

Activity

Posted in Setup MacOS 10.10 Yosemite Discussion

Yep they should! I use ZSH too, but it supports almost the exact same syntax.

Posted in Multitenancy with the Apartment gem

You probably want to create a Rake task to run through your existing users and create their tenants. You could also do this in the Rails console. Just loop through each user and then create the tenant and that should be it.

Another solution is you could catch the error when the tenant doesn't exist and to create it then. This would let you roll it out and they would each be created as they were used.

I'd probably recommend the first option because it means that all your users are running on the same code all the time. It's generally better to have consistent data than not.

The &:symbol syntax basically just turns a method name into a block to call. What it is doing is sorting the array of events by the simple_calendar_start_time column. First we select out the ones for the day in the select block and then we sort by the start time so that all the events are filtered and in order.

That make more sense?

Posted in Deploy Ubuntu 14.04 Trusty Tahr Discussion

What isn't working for you?

Posted in Admin for the specific case

I think Pundit would make a lot of sense for this. With Pundit, you're passing in the user and you can use it to evaluate whether the user has access to the object. Instead of putting the authorization logic int a method on the Work model, you can do it inside the Pundit class instead. That makes things a lot better organized and manageable for you.

Posted in Video Idea: Accepting Credit Card Payments

Definitely need to get on this one! It's one of the most requested things and I just need to sit down and do it. I'm just using the Stripe JS library coupled with the Rubygem. The JS turns the card into a token, sends it to the server, and the server charges the card and updates the user. That's about it.

I'll make sure to bump this topic up in the queue so I can record it soon.

Just shovel those onto the csv outside of the records loop. Pass in the values you want and they should show up at the bottom.

Posted in Coffeescript Instantiation

Haha! Always the simplest things producing the hardest problems.

I would imagine so, but you'd probably want to ask on their Github issues to be sure. This is probably just more of a database configuration thing than anything with apartment or Rails.

Hey Francisco,

Sounds like you'd be better off making one User model and then adding roles to them instead with Rolify and Pundit. I'd definitely recommend doing this.

If you do want to keep the separate models, you have a couple options.

  1. You can have separate urls and they choose which type of user they are and get directed to the correct devise login URL.
  2. You could override the controller to search through each model to find the correct user. This solution gets pretty nasty quickly and isn't flexible for future changes. If you still want to do that, you can attempt something like this: http://blog.frankzhao.com.au/2014/12/single-sign-on-for-two-different-user-models-with-devise/

Yes you can! Just add that attribute to the company and you can use that.

I've wanted to open it up and share it and let you guys add features to the forum if you like. I haven't done it yet because I want to make sure I don't accidentally share API keys. There are a lot of old things that need cleaning up from how I originally built the site too.

Would you be interested in me sharing it?

Posted in Code Challenge idea

By all means, take a stab at something. I'm going to hack on simple_calendar I believe because I've got some requests for new features on it.

Are you guys interested in any specific kinds of challenges?

Posted in Code Challenge idea

Agreed. Maybe it's also a challenge to do open source every day? I've been thinking about doing that this past weekend and might start today.

PostGIS would be the easiest way to get started. There definitely isn't great documentation on it. Maybe I'll be able to record a screencast on it sometime soon.

In the meantime, check out the readme on this and see if it does what you need: https://github.com/rgeo/activerecord-postgis-adapter

Posted in Setup Ubuntu 14.04 Trusty Tahr Discussion

That should be good. Cloudfront is a CDN so it caches files so you can download them faster around the world. It's something you have to configure so Ruby's website is probably forwarding you to that. Good to verify that it's not malicious in any case!

Are you considering using PostGIS on PostgreSQL for basic search or an independent search engine like ElasticSearch so you can do more complex searches?

Posted in rubber:passenger:add_to_pool takes forever

Weird! In any case, nginx and unicorn are awesome so you'll be in good hands with that setup as well.

I've had some weirdness with Passenger 5 myself and have reverted back to using Puma for now.

Posted in Multi Site in Rails

Probably not if you don't have a database. The gem is designed for that, but you could write a before_action that looks up the correct site as soon as the request starts. That would do basically the same thing as the Apartment gem. You'll just want something more custom in this case because what you're doing is a bit unique. The before_action should work great for this.

The best kinds of questions are the ones you ask and answer yourself shortly afterwards. <3

Earn XP by completing lessons, posting on the forum, and answering forum questions