kurenn / sabisu-rails

Simple and powerful engine for exploring your Rails api application
MIT License
127 stars 29 forks source link

NoMethodError in SabisuRails::ExplorerController#index #35

Closed deivuh closed 8 years ago

deivuh commented 8 years ago

I'm getting this error after the login prompt.

`undefined method '+' for nil:NilClass` error
Extracted source (around line #1532):
        address() + (port == HTTP.https_default_port ? '' : ":#{port()}")
      else
        address() + (port == HTTP.http_default_port ? '' : ":#{port()}")
      end
    end

Am I doing something wrong?

kurenn commented 8 years ago

Did you add any configuration to the sabisu initializer?

can I see the initializer?

deivuh commented 8 years ago

Sure, here it is:

# Use this module to configure the sabisu available options

SabisuRails.setup do |config|

  # Base uri for posting the 
  # config.base_api_uri = nil 

  # Ignored attributes for building the forms
  # config.ignored_attributes = %w{ created_at updated_at id }

  # HTTP methods
  # config.http_methods = %w{ GET POST PUT DELETE PATCH }

  # Headers to include on each request
  #
  # You can configure the api headers fairly easy by just adding the correct headers
  # config.api_headers = { "Accept" => "application/json,application/vnd.application.v1" }
  #
  # config.api_headers = {}

  # Layout configuration
  # config.layout = "sabisu"

  # Resources on the api
  config.resources = [:users]

  config.default_resource = :users

  # Application name
  # mattr_accessor :app_name
  # @@app_name = Rails.application.class.parent_name

  # Authentication
  # mattr_accessor :authentication_username
  # @@authentication_username = "admin"

  # mattr_accessor :authentication_password
  # @@authentication_password = "sekret"

end
kurenn commented 8 years ago

You need to setup the base_api_uri

SabisuRails.setup do |config|

  # Base uri for posting the 
  config.base_api_uri = "api.marketplaceapi.dev"
end

Checkout the final result at:

https://github.com/kurenn/market_place_api/blob/master/config/initializers/sabisu_rails.rb

Let me know how it goes