Ruby on Rails Wednesday, January 11, 2017

As stated in #8934, using Anonymous Classes are not supported. That said, IF I were to use an anonymous class, what suggestions and concerns would you have? This is how I am using it currently

tempConnection = Class::new(ActiveRecord::Base) do      def self.name         @name      end  end  tempConnection.instance_variable_set("@name","#{params[:database]}#{params[:table]}")  config = tempConnection.connection_config.clone  config[:database] = params[:database]  tempConnection.table_name = params[:table]  tempConnection.establish_connection(config)

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/2c63d7ce-7d36-4101-b1b1-8411868cc761%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment