Activity
It's the exact same process if you look into what they do. I recommend Shrine because then you can take advantage of all of the features of it after the file is uploaded such as image processing, thumbnails, background processing, you name it.
Posted in Subscriptions with Stripe Discussion
Happens to the best of us. 🤓
Posted in Subscriptions with Stripe Discussion
Hey Liz! :D
I would say, try restarting your Rails app. If you make a change in any of your config files, you generally have to restart your Rails server so it can get the new changes. The rest of the code auto-reloads when you make a change but this stuff does not.
Posted in Advanced Search, Autocomplete and Suggestions with ElasticSearch and the Searchkick gem Discussion
I think you're close, but you want an array of hashes.
Person.search params[:q], {
fields: [{name: :text_start}, {breed: :text_start}],
limit: 10
}
The searchkick docs also show another method, putting the autocomplete types on the searchkick method in the model and just listing out the fields by name. https://github.com/ankane/s...
OAuth definitely gets tricky pretty fast, especially when some services like Twitter don't give you an email, so you can't create User records without asking and so on.
When you try it in the console, try printing out user.errors
when the save fails so you can see what the errors were. It could be one of your validations failed and that will let you know what went wrong.
ABSOLUTELY! :D
Going to cover short introductions to React, Angular, and Vue when I get back from Thanksgiving.
Try this: https://chrome.google.com/w...
For both recurring events and various types, you just have to make them into one array and pass them in. So rather than calling them @dances, you might use @events and create it like so:
@events = Dance.all + Meeting.all
I just recorded a basic episode on recurring events, but you'd just generate them in memory and add them into this @events array. The calendar doesn't need to know anything about recurring events, just needs the individual events to display.
Posted in Setup Windows 10 Discussion
Hopefully that default changes in Windows as that's unexpected behavior from anyone who is used to opening bash with a login shell automatically on any Linux install.
Thanks for sharing all this Matt! Will be useful for anyone reading this as I think it was originally written for Mongoid 4.
It's great to hear that they finally got the ActiveRecord + Mongoid stuff working nicely. I remember it wasn't super doable last time I used it because of some incompatibility.
Yeah, thanks! I know that the react_on_rails gem actually uses webpack for compilation but uses the asset pipeline for the embedding into Rails which is nice. I'll have to dive into these articles soon and start planning a webpack episode.
Just like we did in this episode, you create direct messages between two users by using them in the pubsub channel name. Nothing different there.
For the popup UI, add data attributes to the link so when it's clicked you can find the User ID of the person you want to direct message. Then you have both the current user, and the recipient ID which you can use to start the pubsub channel between the two people.
Absolutely. You can create any UI you want for this. My example is more like Slack, but you can do the same thing and use the button to initialize displaying a popup chat box instead.
Thanks for sharing Anthony! I'm sure people will find that useful. :)
Yeah, I'm gonna talk about Webpack in the future when we get into the frontend framework stuff. It's one of those things that I'm disappointed Rails hasn't improved the asset pipeline enough speed wise, because it doesn't feel like the most useful use of your time to be fiddling with WebPack configurations.
I still very much appreciate the convention over configuration approach Rails takes, just need to get some speed boosts in there and things would be great.
Posted in Searchkick search_data not working
Hey Alex,
That error is pointing out that it called .name
on a class that was nil. The only line in your code that does this is category.name
which means that you have a Recipient record without a category on it.
You probably want to conditionally pass in the category name if you want category to be optional.
# using a ternary if statement
category_name: category.present? ? category.name : nil
# or, often not recommended to use try(), but a bit cleaner way of doing the above.
#category_name: category.try(:name)
Oh nope, screenshot should be .jpg if it wasn't.
Ah, I gotcha. So in your films/comments_controller.rb
you could say:
def index
@comments = @film.comments.where(status: 'published')
end
And then you would want to build the index.html.erb to display all those comments. Is that what you're looking for?
Hey Melanie! :)
If you wanted a route to get all published comments (not ones scoped to a commentable type) you could add a resources :comments
that was not nested in your routes and use that.
resources :comments
resources :actors do
resources :comments, module: :actors
end
resources :films do
resource :comments, module: :films
end
And then you could make a comments_controller.rb that worked for all comments for any object. Is that what you're looking for?
Posted in Use .ENV instead of Secrets.yml for keys
Yeah, Heroku's stuff is easy because you can say heroku config:set AWS_SECRET_KEY=xxxxxxxxxxxxx
and it will set the ENV variable for you, and voila! You've got ENV variables set.
Much easier than doing that on your own server since nginx doesn't let you set ENV variables in your server config. When you've got your own server, it's easier to write the secrets.yml file on the server only in the shared directory between deploys and then symlink it during deploy instead rather than using ENV variables.