I am trying to follow.
in the actor_name variable - do you want the actor’s name? if so, isn’t Actor.find(self.actor_id).name enough? what does the sanitize_filename do?
Does your user choose the actor for which they are uploading the file from a dropdown or type on the actor name, or how does your app know what actor your user is trying to upload a file for?
Just to make sure that I understand correctly - your Actor model has an action_movie_id?
assuming that the model instance of the file_upload has actor_id, does not have to be saved yet, then maybe these changes will help?
(its possible that I am completely missing the point - had very little sleep last night :] )
actor = Actor.find(self.actor_id)
file_system_path = (thumbnail ? thumbnail_class :self).attachment_options[:file_system_path]
actor_name = actor.name
action_movie_name = ActionMovie.find(actor.action_movie_id).name
File.join(RAILS_ROOT, file_system_path, action_movie_name, ‘actors’,actor_name, ‘mug_shot’, thumbnail_name_for(thumbnail))
also, with the changing the filename from
my_picture_of_actor_in_las_vegas.jpg to actor_name.jpg
actor_name.jpg - what is your strategy to do this?