I am trying to store my ruby object in couchdb with couchrest. I am extending my model from CouchRest::Model::Base
But still i am unable to see the changes in db.
I've defined Server as CouchRest.new also mentioned in model to use_database 'players'
# Controller Method
get '/new/:name' do
DB = SERVER.database!('players')
@new_player = Player.new(params['name'])
@new_player.create
"success: #{@new_player.persisted?}" #shows true
# Model
class Player < CouchRest::Model::Base
use_database 'players'
property :name ,String
timestamps!
def initialize(arg)
@name=arg
end
end
- How To Persist the object?
- How can i retreive all persisted objects?
- Is there any simple applications which i can refer to?