Chris Oliver

Joined

292,890 Experience
93 Lessons Completed
295 Questions Solved

Activity

Posted in Sharing on social network

That's pretty much exactly what I was thinking! Glad that worked out pretty well.

Posted in Rspec Test on Multi tanent app with aparment gem

The error says you've already created the companydemo tenant. I think the thing you're going to run into here is making sure you architect your tests properly to create and operate on a tenant and safely revert them as necessary. You'll need to add cleanup methods in your tests to make sure that once you're done using the tenant that it gets dropped. That's basically the only changes you'll need to do aside from setting up your other tests to already have a tenant setup, migrated, and selected.

Posted in Migrate away from Mandrill?

Kind of unfortunate as a lot of apps I run are in the same predicament.

One of my good friends works at MailJet and was telling me about all the things they're doing and they offer a free 6000 emails a month. https://www.mailjet.com/pricing_v3 They're like both Mailchimp and Mandrill combined, not just transactional email which is super nice in case you want to do marketing stuff as well. I think I'm going to be trying them out personally. They've been mostly focused on Europe in the past so most people haven't heard of them as much.

Of course there are all the other options: Sendgrid, Postmark, etc. I don't think you can really go wrong with any of them. I like Postmark a lot and Sendgrid is a powerhouse for transactional email that everyone knows.

Posted in In-App Messages Between Users Discussion

I don't entirely know how the attachments feature in Mailboxer works so I can only give you a rough idea of the direction to go. I think you could probably override the Mailboxer::Conversation model in your app and then add Refile into it if you didn't want to use Carrierwave. That should let you do what you want there.

Posted in Automated email notification summary

If you want to send these on a regular basis, cron jobs are perfect for that. You can just set it up to run weekly and notify users from a rake task. Easy to test and maintain. I did an episode on that a while back: https://gorails.com/episodes/cron-jobs-with-whenever-gem?autoplay=1

Otherwise if you want it to happen on a trigger in-app like a notification every time a new profile is created, you can just put the logic in your controller to check who should receive the notification and then send that out. This sort of thing is a good case for using a service object (just a regular ruby class that contains the logic for it).

Pros are you get a lot of helpers for making basic forms quicker, downside is that I often customize my forms a lot so you can't really use their helpers all the time and it's also another API to continuously memorize. I use them in things like Admin areas or forms that don't need much UI work, but other than that, I tend to just use the normal form helpers and tags.

Check out this episode! https://gorails.com/episodes/forum-nested-attributes-and-fields-for It covers how to do that with the form and params in order to properly set everything up.

Posted in Lots of trouble using LESS in a paid theme.

Aww that sucks. Keep us posted on how it goes. I'll have to do a more in-depth episode for this stuff. Some of those themes can be really, really complex. They basically market the theme as having absolutely any feature you can imagine, but that ends up with a seriously messy theme.

Posted in In-App Messages Between Users Discussion

Yep of course! The same reason that you have to build your own controllers and views with mailboxer is the same reason why it will work perfectly with ActionCable. It really just handles the database side of things, which ties in perfectly with ActionCable. You'll still need to build the channels and everything, but it should work without a problem. Going to be covering this in a future episode as well.

I actually just continue hitting escape. It's a bit easier to reach on the Mac keyboard, so I haven't remapped it. I know a lot of people will play around with replacing caps lock for things like that or the leader key.

Posted in Implement a hash tags like feature in rails

The thing about these gems is that they're probably quite simple if they're parsing out hashtags. Not too much to it which is nice and means they probably don't need a lot of maintenance.

I actually have never used any, but if you do end up using one, I'd love to hear how it goes!

Posted in How i can do multiple login with devise?

If you need an admin to create other users, you can make a new controller that only the admin can access to create the other users. I would recommend using devise_invitable to send invitiations to those users. This sort of setup would let you add other users and set their roles. You can then authorize this controller to only allow admins to add users.

# You don't want this to conflict with devise URLs, so we namespace it
namespace :settings do
  routes :users
end
class Settings::UsersController < ApplicationController
  def create
    User.invite!(user_params)
  end

  private

    def user_params
      params.require(:user).permit(:email, :role)
    end
end

Posted in How i can do multiple login with devise?

This sounds like a good use case for just a single User model with roles. Everyone can login from the same spot and then based upon their role, they can access various different things. The benefit of doing roles is that you can easily re-assign people jobs rather than having them have separate accounts to login with each time.

I haven't done an episode on this (yet!) but Rolify is a pretty good starting point unless you want to build something from scratch. https://github.com/RolifyCommunity/rolify

Posted in Sharing on social network

That's interesting. I wonder if there's special stuff in Turbolinks for that because they know the title of the page will always change, therefore they should update the title?

Posted in Sending emails with Mandrill Discussion

It sounds like you need to verify your domain ownership. Check the note at the bottom here: https://mandrill.zendesk.co...

Posted in Deploying Sidekiq To Heroku Discussion

Maybe they both support -C? Sidekiq's docs still show the capital one. https://github.com/mperham/...

Posted in Sharing on social network

Thanks man! And please do. I'm definitely wanting to correct that on here as well, but it'll probably be a low priority for a while unfortunately. Really hope it works for you so I can do the same sort of thing here.

Posted in Sharing on social network

You would actually need to store the title and url in a data attribute somewhere. Maybe on the twitter and facebook links themselves and then your JS could look for those, then find the attribute, and then populate the meta tag. That's probably what I'd do.

Posted in Sharing on social network

That would definitely showcase it.

Well, one solution would be to write some JS that fires on turbolinks page change to update those meta tags. It isn't the most elegant, but it would work just fine I think. See any reasons why that might not work?

Posted in Lots of trouble using LESS in a paid theme.

Whoops, sorry for not being clear there! I think there are a couple things affecting your setup.

So any of the require lines at the top are Rails asset pipeline features. They will add the file to the page, but you won't be able to access any of the code in them from other files. This is fine with normal CSS, but with LESS and SASS, you often need to reference variables in other files. That means that you must use @import for those instead, not require. Also, when you import, it's as if the code is all in the same file, so you can access variables in one file from another. That's what is probably causing your issue. You'll first want to make sure you import the variables and mixins before the other files.

On a related not, it's often bad to require_tree . because it will just go import all the files in the current directory disregarding any of the requirements of which file loads before another. I would say you should probably delete that line and it could be the source of most of your problems.

So all that said, I'd recommend changing your setup to look like this:

/*
*= Any CSS and SCSS file within this...
*
*= require twitter/bootstrap
*/

@import "a_variables";
@import "mixins";
@import "mainnav";
@import "navbar";
@import "navbar-notifications";
@import "dashboard";
@import "footer";
@import "sticky-footer";

Another useful thing is you should be able to reference the original theme's code to see which order they import these files. That will be pretty much the same order you'll want to have them imported in your code.

Good luck! I hope this helps!

Posted in Sharing on social network

Okay, so here's why I never noticed it on GoRails. The head tag does get set once and then never gets updated. The next episode you click on gets the link to change on the page, but meta tags stay the same.

Since those links are on the page, you will be fine because that's what's going to initiate the share button and it will take all the properties you set. Anytime Facebook requests the page to get OpenGraph tags, they won't be using Turbolinks so that yield will work properly as well.

Effectively it's a bug, but at the same time it doesn't affect anything (at least for me). Does it cause any issues for you that the meta tags don't get updated?