David Becerra

Joined

150 Experience
1 Lesson Completed
0 Questions Solved

Activity

So sorry for replying so late. I must have missed the notification. Not sure it it's still relevant, but I really only meant the validation. Including the logic here makes sense to me, but by the time the Domain should be valid by the time it gets to the DomainOwnership. Makes sense?

Posted in Survey - adding options though nested models

There's an updated version of that screencast here: http://railscasts.com/episodes/196-nested-model-form-revised

That is also outdated, but it's all still useful. Instead of using attr_accessible, you'll have to use strong parameters in your controller. Remember to add question_ids: [].

This looks good to me, but I feel like DomainOwnership is doing a bit much. The validation in particular. I think it would make sense having that in the Domain model since the validation appears to be meant for it.

Posted in Single Table Inheritance: Good spot or not?

Ya, I'm on the fence. STI is really nice early on, but it's been a bit difficult for me to work with as apps get more complex. You may only have one differentiator now, but in the future you may have several which you'll have to work in. Something to watch out for.

Posted in CoffeeScript check if a checkbox is checked?

Perhaps using jQuery toggleClass method would be helpful here.

$("#bill_patient_checkbox").change ->
    $("#billing_address").toggleClass('hidden') # toggleClass and not just toggle
<div <% unless @record.patient_bill? %>class: 'hidden'<% end %> >
   <!-- Address Fields -->
</div>
.hidden {
  display: none;
}