I’m a newby and I fight with the Rails convention - i think so.
I’ve done little tools and scripts in Ruby before.
I’ve successfully uploaded a textfile. And now i want to extract some
filecontent to pass it into a database.
My Problem:
I can not start a given method of a given Model (=>
Metadata.extract_content(fileuri)). The error message ‘undefined method
`extract_content’ for Metadata:Class’ is raised. But the method is still
there!?
My Controller Action:
#########################################
def upload @schema_file = params[:schema_file]
@file = File.new(File.join("D:","testfile.txt"), "wb")
if @schema_file
@file << @schema_file.read
end
@file.close
Metadata.extract_content(@file) # <- error causing line
render :action => 'load'
end
#########################################
My Model:
#########################################
class Metadata < ActiveRecord::Base
def extract_content file
# logic
end
end
#########################################
Apart from this i’m not allowed to call any extern method out of the
controller. (?)
How can i call extern method?
Are there any RoR conventions or constrains for this topic?
Dear reader,
please have a look at our new database for students www.spirofrog.de –
Start Your Global Career.
We want to help students from Germany and Europe to do an internship in
foreign countries and international students to find suitable positions
in
German and European companies.
Additionally, we also place students in jobs for Young Professionals.
This
service is sponsored by companies = Students have free access
Our customers include TVM Capital, European Investors Inc., Ebay, and
many
more.
We would also like to post job offers and the company profile from your
company in our database.
Please do not hesitate to contact us and we will try to find you the
suitable candidates or companies.
Best regards,
Jessica from Spirofrog – Start Your Global Career
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.16.13/1169 - Release Date:
03.12.2007
22:56
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.