Activity
Anytime! 🍻
Hey Rob,
I can't remember exactly, but I know a couple people also had trouble with that one. I believe this was where we setup the form to submit as AJAX and hadn't transitioned it over to sending via the websocket just yet.
Your form is submitting, but it's not sending as a JS request, so your create action crashes looking for an HTML response. What you need is to add remote: true
to the form so that will render and execute the create.js.erb
file we created.
Basically just change this line: https://github.com/robSturcke/halibut/blob/4e4f4dce3360344f9326aee202d156591e2d67e3/app/views/chatrooms/show.html.erb#L12
to the following:
<%= form_for [@chatroom, Message.new], remote: true do |f| %>
That should do the trick! Your form needs to submit via AJAX request so that the browser doesn't reload the page each time you send a message. That'd be a really poor experience.
You're definitely far deeper into Searchkick than I've ever been at this point. :) I agree, some advanced searchkick usage like aggregates and geosearch would be really great to cover. Maybe some custom index stuff like what you're up to would be valuable as well.
So that import: false
basically just tells it to create a blank index and ignore all the records in the database right?
Actually... you might check out what the Model.reindex
code does. You might be able to pull some chunks from that to create your own method to do the bulk reindex and not clear the index each time. That might let you build a custom method for indexing that could take advantage of any bulk indexing they might have as well as support your multi-tenant application.
Credit for that goes to @andrew_fomera:disqus. :D
This isn't quite the same, but something I thought I'd share: http://introjs.com/ It's used for a lot of intros that need to call out specific things.
The FitBit one looks just like a modal wizard, so you should be able to find some easy Javascript to pull that one off.
For the most part, you'll just want to keep track of whether the user is new by having a column on the user model that gets marked off like intro_complete
once they're finished with the tour. You can display the tour the first time and when they close out of it make an AJAX request to mark that column as true
so they don't see it again.
The kubernetes one probably just displays that whenever there are no apps, so it wouldn't have to keep track of whether or not the user had seen the intro.
I read this earlier and wasn't quite sure what it was, but that would explain it! :) Happy to help if you have any other questions.
Hey Drilon,
So sending emails is pretty easy, you can just configure ActionMailer with their credentials, but it's a lot more complex to receive emails in an application. There's a brief mention of that here: http://guides.rubyonrails.org/action_mailer_basics.html#receiving-emails
You can use the mail gem to retrieve emails from a pop server which might be what you want: https://github.com/mikel/mail#getting-emails-from-a-pop-server
Posted in Setup Windows 10 Discussion
It's likely that everything is installed but your terminal didn't automatically load rbenv again. Double check and make sure that you followed all the rbenv lines correctly to echo the lines into your .bashrc file.
For the select box, you can customize it to display user names using this: http://apidock.com/rails/v4...
You can definitely do that. What I would do is store the card on the user account after they pay the first time, and then the second time put in the existing card above the form and use JS to hide the Braintree form. This will let you use their existing card or toggle the Braintree form to use a different one.
You'll actually want to combine websockets with direct uploads (see: https://gorails.com/episode... ) in order to accomplish this. You don't want to upload files via websockets because they're not a good medium for this. Instead, you can upload files like you normally would and then you can use the response JSON from the upload to include the file in your application.
For example, Slack file uploads submit an AJAX file upload, you send over the message via ajax so you can upload the file and then once that's complete, it broadcasts it over websockets.
Awesome! :)
Great answer! :D
Should be very similar I would imagine although I haven't tried it.
You don't need to run Rails, Passenger will start the app for you automatically, that's why we set it up this way so you don't have to manage running scripts. It's automatic.
You're welcome and I'll definitely try to see about doing this as an episode moving forward. I think it'll be kinda tough to figure out a good example for this that really showcases the idea, but if you have any ideas I'm all ears! I tried doing this a couple times before but it's just one of those things I think you learn over time and kinda hard to appreciate until you've done it a few times.
So there isn't really anything specific other than I read the source code of gems. The undocumented details and important stuff is almost always hidden away inside the source for the gem unless it's a very popular gem.
For example to learn about Searchkick.models
, I would just search the repository for models
which I would assume would be a method somewhere inside the gem or a class variable and I'd start poking around that. The key with that would be figuring out what it does, how it's used, etc.
Today I was poking around the source code for docusign_rest to learn how it worked because I couldn't get some options passed over the API correctly. 15 seconds of looking at the source later, and I knew exactly what was wrong.
The thing with gems is realizing they're not a black box, they're just regular ruby code you would have written, but they're packaged up nicely for people to reuse, so you should always feel comfortable reading the source for that. It feels daunting at first, but honestly all the code in the gems is generally pretty much what you would have had to write to make the feature work if they didn't do it for you. Almost every time it's pretty logical when you dive into it, especially when you're curious about very specific bits like Searchkick.models
as you don't have to understand how things work completed, just the small piece.
I believe exclusive
would work as well. Doesn't really matter between those in this case.
Yeah, your link for about doesn't actually point to /about
, it just points to /
which means they're the same. You should match on exact for both of those. It would look like this I think:
# config/routes.rb
get "about", to: "pages#about"
root to: "pages#home"
<%= active_link_to "Home", root_path, :active => :exact %>
<%= active_link_to "About", pages_path, :active => :exact %>
Yeah in theory. I'm guessing that Business.current_id sets the tenant?
The callbacks for when you update a record are basically what you'd be tying into here. Anytime you update or delete a record, it needs to update or delete that item in the index. Rather than doing a bulk insert, you'll do them one by one so you can control the tenant stuff, which was the problem with the bulk imports because they couldn't handle the individual records.
You should keep your code then as if it were always in the proper tenant, so your model should look like it normally would:
class Product < ActiveRecord::Base
belongs_to :department
def search_data
{
name: name,
department_name: department.name,
on_sale: sale_price.present?
}
end
end
The reason for that is because this way you'll always be in the correct tenant, so you'll always be able to look up the department just fine.