Wednesday, February 29, 2012

Wednesday, February 15, 2012

Rails javascript Tag

Using javascript tag allows you to include ruby code in javascript so that it gets interpreted when code is generated.

Here is an example wherein format for AnyTime.picker is dependent on the report for which the approach time field is rendered.

<%= javascript_tag "AnyTime.picker( 'approach_time', {   format: '#{@report.approach_time_format_picker}',   firstDOW: 0 } );"

Sunday, February 12, 2012

ActiveRelation in Session

If you ever see this:

TypeError (no marshal_dump is defined for class Mutex):

You are probably trying to store an ActiveRelation in the session.

Thursday, February 9, 2012

Adding a New Report

Adding new reports for ASC is straightforward, though not yet automated. This example illustrates adding the TutorDropInReport.

  1. Add entry to routes file:
    resources :tutor_drop_in_reports, :controller => "tutor_reports"
  2. Create empty model TutorDropInReport that extends Report.
  3. Create ReportType entry. See seeds.rb
  4. Create field descriptors. See seeds.rb
  5. Add to menu view, views/organizations/orgs/AcademicSkillsCenterOrganization/_reports_menu.html.erb
  6. Add to MY_REPORTS in models/academic_skills_center_organization.rb
  7. Update config/locales/en.yml