Thank you David
On Thursday, January 19, 2017 at 5:59:48 PM UTC+1, David Williams wrote:
>
> vocabularies = File.read(Rails.root.join('lib', 'seeds', 'words.csv'))
> csv = CSV.parse(vocabularies, :headers => true, :encoding => 'ISO-8859-1')
> csv.each do |row|
> t = Vocabulary.new
> t.word_col
This is for your seed file. You can create a task for it as well.
On Thursday, January 19, 2017 at 11:59:48 AM UTC-5, David Williams wrote:
>
> vocabularies = File.read(Rails.root.join('lib', 'seeds', 'words.csv'))
> csv = CSV.parse(vocabularies, :headers => true, :encoding => 'ISO-8859-1')
> csv.
vocabularies = File.read(Rails.root.join('lib', 'seeds', 'words.csv'))
csv = CSV.parse(vocabularies, :headers => true, :encoding => 'ISO-8859-1')
csv.each do |row|
t = Vocabulary.new
t.word_column1 = row[0]
t.word_column2 = row[1]
t.word_column3 = row[2]
t.word_column4 = row[3]
t.word
Hi Daynthan,
I have the same problem. So I see you got working solution.
Please, can you post final version of working important files?
Thank you.
On Friday, January 6, 2017 at 2:45:29 PM UTC+1, daynthan kabilan wrote:
>
> Thank you Tamosus pontik.
>
> I have done the task using this keyword requ
Thank you Tamosus pontik.
I have done the task using this keyword require "#{dynamic_model_name}"
On Thu, Jan 5, 2017 at 7:24 PM, tamouse pontiki
wrote:
> On Thu, Jan 5, 2017 at 2:40 AM Daynthan Kabilan
> wrote:
>
>> Hi Tamosus pontik,
>>
>> Thanks for your reply.
>> The model file is created
On Thu, Jan 5, 2017 at 2:40 AM Daynthan Kabilan
wrote:
> Hi Tamosus pontik,
>
> Thanks for your reply.
> The model file is created dynamically based on this code.
>
And after you write that file, you need to require it for Rails to use it.
That's why the constant is undefined.
Do you know how t
Hi Tamosus pontik,
Thanks for your reply.
The model file is created dynamically based on this code.
model_file = File.join("app", "models", fname.singularize+".rb")
model_name = fname.singularize.capitalize
File.open(model_file, "w+") do |f|
f << "class #{model_name} < ActiveRecord
On Wed, Jan 4, 2017 at 8:57 AM Daynthan Kabilan
wrote:
> Hi,
>
> I have a CSV upload option and need to create a table and model based on
> the CSV colums.
>
> We allow to upload different kind of CSV file formats and each file upload
> will create new table and info will be stored accordingly. I
Hi,
I have a CSV upload option and need to create a table and model based on
the CSV colums.
We allow to upload different kind of CSV file formats and each file upload
will create new table and info will be stored accordingly. I have created a
table with columns based on CSV file header and also
9 matches
Mail list logo