namespace :app do
desc ‘Create dummy data’
task :setup => :environment do
[
{ :name => ‘Test User’, :email => ‘[email protected]’ },
].each do |client|
puts ‘-----------------’
puts client.name
end
end
end
Your code just looks wrong to me - you’re iterating over an array of
hashes, so client is a hash. Hashes don’t have a name method so
client.name blows up. Did you mean client[:name] or intend to use
that data to create an active record object first?
Fred
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.