ruby on rails - POSTing from a controller. Need help -
i have bit of strange situation. in process of modifying fat_free_crm client. want lightweight crm automatically create few followup tasks in weeks following customer's entry system. in contacts controller, writing method run when create action performed. action automatically create 4 necessary tasks. have data saved in several hashes.
is there way can these queries without changing pages? is, query create contact going through task.new(hash_name).save doesn't seem function intended or @ least, intended.
any ideas?
def autotask(user,contact) user.id t=time.now task1 = [ :hash_data => here ] task2 =[ :hash_data => here ] task3 =[ :hash_data => here ] task4 =[ :hash_data => here ] task=task.new(task1) task.save task=task.new(task2) task.save task=task.new(task3) task.save task=task.new(task4) task.save end
task1 = [ :hash_data => here ]
makes task1 array instead of hash. if want hash instead, need change brackets curly braces:
task1 = { :hash_data => here }
the constructor accepts hash , ignore array.
Comments
Post a Comment