Chris Oliver

Joined

292,390 Experience
93 Lessons Completed
295 Questions Solved

Activity

Posted in Switch state of boolean field

You'll have to do most of that in Javascript. When you click the button you'll send an AJAX request to the server (which can just hit the update action) and that will save the active/inactive state. That's really about it. You might checkout the ajax episode to wrap your head around this: https://gorails.com/episodes/jquery-ujs-and-ajax?autoplay=1

Ah ha! That would do it. :)

That's one of those times where turning on errors for this stuff in production is super helpful. Usually they don't throw errors so it doesn't break the website when an email fails to send...but this is kinda important to know!

Great question. In that case, I would probably try to rewrite that CSS so that it didn't conflict. Usually it's not super hard to do that (like renaming a higher level css scope or something). The worst case scenario is that you can't do that or it's too much work and you need to setup Rails to compile separate CSS files for those pages. In that case, you can follow something like this to compile various ones and save the trouble of rewriting chunks of the theme. http://stackoverflow.com/qu...

Good luck and thanks so much Francisco! :)

Posted in Using Purchased Themes with Rails | GoRails - GoRails

It's definitely dependent on the frontend developer and you've either got an easy or tough job cut out for you once you download the code. :)

Hey thanks for the reminder. I missed this last post.

One thing you could try is setting raise_delivery_errors to true in production so that in case you have an invalid thing setup, it would let you know rather than hiding the error.

I was out for a week on vacation so catching up on Pro episodes for the subscribers first before putting out another free episode.

What free episodes do you want to see?

Posted in Liking Posts | GoRails - GoRails

Have you added the slug attribute to the Like model? That's a requirement to make friendly_id work. May want to read their directions again to get familiar with it.

Hey Benjamin! Welcome to GoRails :)

A couple things here for you:

  1. Polymorphism is talking about relationships and maybe doesn't apply here. An example of polymorphism is having a Review that could apply to a Service Provider OR a Customer. Maybe you want them to be able to rate their customers too (like Uber does internally for example). A polymorphic relationship lets you have the relationship point to various types of models. It sounds like yours is simpler where you will have a customer owns a review and the review points to a service provider.

  2. Creating two separate models with devise is pretty easy:

rails g devise Customer
rails g devise ServiceProvider

You'll have different URLs to use in the templates. Like new_customer_registration_path and new_service_provider_registration_path for example. You can run rake routes to find out what the other urls are after you've generated the models.

Does that make sense?

How are you setting up your mail? I imagine it will be shared throughout the system?

Posted in Ajax Search Remote True across the site

I can't think of what might be causing it, but you'll probably want to comment out your JS requires in application.js except for jquery and jquery_ujs to see if the other files are maybe messing with it.

Posted in Ajax Search Remote True across the site

There has to be some JS breaking it if it's submitting as HTML though. Maybe not giving you errors, but there's an issue with your jquery_ujs firing properly it seems. That's the only thing that can trigger that query.

Posted in Ajax Search Remote True across the site

It shouldn't change anything if you move this to application.html.erb and keep remote: true. Have you inspected your JS to make sure there are no errors causing it to fail to do a remote post?

Posted in My Development Environment Discussion

Great question! I'm using a Macbook Pro Retina 15" and a Thunderbolt display. Here's some more info: http://excid3.com/about/

Posted in ¿How make I to upload multiple images with refile?

Hey Saul, check out this section on their readme: https://github.com/refile/refile#multiple-file-uploads

Posted in Autocomplete a form field

Benny,

Have you looked into collection_select? It will let you make a dropdown for the product_id on the sale form. It'll automatically load up all the Products in the database and create a dropdown for you.

Then you could do something like select2 (https://select2.github.io/examples.html) on that form field to make it do autocomplete.

https://github.com/argerim/select2-rails

Posted in API TOKEN DEVISE

Ján, that's pretty interesting. I would suggest creating a Github Issue on devise_token_auth and explaining your problem there. Hopefully the author will see it and be able to help out. I'm not familiar enough with the gem to help unfortunately.

Posted in Activity Feed From Scratch Discussion

Depending on how that's setup, you might patch the Vote model so that if you created events matched to the vote, you could delete those. You can't really set this up on virtual attributes because you need it attached directly to the records so when things get deleted you can remove the related records.

Super awesome! Thanks for this. :)

Posted in Handle money in Rails

Oh that's a really interesting question. I've never really considered that because we only use it in the other notation.

I would imagine that the Money gem can do the conversion for you and that internally it really saves them as decimals but tweaks the string output so that it uses comma for the decimal. I think you would want to continue saving with the decimal format and then have a method that converts the value into a Money object and that would be what you interact with. You could also probably have a setter method that lets you set the value via the comma version of the string which converts to the decimal one in the database.