Class: DatastoreMongo::MongoStringsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/datastore_mongo/mongo_strings_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /mongo_strings POST /mongo_strings.json



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'app/controllers/datastore_mongo/mongo_strings_controller.rb', line 43

def create
  @mongo_string = MongoString.new(params[:mongo_string])
  
  respond_to do |format|
    if @mongo_string.save
      format.html { redirect_to @mongo_string, notice: 'Mongo string was successfully created.' }
      format.json { render json: @mongo_string, status: :created, location: @mongo_string }
    else
      format.html { render action: "new" }
      format.json { render json: @mongo_string.errors, status: :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /mongo_strings/1 DELETE /mongo_strings/1.json



75
76
77
78
79
80
81
82
83
# File 'app/controllers/datastore_mongo/mongo_strings_controller.rb', line 75

def destroy
  @mongo_string = MongoString.find(params[:id])
  @mongo_string.destroy
  
  respond_to do |format|
    format.html { redirect_to mongo_strings_url }
    format.json { head :ok }
  end
end

#editObject

GET /mongo_strings/1/edit



37
38
39
# File 'app/controllers/datastore_mongo/mongo_strings_controller.rb', line 37

def edit
  @mongo_string = MongoString.find(params[:id])
end

#indexObject

GET /mongo_strings GET /mongo_strings.json



5
6
7
8
9
10
11
12
# File 'app/controllers/datastore_mongo/mongo_strings_controller.rb', line 5

def index
  @mongo_strings = MongoString.all
  
  respond_to do |format|
    format.html # index.html.erb
    format.json { render json: @mongo_strings }
  end
end

#newObject

GET /mongo_strings/new GET /mongo_strings/new.json



27
28
29
30
31
32
33
34
# File 'app/controllers/datastore_mongo/mongo_strings_controller.rb', line 27

def new
  @mongo_string = MongoString.new
  
  respond_to do |format|
    format.html # new.html.erb
    format.json { render json: @mongo_string }
  end
end

#showObject

GET /mongo_strings/1 GET /mongo_strings/1.json



16
17
18
19
20
21
22
23
# File 'app/controllers/datastore_mongo/mongo_strings_controller.rb', line 16

def show
  @mongo_string = MongoString.find(params[:id])
  
  respond_to do |format|
    format.html # show.html.erb
    format.json { render json: @mongo_string }
  end
end

#updateObject

PUT /mongo_strings/1 PUT /mongo_strings/1.json



59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'app/controllers/datastore_mongo/mongo_strings_controller.rb', line 59

def update
  @mongo_string = MongoString.find(params[:id])
  
  respond_to do |format|
    if @mongo_string.update_attributes(params[:mongo_string])
      format.html { redirect_to @mongo_string, notice: 'Mongo string was successfully updated.' }
      format.json { head :ok }
    else
      format.html { render action: "edit" }
      format.json { render json: @mongo_string.errors, status: :unprocessable_entity }
    end
  end
end