hi ..
i was having a project in front where i was uploading videos. i have
used following definition for over witting the full_filename as
def full_filename
user_id = self.user_id
videopath = attachment_options[:path_prefix].to_s + user_id.to_s +
VIDEO_DIR
file_system_path = videopath
path = File.join(RAILS_ROOT, file_system_path , filename)
end
i m storing my videos in public/swf/videos/user_id/video_id path
so i have stored a constant
DOCUMENT_DIR = 'public/swf/uploads/'
VIDEO_DIR = '/videos/'
in the environment.rb.. this way i can access the files...
I believe that public_filename is an instance method, not a stored
attribute, so you'll need to give to_json some help. to_json, like
to_xml, supports parameters that help you make your rendering more
specific. In this case specifically I think you need to look into
making use of the :include (specify the associations to be part of the
json), and :methods (specify instance methods on the object to be
included).