Chris Oliver

Joined

292,490 Experience
93 Lessons Completed
295 Questions Solved

Activity

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?

I think when you set config.time_zone that actually changes the database values and does not store them as UTC anymore. You can verify this by saving a time like 4pm and seeing if 4pm shows up in the database or a different time. If they are the same, then it means that it is not saving the times as UTC. If they are different, then that means it has converted it to UTC to save to the database.

I usually recommend saving always to UTC in the database so that in the future if you need to have custom times for all your users, you can adjust Time.zone on the fly or use the local_time gem.

Let me know what you find out about config.time_zone because I always forget if it modifies the ActiveRecord time conversion or not.

I think usually the config.time_zone complains when you set it to an invalid date option so it doesn't seem like that's the issue.

One thing to point out is that you should almost never use DateTime.now and you should always go with Time.zone.now just to be safe.

Maybe try swapping the DateTime ones out with Time.zone and see if that helps?

You can use Rails UJS directly to do that. I use this and the @form variable is just a jquery selector for the form

$.rails.enableFormElements @form