0

example:

I have a Deposit Table => deposit = $100, date_added = Time.now, profit_percent = 0.01. user_id

The process => profit = deposit * profit_percent, date = Time.now

earning_history Table => profit , date, user_id

I want to do the process each month automatically and insert into earning history for all members. a month is based on date_added.1.month so it's differ for any member. The rake is not for infrequently jobs. Corn jobs maybe okay but how can I use it for all members with different date and time!

Can anyone help me, please guide me in details... any plugin suggestion, any workflow?


Edited:

Look I have an accounts table > Member chooses an account

I have a deposits table > Member deposits an amount

I have a profits table > it seeks in deposits and grab the amount and date_added, process it and add the profit and date (Time.now) to profits table

how can I say the server to do this automatically for profits table, to grab amount, process it and add it to profits table for all members! I know SQL code also ruby's, I just don't know how to communicate with server to do this! Model, Controller?!

As I know in MVC, browser sends command controller and controller connect model and model connect to database then it returns to controller then view then browser.

I want only model and database do this for my application, not browser command. :-s

4

2 に答える 2