I have a class where I'm not getting the entire schema from the GET API call.
My schema.rb:
create_table "jumpsquares", force: true do |t|
t.string "name"
t.integer "apptype"
t.string "url"
t.string "ipordns"
t.text "description"
t.datetime "created_at"
t.datetime "updated_at"
t.string "tag"
t.string "jscreator"
t.string "remotetype"
end
The attributes of name, apptype, url, ipordns, description, created_at, and updated_at are available when I perform a GET API call, however the attributes of tag, jscreator, and remotetype are not being retrieved. These particular attributes are the result of 3 different DB migrations to add additional columns.
My remotetype migration:
class AddRemoteAccessColumnToJumpSquares < ActiveRecord::Migration
def change
add_column :jumpsquares, :remotetype, :string
end
end
My routes.rb:
resources :jumpsquares
Model:
class Jumpsquare < ActiveRecord::Base
has_many :apptypes
has_and_belongs_to_many :tags
def self.search(search)
if search
where('name ILIKE ? OR ipordns ILIKE ? OR url ILIKE ?', "%#{search}%", "%#{search}%", "%#{search}%")
else
all
end
end
end
GET Request
resource = RestClient::Resource.new( 'http://localhost:3000/jumpsquares' )
response = resource.get({'Accept' => 'application/json', 'Content-Type' => 'application/json'})
parsed_response = JSON.parse(response.body)
puts parsed_response
parsed_response.each do |jumpsquare|
jsresource = RestClient::Resource.new( jumpsquare["url"] )
jsresponse = jsresource.get({'Accept' => 'application/json', 'Content-Type' => 'application/json'})
jsparsed_response = JSON.parse(jsresponse.body)
puts jsparsed_response
end