I would like to create an Active Record object with a string attribute containing string interpolation.
My Schema for the model looks like this:
create_table "twilio_messages", force: true do |t|
t.string "name"
t.string "body"
t.datetime "created_at"
t.datetime "updated_at"
end
And I have created an object of this model using Active Admin that looks as the following:
=> #<TwilioMessage id: 5, name: "weekly_message", body: "\#{user.firstname} you're on the list for this week'...", created_at: "2014-05-29 22:24:36", updated_at: "2014-05-30 17:14:56">
The issue is that the string I am creating for the body should look like this:
"#{user.firstname} you're on the list for this week's events! www.rsvip.biz/#events"
So that the user.firstname gets interpolated into the string and therefore prints out the user's name.
How do I create this type of record without the database automatically trying to escape the interpolation with a "\" ?