views:

35

answers:

1

HI friends,

I have a situation where i have to convert a partial into string from Active-Record.

Here is the code:

Facebooker::Session.create(Facebooker.api_key, Facebooker.secret_key).send_email(
      facebook_user_id,
      "MAIL_SUBJECT",
      (:partial=>"some/partial")              
    )

This is being called from a model.

TO convert the partial into string, i resorted to render_to_string method and called it using:

ActionController::Base.new.send("render_to_string",{:partial=>"some/partial"})

But its throwing errors.

Any help please......

+1  A: 

If you're trying to call controller code from models, you are doing something wrong. It looks like you want to send an email, maybe look at ActionMailer? Or explain better what you are trying to do and why you're putting that in the model code and not controller code.

dvyjones