Chris Oliver

Joined

292,890 Experience
93 Lessons Completed
295 Questions Solved

Activity

Posted in User Authentication with Devise | GoRails - GoRails

Yes! :)

Yeah in the database I think you would have both "users" and "something_users" tables.

Hey James! You can actually generate these types of nested models with Rails:

rails g model Blog::Post title

That will create the Post model nested inside the blog folder. The table name will be "blog_posts" because database tables don't have nesting. They just scope it by prepending "blog_" at the beginning in the database table. I agree with the StackOverflow poster in that you shouldn't try to override the table name to be safe. You can still scope it in your code and so long as you don't also create a "BlogPost" model, you will be fine.

Posted in User Authentication with Devise | GoRails - GoRails

Yep! It's called better_errors. Checkout this episode: https://gorails.com/episode...

Posted in Liking Posts | GoRails - GoRails

When you're not signed in, I render the like button, but it takes you to sign in instead of the AJAX code there. Tweaked that a bit because the AJAX code won't do the redirect with UJS properly.

Posted in Switch state of boolean field

Benny, this looks great. That's pretty much exactly what I would have suggested. :)

The only thing I'd say is to remove the console.log so that it doesn't crash in certain browsers like IE. For some reason it doesn't support that.

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/