Since you've looked at the view and the controller, I'm starting to
suspect something in your model. I'm happy to take a look at yours,
and I've attached my Custodian model below in case you want to look
through it. .
As for csv export, my apologies, I should have mentioned you'll need a
couple other pieces. First, you need the rails plugin
acts_as_csvable. Second, you need to specify the export formats in
your model. See the acts_as_csv_exportable lines in my model below:
class Custodian < ActiveRecord::Base
hobo_model # Don't put anything above this
Custodian_type = HoboFields::EnumString.for
(:employee, :contractor, :group, :other)
Status = HoboFields::EnumString.for(:active, :inactive)
fields do
name :string, :unique
custodian_type Custodian_type
last_name :string
job_title :string
network_login :string
status Status
email :email_address
hire_date :date
hire_date_estimated :boolean
departure_date :date
departure_date_estimated :boolean
notes :text
timestamps
end
# custodian properties support through other tables
has_many :alternate_names, :dependent => :destroy, :accessible =>
true
belongs_to :location
belongs_to :group
# associations with other entities
has_many :project_custodians, :dependent => :destroy
has_many :projects, :through => :project_custodians
has_many :file_sets, :dependent => :destroy, :accessible => true
# --- Default sorting --- #
set_default_order "last_name, name"
# --- Import / Export --- #
acts_as_csv_exportable :default,
[:name, :last_name, :network_login, :custodian_type, :status, :project_list,
:file_set_count, :total_megabytes, :total_items]
acts_as_csv_exportable :complete,
[:name, :custodian_type, :last_name, :alternate_names_list, :job_title,
:network_login, :status, :email, :hire_date, :departure_date, :notes,
:project_list, :file_set_count, :total_megabytes, :total_items]
def alternate_names_list
alternate_names.try.*.name.sort.join(', ') || ""
end
def project_list
projects.try.*.name.sort.join(', ') || ""
end
def file_set_count
file_sets.count
end
def total_megabytes
file_sets.try.*.size_megabytes.inject {|sum, elt| sum + (elt ||
0)} || 0
end
def total_volume
total_megabytes * 1024 * 1024
end
def total_items
file_sets.try.*.size_items.inject {|sum, elt| sum + (elt || 0)} ||
0
end
# --- Permissions --- #
include PermissionUser
# --- Validations --- #
validates_uniqueness_of :name, :allow_nil => false
validates_uniqueness_of :email, :allow_nil => true
validates_uniqueness_of :network_login, :allow_nil => true
validates_date :hire_date, :allow_nil => true, :before =>
[:departure_date, Proc.new {1.day.from_now.to_date}]
validates_date :departure_date, :allow_nil => true, :before =>
Proc.new {1.day.from_now.to_date}, :after => :hire_date
end
On Jun 23, 4:42 pm, hobo_hippy <[email protected]> wrote:
> this is what my output looks like (and it won't change!!)
>
> Updated At Client Project User Time
> Timesheet
> June 23, 2009 19:54 Arther Test coding admin 54 tsheet1
> June 23, 2009 19:55 Billy Test graphics admin 20
> banner work
> June 23, 2009 20:15 Arther Test coding bob 332 bo sheep
> June 23, 2009 20:23 Arther Test coding admin 34 more from the
> admin
>
> the search button doesn't work either (even after fixing search param
> to name since name is the string in fields do and title doesn't exist)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---