Thursday, 15 September 2011

soundcloud - Cannot use gem in rails controller -



soundcloud - Cannot use gem in rails controller -

i'm rails noob, help appreciated.

i've installed soundcloud gem via:

$ gem install soundcloud

then added gem gemfile, , ran rails bundle install create sure included in project:

$ bundle install

this output list of of included gems project. 1 of items towards end soundcloud gem:

$ bundle install ... using sdoc 0.4.0 using soundcloud 0.3.2 using spring 1.1.2 ... bundle complete! utilize `bundle show [gemname]` see bundled gem installed.

now when run rails console in application directory, able access soundcloud module expected:

$ rails console loading development environment (rails 4.1.0) 2.1.1 :001 > soundcloud => soundcloud 2.1.1 :002 > client = soundcloud.new(:client_id => 'b2dab282f8bb29467dcb4f5b27f7c075') => #<soundcloud::client:0x8972f40 ... (successful results here)

but when seek utilize soundcloud module in controller or view, page error:

uninitialized constant slideshowcontroller::soundcloud

here code seek utilize soundcloud module:

helper_method :sc_get_src def sc_get_src @sc_client ||= soundcloud.new(:client_id => 'b2dab282f8bb29467dcb4f5b27f7c075') sound = @sc_client.get('/resolve', :url => @slideshow.sound) homecoming sound.uri end

on documentation page here first line in illustration is:

require 'soundcloud'

however, if add together before utilize soundcloud module (in controller, model, view etc) throws error:

cannot load such file -- soundcloud

please help. there step need take include module in application?

thank in advance.

those problems solved restart of rails server. e.g. passenger:

$ touch tmp/restart.txt

reason is, gem dependencies loaded in startup phase of app

ruby-on-rails-4 soundcloud ruby-on-rails-plugins

No comments:

Post a Comment