Chris Oliver

Joined

292,890 Experience
93 Lessons Completed
295 Questions Solved

Activity

Posted in jQuery UJS Callbacks Discussion

Love these suggestions! I was originally hesitant on covering too much frontend Javascript stuff but I think you're right in that all these things are super related and all Rails apps are getting more and more JS heavy. These are becoming more important and it would be a bad idea for me to consider these "out of scope". Going to add all these to my list of episode ideas and sprinkle them in. Thanks for the list! :)

Posted in Add Profile page for users

Hey Rahul,

So basically what you're gonna need is 2 things:

  1. Make sure this route is AFTER /forum in your config/routes.rb so that your forum matches first.
  2. You can add a blacklist into validations so that forum couldn't be taken as a name. This isn't required although it's good practice. If you don't do it, a user could register as forum but they wouldn't be able to access their account. Usually this is someone trying to game the system so they'll have to reach out to you for support to change it. If you do make a blacklist, you'll have to keep this updated as you add more things areas into your site.

And as a fun fact, this is the reason why resources :users generates /users/:id so that you can avoid those namespacing issues. Obviously that's not always ideal if you want something like twitter or github's urls, but definitely cool to know.

Unfortunately I don't know much about Parallels. Not sure there's a way to convert the Ubuntu virtual machine from VirtualBox to it or not. It might be easiest to just install Ubuntu from scratch in Parallels.

Posted in Flexible Nested Attributes

It's been a while since I read this. :)

What I was suggesting with scopes on the association (I think) was something like this:

has_many :contents, -> { order(:order_number) }

Most people don't realize you can pass a lambda into associations like this to add scopes and other additions to the query. I always seem to forget it exists, but it can be really helpful for things like this.

Posted in Must Read / Must Watch

Tech businesses aren’t successful because they had perfect code and systems. They’re successful because they got a product to market fast and at the right time. They got out their protoype fast (hacks and all), tested and tweaked it, and then scaled. It is wholly arrogant to believe you will have a product on first launch that will be widely acclaimed and quickly adopted. Often it will take fast, iterative changes and tweaks with a small userbase and constant feedback until the right mix of features and pricing are met, along with aggressive marketing — and then growth happens.

http://bigeng.io/post/118399425343/why-the-way-we-look-at-technical-debt-is-wrong

Posted in Setup Ubuntu 14.04 Trusty Tahr Discussion

You might need to restart your terminal. Sometimes the PATH doesn't get set correctly so restarting the terminal helps or re-running these commands (namely the "echo" lines).

Posted in Setup Ubuntu 15.04 Vivid Vervet Discussion

It looks like the PPA hasnt' been updated for 15.04 yet. For now, replace that step with "sudo apt-get install nodejs" and you should be fine.

Posted in CoffeeScript check if a checkbox is checked?

If you want to use it through the form, you can use f.object.patient_bill? I generally use the @record that you set in the controller.

Posted in CoffeeScript check if a checkbox is checked?

patient_bill? is a method on the object, not the form builder. :)

Posted in CoffeeScript check if a checkbox is checked?

Or helpers make this easier sometimes

Posted in CoffeeScript check if a checkbox is checked?

Check your logic there. Toggle simply says if it is visible, make it invisible and vice versa. You just want your style tag to match the boolean in your record in either case. Print out the value into the html if you need to.

It should probably look like this:

<div <% if !patient_bill? %>style="display: none"<% end %> >
</div>

Posted in CoffeeScript check if a checkbox is checked?

Easiest option: You could not add the style to the HTML when patient_bill?

More complex but better for caching option:

# Display if already checked
if $("#bill_patient_checkbox:checked")
  $("#billing_address").toggle()

# Toggle on change
$("#bill_patient_checkbox").change ->
  $("#billing_address").toggle()

Awesome! That is good to know. Thanks for sharing that. TimeZones are such a pain.

Gems are definitely a topic I want to cover. There are a lot of little things related to that (like why do we have Bundler and how does it help?) so I'll make sure there's at least one episode on this gem related things.

Posted in Deploy Ubuntu 14.04 Trusty Tahr Discussion

Ah ha! That's happened to me before and I totally forgot about it. I'm going to be recording a video on this setup so I'll make sure to address that when I get that recorded.

Thanks for sharing your solution! :)

Posted in Exporting Records To CSV Discussion

Well so you want to do all your scopes as normal in the controller so it applies to both the regular HTML response and the csv response.

The "all" is in the method because that is how reference the current scope. It used to be called "scoped" but allows for you to take the relation from the controller and extend it with our CSV code.

Posted in Deploy Ubuntu 14.04 Trusty Tahr Discussion

Hmm, maybe these help? http://stackoverflow.com/qu...

Posted in Deploy Ubuntu 14.04 Trusty Tahr Discussion

What's the output it's giving you?

I was just going to give you a heads up: I re-recorded this episode and think it's a lot more clear this time. :) Thanks for your help because it definitely needed to be cleaned up!

Posted in Deploy Ubuntu 14.04 Trusty Tahr Discussion

That's exactly the command and the location you need to in order to do it.

Are you sure you're in the right directory? When you run ls it shows all the files in your rails app?