From a11f5a1b91b34d9f0c96fe59dc64bf31fb1029ab Mon Sep 17 00:00:00 2001 From: Jason Denney Date: Thu, 21 Nov 2013 20:36:35 -0500 Subject: [PATCH] Needed to add task_list_id as attr_accessible Also improved labels for adding task --- app/components/tasks.rb | 11 ++++++----- app/models/task.rb | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/components/tasks.rb b/app/components/tasks.rb index 6ce8a8f..c153ded 100644 --- a/app/components/tasks.rb +++ b/app/components/tasks.rb @@ -29,13 +29,14 @@ class Tasks < Netzke::Basepack::Grid end def default_fields_for_forms - fields = [] - fields << { :no_binding => true, :xtype => 'displayfield', :fieldLabel => "No Bike Selected", :value => "Select a Bike First!"} - fields.concat( [ + bike = Bike.find_by_id(session[:selected_bike_id]) + bike = "Select a Bike First!" if bike.nil? + [ + { :no_binding => true, :xtype => 'displayfield', :fieldLabel => "Bike Selected", :value => "#{bike.to_s}"}, :done, :task, - :notes - ]) + :notes, + ] end #override with nil to remove actions diff --git a/app/models/task.rb b/app/models/task.rb index 4a1a5a0..85bfa5b 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -1,5 +1,5 @@ class Task < ActiveRecord::Base - attr_accessible :task, :notes, :done + attr_accessible :task, :notes, :done, :task_list_id belongs_to :task_list