>
> I know what your problem is. If because of changes to Rails reconnecting to
> the db by using the old connection doesn't work, then I suggested that you
> give up on using the old connection and just instruct AR to connect as if
> the application was just booting up. Have you tried what I suggested at all?
> Are you having the same problem?
>
>   def without_database_connection
>     ActiveRecord::Base.remove_connection
>     begin
>       yield
>     ensure
>       ActiveRecord::Base.establish_connection Rails.env
>     end
>   end
>
>
   Thanks Mislav, I tried your suggestion, but it doesn't work.

   My actual problem is not about restoring the connection (but thanks for
the tip, I may need it eventually).
   It is about the fact that I _always_ get exception when I'm trying to
access model attributes when connection was removed with remove_connection
(i.e. I get exception in the yield part).

   BTW, have you tried your helper on Rails 3.1.1?

   Thanks,
   KIR




> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Core" 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-core?hl=en.
>



-- 

Kirill (KIR) Maximov

Software Engineer & Starter


Twitter:       http://twitter.com/maxkir

Skype:        maxkir

http://kirblog.idetalk.com | http://checkvist.com |
http://www.jetbrains.com/teamcity

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" 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-core?hl=en.

Reply via email to