uninitialized constant ShopifyAPI::CustomerGroup::Customers error - ruby-on-rails

No doubt I am doing something wrong here, but I am following instructions on a new commit from here.
I am getting the following error
uninitialized constant ShopifyAPI::CustomerGroup::Customers
00:33:56 web.1 | /Users/matt/.rvm/gems/ruby-1.9.3-p0/gems/shopify_api-3.0.3/lib/shopify_api/resources/customer_group.rb:4:in `customers''
When running this code
group = ShopifyAPI::CustomerGroup.find(5614012)
customers = group.customers
Here is the gem file mentioned above

Version 3.0.3 should solve the problem, I'll have to look into why it isn't.
In the meantime, the following will do what you want:
group = ShopfiyAPI::CustomerGroup.find(123)
customers = group.get(:customers)

Related

Ruby uninitialized constant Pipl::Person (NameError)

I am trying to integrate the Pipl API into my ruby on rails application. I am using ruby version 2.3.4 and rails 4.2.5. As a reference i looked at
this site
and copied the ruby version of the code directly from it into a ruby file. When I run the ruby file in the terminal i get the error:
`<main>': uninitialized constant Pipl::Person (NameError)
Any ideas why I'm getting this error? Any help is greatly appreciated.
This is the code snippet that I used:
require 'pipl'
person = Pipl::Person.new
person.add_field Pipl::Name.new(first: 'Clark', last: 'Kent')
person.add_field Pipl::Address.new(country: 'US', state: 'KS', city:
'Smallville')
person.add_field Pipl::Address.new(country: 'US', state: 'KS', city:
'Metropolis')
response = Pipl::client.search person: person, api_key: 'myKEY' #I used my actual key here
puts "#{response}"
Thanks!
In order to use the Pipl API without the error, I got my API key through their site and I added piplapis-ruby gem just like what was told in the comments above. I imported all of the ruby classes found here: https://github.com/piplcom/piplapis-ruby into my project and pasted the codesnippet.rb file found here: https://github.com/piplcom/piplapis-ruby which was the ruby file you're supposed to execute. There was no need for me to create the Person class.

Keep getting this error in Ruby on Rails: rake aborted! NameError: uninitialized constant Faker::Coffee

Trying to re-seed an existing Ruby on Rails application. Before, this exact same seed file worked but after db:dropping, db:creating, db:migrating, I can no longer seed my database using the db:seed. I keep getting this error,
"NameError: uninitialized constant Faker::Coffee"
I am using the Faker gem to populate my database and I used that successfully before, have bundle installed and updated my gemfile, but still no luck. Scoured this site and web but have found no solutions so far. Tried to not use faker and simply seed data using my own names but still got the same error as above, just with the name I wanted to use. I am stuck, any help is greatly appreciated. Thank you.
Here is my seed file for reference:
b = Menu.create(name: 'Breakfast')
l = Menu.create(name: 'Lunch')
d = Menu.create(name: 'Dinner')
ln = Menu.create(name: 'Late Night')
def add_menu_items(menu)
10.times do
menu.menu_items.create(
name: Faker::Coffee.blend_name,
description: Faker::Coffee.notes,
price: Faker::Number.between(5.50, 100.75)
)
end
end
add_menu_items(b)
add_menu_items(l)
add_menu_items(d)
add_menu_items(ln)
puts 'Menus Seeded'

Rails 5: Error when removed quiet_assets_path from development.rb

I have been trying to upgrade my app from Rails 4 to Rails 5. In my Rails 4 version I have quiet_assets_path set but in Rails 5 it is not required. But when I removed that tried to start the server I am getting the following error,
> ruby-2.2.2/gems/rack-mini-profiler-0.10.2/lib/mini_profiler_rails/railtie.rb:93:in
> `>': comparison of Fixnum with nil failed (ArgumentError) from
> /Users/Admin/.rvm/gems/ruby-2.2.2/gems/rack-mini-profiler-0.10.2/lib/mini_profiler_rails/railtie.rb:93:in
> `block in <class:Railtie>'
Can someone help me with this?
Edit:
Following is my rack_profiler.rb,
if Rails.env.development? || Rails.env.production?
require 'rack-mini-profiler'
# initialization is skipped so trigger it
Rack::MiniProfilerRails.initialize!(Rails.application)
Rack::MiniProfiler.config.skip_schema_queries = true
Rack::MiniProfiler.config.skip_paths += %w(/admin/sidekiq)
Rails.application.middleware.delete(Rack::MiniProfiler)
Rails.application.middleware.insert_after(Rack::Deflater, Rack::MiniProfiler)
end
When I comment the delete line then server is starting but if the line uncommented then the server breaks.
thanks for the update. First of all, do you use Rack::Deflater middleware in development environment too?
I think this issue might help you. It basically says that in Rails all delete middleware operations are issued at the end. You can use the swap method as described in the above issue.
If you search the repo issues for "Deflater" you'll find a lot of results, but I believe the above contains your fix.

"no implicit conversion of nil into String"in the Search Module of Redmine

On the redmine of my company, there is this bug where I get an internal error if I want to search into a project.
Here is the log corresponding to the error:
Processing by SearchController#index as HTML
Parameters: {"utf8"=>"✓", "issues"=>"1", "q"=>"test", "id"=>"sprint"}
Current user: me (id=60)
Completed 500 Internal Server Error in 85.0ms
TypeError (no implicit conversion of nil into String):
lib/plugins/acts_as_searchable/lib/acts_as_searchable.rb:126:in `search'
app/controllers/search_controller.rb:74:in `block in index'
app/controllers/search_controller.rb:73:in `each'
app/controllers/search_controller.rb:73:in `index'
The lines corresponding to the error in the controller are :
if !#tokens.empty?
# no more than 5 tokens to search for
#tokens.slice! 5..-1 if #tokens.size > 5
#results = []
#results_by_type = Hash.new {|h,k| h[k] = 0}
limit = 10
#scope.each do |s|
r, c = s.singularize.camelcase.constantize.search(#tokens, projects_to_search,
:all_words => #all_words,
:titles_only => #titles_only,
:limit => (limit+1),
:offset => offset,
:before => params[:previous].nil?)
#results += r
Here is my config :
Environment:
Redmine version 2.6.9.stable
Ruby version 2.3.0-p0 (2015-12-25) [x86_64-linux]
Rails version 3.2.22
Environment production
Database adapter PostgreSQL
SCM:
Git 1.9.1
Filesystem
Redmine plugins:
no plugin installed
What is interesting is that when I search only one letter, i'm redirected on the search page, but I don't have an internal error.
I'm very new to Redmine developpement and to Ruby, I was just assigned to try to fix this bug. Do any of you have an idea of how to fix it ?
Thanks.
I had the same issue, I was able to fix it by downgrading my ruby & rails version, a working set is :
Rails 3.2.19
Ruby 2.1.4p265
It's look like it's due to a braking change in ruby-2.3.0.
It's really odd. We are using 'Redmine' -2.0.3.1 and we do not have that kind of behaviour.
It seems that "someone" messed up the form linked to the search input. Try to follow that data from when you press enter until it answer you with the 500 error code.
If you can , change the environment to development, this way it will show you more detailed errors.
But I can't help you much more , you didn't provide enough info about the problem.

RSRuby installation and R configuration error

I tried to install RSRuby following the steps mentioned in http://web.kuicr.kyoto-u.ac.jp/~alexg/rsruby/manual.pdf and http://nsaunders.wordpress.com/2009/05/20/baby-steps-with-rsruby-in-rails/ and I must say that nsaunders blog is indeed a great start for anyone installing RSRuby. But when I tried to check from the irb by creating an instance of RSRuby:
r = RSRuby.instance
it returned me error:
1.8.7-p371 :001 > r = RSRuby.instance
NameError: uninitialized constant RSRuby
from (irb):1
I have all the prerequisites: R_HOME, shared lib option and other stuff. I dont know why I got this error. Any ideas guyzz?????
has anyone tried it for rails successfully???
Without seeing the full source code it's difficult to give you an answer, so this is just a guess. Did you remember to require 'rsruby' within your code? NameError is often caused when a gem is installed but the code does not include the appropriate require statement:
require 'rsruby'
r = RSRuby.instance
You can see this in the code example in the "Documentation" section of the README in the GitHub project.

Resources