Chris Oliver

Joined

293,420 Experience
93 Lessons Completed
295 Questions Solved

Activity

Posted in Sending emails with Mandrill Discussion

The Gibbon gem should let you do this. You can add someone to the list when they sign up. This is what I do with GoRails on registrations so that I can send the announcement emails out with Mailchimp. That *should* do the trick for you there.

Posted in What do you think about this ?

Great points! I'll get on this. :)

Hey Aaron!

It might make the most sense to have a post_type field that's video, blog, or poll. You could then dynamically add new types easily and have each of these render out different partials based upon the type. That's really the simplest way of doing it. You'll still query one model which keeps things all together, but the rendering will show the different types of content.

You can also take this a step further with what's called Single Table Inheritance or STI. You could create Blog, Video, and Poll models that inherit from Post and then you can organize your code out nicely inside these various models for the code that's specific to each type.

More reading for you on STI: http://eewang.github.io/blog/2013/03/12/how-and-when-to-use-single-table-inheritance-in-rails/

Yeah it was not a very good series. I didn't show the whole thing and just emphasized certain parts. Are you interested in seeing the whole thing? I might do a revised series on it or something similar.

Posted in Redirect To Current Page After Login | GoRails - GoRails

This doesn't make sense for a site that's globally locked down. That's why it's designed in the way that it is.

If you're locking down everything, the Devise before_action :authenticate_user! can take care of that for you. You can also put that in ApplicationController to have it apply to every single request.

Posted in Deploy Ubuntu 14.04 Trusty Tahr Discussion

Hey Alejandro,

2 things:

1. You accidentally pasted your password into this (I edited it out), but you'll want to go change that now.

2. It sounds like your SSH key is not added to Github. It's connected to the server and now needs to ask Github for your code so that it can put it on there. That step has failed and so you'll want to make sure that your ssh key is added to your user account on Github.

Posted in What do you think about this ?

Thanks for the kind words! :D

I've definitely been planning on adding that. Here's a question for you. Which makes more sense? Having it automatically marked as "played" like Youtube does or having a button for you to mark it as watched? My first impression would be is the automatic one seems like a better idea, but I'd love to hear your thoughts (and anyone else's) on this!

Also I need to get emoji support in the forum ;-)

I haven't done an episode on it, but for now, check out this tutorial. It should do the trick for you! http://sourcey.com/rails-4-...

Posted in Just sharing: Squash your migrations

That gem seems super interesting. Haven't seen it before. Thanks for sharing!

I almost always recommend making sure you use the same database in development as you use in production. That way you don't get unexpected results when deploying.

Posted in Build a Devise Model in another controller

Ah! That would do it! :)

Posted in Setup Ubuntu 14.04 Trusty Tahr Discussion

Sounds like you don't have an SSH key on your machine. You might need to generate a new one or install an old one if you have one you created previously.

Posted in Build a Devise Model in another controller

Yo! So I think having accepts_nested_attributes_for is really the main thing for making this work. The only other thing you really need is to make sure that your strong_params in the controller accepts those attributes.

What it will do is create or update the Company with its own attributes and then accepts_nested_attributes_for will automatically create the nested models for you (the Users) and it will also associate them too.

Probably the main thing to watch out for is that you need to also make sure the nested models are validated. Devise is going to require a password for the Users (by default) so you'll possibly need to set some default passwords for those users.

Are you having trouble making this work? Also the cocoon gem is great for creating those nested forms for the nested models. https://github.com/nathanvda/cocoon

Posted in Setup Ubuntu 14.04 Trusty Tahr Discussion

That's my goal!

Posted in Setup Ubuntu 14.04 Trusty Tahr Discussion

I keep it updated as much as I can! :)

Posted in Devise with multiple User Models with single login form

I haven't seen or used devise_group before! Thanks for sharing this. Looks super useful.

Posted in Good public national holidays api?

That gem looks great. Might be your simplest solution as well. Google Calendar API sounds like it's not always the most accurate according to StackOverflow. I imagine that Wikipedia's list of holidays for countries is pretty accurate, but you'd have to scrape them periodically in order to get any changes.

The stuff I've done in the past was just simple and was for the US only so I haven't had any experience with the smaller EU countries which will be the ones that will give you the most trouble I'm sure. I'd try this gem and worst case you may have to add some data to the yaml files in there.

I can imagine since this is pretty hard to do, that's why the one API can cost $100/yr. That's really not too bad considering all the work they probably have to do to continuously update it. Too bad there isn't a simpler, free option that's always up-to-date!

Thanks for the kind words! :) I'm glad you're enjoying it.

Posted in Good public national holidays api?

I haven't actually used any APIs for this in the past, but found a good list of them here: http://stackoverflow.com/questions/14203708/is-there-a-comprehensive-api-or-json-xml-list-with-public-bank-holidays-worldwid

It looks like the most reliable one will be the timeanddate.com one, but it's $100/yr to use. I'm sure it costs money because they actually support it well compared to the others.

http://holidayapi.com/ is another that might be alright, but someone said it didn't work correctly when they tried it a while back. Maybe it's working better now though!

Posted in Authorization with Pundit Discussion

Whoo! That's one of those gotchas that I didn't even think of until you mentioned it. :) Glad you got it working!

Posted in Authorization with Pundit Discussion

Is "category" an instance or the class of the model itself? Only the instances have the relation so maybe you're testing the model? You may want to inspect exactly what the variable "category" is in the console.

Posted in Setup Ubuntu 14.10 Utopic Unicorn Discussion

That seems awfully long. Usually it's about 15 minutes or so. Sometimes it can stall because of low ram. You might restart it and see if it finishes sooner. I'd also recommend trying the $10/mo server because it has a bit more power for compiling.