Looks like you configure connection in the wrong place.  When
installed as plugin, service_merchant uses connection defined in
`config/database.yml` file of your Rails app.

What you have changed is a special connection that's only used in
service_merchant internal unit tests.

On 16 июн, 12:31, Vikas Gholap <[email protected]>
wrote:
> Hello all,
>
> I'm trying to use service merchant plugin in my application.
>
> i installed plugin in vendor/plugins dir.
>
> I am using mysql database. so i changed database configuration in two
> files of service_merchant
>
> 1)"vendor\plugins\service_merchant\tracker\test\connection.rb" and
>   "vendor\plugins\service_merchant\subscription_management\test"  as
> following
>
>    require 'rubygems'
> gem 'activerecord'
> require 'activerecord'
> #gem 'sqlite3-ruby'
>
> ActiveRecord::Base.establish_connection(
>     :adapter => "mysql",
>     :database  => "sarasave_service_marchant",
>     :username => "root",
>     :password => "myroot",
>     :host => "localhost"
> )
>
> now i created database successfully. using
>
> rake service_merchant:create_all_tables
>
> but when i run "demo.rb" file then i got following error of
> ConnectionNotEstablished -----
>
> F:\sarasaves_service_merchant\sarasaves\vendor\plugins\service_merchant>ruby
> dem
> o.rb --trace
> c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_a
> dapters/abstract/connection_pool.rb:326:in `retrieve_connection':
> ActiveRecord::
> ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished)
>         from
> c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record
> /connection_adapters/abstract/connection_specification.rb:123:in
> `retrieve_conne
> ction'
>         from
> c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record
> /connection_adapters/abstract/connection_specification.rb:115:in
> `connection'
>         from
> c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record
> /base.rb:1276:in `columns'
>         from
> c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record
> /base.rb:3008:in `attributes_from_column_definition_without_lock'
>         from
> c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record
> /locking/optimistic.rb:66:in `attributes_from_column_definition'
>         from
> c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record
> /base.rb:2435:in `initialize'
>         from
> ./subscription_management/lib/subscription_management.rb:82:in `new
> '
>         from
> ./subscription_management/lib/subscription_management.rb:82:in `sub
> scribe'
>         from demo.rb:55
>
> ------------------------------------------------------------------
>
> I tried  subscription = Subscription.new in my application console then
> it runs
>
> F:\sarasaves_service_merchant\sarasaves>ruby script/console
> Loading development environment (Rails 2.3.2)>> subscription = 
> Subscription.new
>
> => #<Subscription id: nil, account_id: nil, tariff_plan_id: nil,
> taxes_id: nil,
> quantity: nil, currency: nil, net_amount: nil, taxes_amount: nil,
> periodicity: n
> il, starts_on: nil, ends_on: nil, status: nil, created_at: nil,
> updated_at: nil,
>  deleted_at: nil>
>
> I don't understand what's the problem to run demo.rb?
>
> please tell me what went wrong,  if any one used service merchant
> plugin.
> --
> Posted viahttp://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]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to