The syntax I used really doesn't work. Thank you for the tip.
Now I'm using @task.to_fxml(:include => :reminder) but it still doesn't work (on Flex). If I try a GET on the browser, the reminder is shown with the task, but my problem is into the create method. This is what the log says (I truncated the larger lines):
Processing TasksController#create to fxml ...
4;36;1mSQL (0.0ms) [0m [0;1mBEGIN [0m
4;35;1mTask Create (15.0ms) [0m [0mINSERT INTO `tasks` ...
4;36;1mReminder Load (0.0ms) [0m [0;1mSELECT * FROM `reminders` WHERE (`reminders`.task_id = 20) ...
4;35;1mReminder Columns (0.0ms) [0m [0mSHOW FIELDS FROM `reminders` [0m
4;36;1mReminder Create (0.0ms) [0m [0;1mINSERT INTO `reminders`...
4;35;1mSQL (94.0ms) [0m [0mCOMMIT [0m
I suppose that the task.reminder is being loaded at the third line, but it is being really created at the fifth line! I think this is why the reminder isn't being loaded into RestfulX's cache.
I also tried do not use the after_create filter and call the update_reminder method manually, someting like this (into tasks controller, create method):
if @task.save
task.update_reminder
In the log, the difference is that all sql commands to create the task and load the reminder are wrapped into a BEGIN ... COMMIT block and the sql command to create the reminder (fifth line posted above) is wrapped into another BEGIN...COMMIT block.
I have no clue on how to solve this. I think I'll need some workaround into the Flex side, something like reloading my models (reminders).
Some suggestion?
Thank you again!
Elvis Fernandes