On Thu, Oct 28, 2010 at 4:38 PM, David Kahn <[email protected]>wrote:

>
>
> On Thu, Oct 28, 2010 at 4:30 PM, Marnen Laibow-Koser <[email protected]
> > wrote:
>
>> David Kahn wrote in post #957895:
>> > In Rails 2 I could do this to get the view as a string (i.e. to save it
>> > to a
>> > file):
>> >
>> >     av = ActionView::Base.new(Rails::Configuration.new.view_path)
>> >     html = av.render(
>> >         :partial => "comparisons/display",
>> >         :locals => { :comparison => self, :format_html => nil,
>> > :print_view
>> > => print_view, :fully_qualified_url_prefix =>
>> > fully_qualified_url_prefix,
>> > :user => user }
>> >     )
>> >
>> > In Rails 3 it seemingly does not work anymore.
>>
>> Did you perchance want render_to_string (which also exists in Rails 2)?
>>
>
> Hmmm... yup, that works, thanks. Would rather do that in the model but  I
> can pass it in and step aside from this mess. I must have been hankering for
> punishment in doing it the way I did it in the first place.
>

Actually just discovered the reason I tried to do this in the model: I need
to render this view to string from other controllers/models. Do you know
offhand if I can just instantiate this controller and still call one of it's
methods to string from a different controller or even better from a model?
Just trying it right now and getting  "NameError Exception: uninitialized
constant InstallerController::ComparisonController" (foreign controller name
is InstallerController).





>> Best,
>> --
>> Marnen Laibow-Koser
>> http://www.marnen.org
>> [email protected]
>>
>> --
>> Posted via http://www.ruby-forum.com/.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ruby on Rails: Talk" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<rubyonrails-talk%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/rubyonrails-talk?hl=en.
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to