browsql 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +35 -0
- data/.rvmrv +0 -0
- data/BrowSQL.gemspec +19 -0
- data/Gemfile +44 -0
- data/Gemfile.lock +122 -0
- data/LICENSE.txt +22 -0
- data/README.md +34 -0
- data/Rakefile +5 -0
- data/app/assets/images/rails.png +0 -0
- data/app/assets/javascripts/brow_sql.js +15 -0
- data/app/assets/javascripts/brow_sql/tables.js.coffee +3 -0
- data/app/assets/stylesheets/brow_sql.css +13 -0
- data/app/assets/stylesheets/brow_sql/bootstrap_and_overrides.css.scss +29 -0
- data/app/assets/stylesheets/brow_sql/tables.css.scss +3 -0
- data/app/controllers/brow_sql/records_controller.rb +58 -0
- data/app/controllers/brow_sql/tables_controller.rb +53 -0
- data/app/controllers/brow_sql_controller.rb +2 -0
- data/app/helpers/application_helper.rb +2 -0
- data/app/helpers/tables_helper.rb +2 -0
- data/app/model/brow_sql/base.rb +11 -0
- data/app/model/brow_sql/record.rb +65 -0
- data/app/model/brow_sql/table.rb +78 -0
- data/app/views/brow_sql/records/_form.html.haml +10 -0
- data/app/views/brow_sql/records/edit.html.haml +4 -0
- data/app/views/brow_sql/records/index.html.haml +30 -0
- data/app/views/brow_sql/tables/_form.html.haml +14 -0
- data/app/views/brow_sql/tables/edit.html.haml +4 -0
- data/app/views/brow_sql/tables/index.html.haml +26 -0
- data/app/views/brow_sql/tables/show.html.haml +18 -0
- data/app/views/layouts/brow_sql.html.erb +76 -0
- data/config/locales/en.yml +5 -0
- data/config/routes.rb +7 -0
- data/db/seeds.rb +7 -0
- data/doc/README_FOR_APP +2 -0
- data/lib/BrowSQL.rb +10 -0
- data/lib/brow_sql/simple_form.rb +138 -0
- data/lib/brow_sql/version.rb +3 -0
- data/lib/tasks/.gitkeep +0 -0
- data/public/404.html +26 -0
- data/public/422.html +26 -0
- data/public/500.html +25 -0
- data/public/favicon.ico +0 -0
- data/public/index.html +241 -0
- data/public/robots.txt +5 -0
- data/test/fixtures/.gitkeep +0 -0
- data/test/functional/.gitkeep +0 -0
- data/test/functional/tables_controller_test.rb +7 -0
- data/test/integration/.gitkeep +0 -0
- data/test/performance/browsing_test.rb +12 -0
- data/test/test_helper.rb +13 -0
- data/test/unit/.gitkeep +0 -0
- data/test/unit/helpers/tables_helper_test.rb +4 -0
- metadata +106 -0
data/.gitignore
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
|
2
|
+
#
|
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
|
5
|
+
# git config --global core.excludesfile ~/.gitignore_global
|
|
6
|
+
|
|
7
|
+
# Ignore bundler config
|
|
8
|
+
/.bundle
|
|
9
|
+
|
|
10
|
+
# Ignore the default SQLite database.
|
|
11
|
+
/db/*.sqlite3
|
|
12
|
+
|
|
13
|
+
# Ignore all logfiles and tempfiles.
|
|
14
|
+
/log
|
|
15
|
+
/tmp
|
|
16
|
+
*.rbc
|
|
17
|
+
*.sassc
|
|
18
|
+
.sass-cache
|
|
19
|
+
/spec/tmp/*
|
|
20
|
+
/coverage/
|
|
21
|
+
|
|
22
|
+
# Ignore all configurations.
|
|
23
|
+
.rspec
|
|
24
|
+
.rvmrc
|
|
25
|
+
|
|
26
|
+
# Ignore deployment bundle, and precompiled assets
|
|
27
|
+
/vendor/bundle
|
|
28
|
+
/public/system/*
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
data/.rvmrv
ADDED
|
File without changes
|
data/BrowSQL.gemspec
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'brow_sql/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |gem|
|
|
7
|
+
gem.name = "browsql"
|
|
8
|
+
gem.version = BrowSql::VERSION
|
|
9
|
+
gem.authors = ["Johan Frølich"]
|
|
10
|
+
gem.email = ["johanfrolich@gmail.com"]
|
|
11
|
+
gem.description = %q{A simple gem for browsing through your sql Database in Rails}
|
|
12
|
+
gem.summary = %q{A simple gem for browsing through your sql Database in Rails}
|
|
13
|
+
gem.homepage = ""
|
|
14
|
+
|
|
15
|
+
gem.files = `git ls-files`.split($/)
|
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
|
18
|
+
gem.require_paths = ["lib"]
|
|
19
|
+
end
|
data/Gemfile
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
# Specify your gem's dependencies in BrowSql.gemspec
|
|
4
|
+
gemspec
|
|
5
|
+
|
|
6
|
+
gem 'rails', '3.2.9'
|
|
7
|
+
|
|
8
|
+
# Bundle edge Rails instead:
|
|
9
|
+
# gem 'rails', :git => 'git://github.com/rails/rails.git'
|
|
10
|
+
|
|
11
|
+
gem 'sqlite3'
|
|
12
|
+
gem 'haml'
|
|
13
|
+
gem 'simple_form'
|
|
14
|
+
|
|
15
|
+
# Gems used only for assets and not required
|
|
16
|
+
# in production environments by default.
|
|
17
|
+
group :assets do
|
|
18
|
+
gem 'sass-rails', '~> 3.2.3'
|
|
19
|
+
gem 'coffee-rails', '~> 3.2.1'
|
|
20
|
+
# gem 'twitter-bootstrap-rails'
|
|
21
|
+
gem 'bootstrap-sass', '~> 2.1.1'
|
|
22
|
+
|
|
23
|
+
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
|
24
|
+
# gem 'therubyracer', :platforms => :ruby
|
|
25
|
+
|
|
26
|
+
gem 'uglifier', '>= 1.0.3'
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
gem 'jquery-rails'
|
|
30
|
+
|
|
31
|
+
# To use ActiveModel has_secure_password
|
|
32
|
+
# gem 'bcrypt-ruby', '~> 3.0.0'
|
|
33
|
+
|
|
34
|
+
# To use Jbuilder templates for JSON
|
|
35
|
+
# gem 'jbuilder'
|
|
36
|
+
|
|
37
|
+
# Use unicorn as the app server
|
|
38
|
+
# gem 'unicorn'
|
|
39
|
+
|
|
40
|
+
# Deploy with Capistrano
|
|
41
|
+
# gem 'capistrano'
|
|
42
|
+
|
|
43
|
+
# To use debugger
|
|
44
|
+
# gem 'debugger'
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
browsql (0.0.1)
|
|
5
|
+
|
|
6
|
+
GEM
|
|
7
|
+
remote: https://rubygems.org/
|
|
8
|
+
specs:
|
|
9
|
+
actionmailer (3.2.9)
|
|
10
|
+
actionpack (= 3.2.9)
|
|
11
|
+
mail (~> 2.4.4)
|
|
12
|
+
actionpack (3.2.9)
|
|
13
|
+
activemodel (= 3.2.9)
|
|
14
|
+
activesupport (= 3.2.9)
|
|
15
|
+
builder (~> 3.0.0)
|
|
16
|
+
erubis (~> 2.7.0)
|
|
17
|
+
journey (~> 1.0.4)
|
|
18
|
+
rack (~> 1.4.0)
|
|
19
|
+
rack-cache (~> 1.2)
|
|
20
|
+
rack-test (~> 0.6.1)
|
|
21
|
+
sprockets (~> 2.2.1)
|
|
22
|
+
activemodel (3.2.9)
|
|
23
|
+
activesupport (= 3.2.9)
|
|
24
|
+
builder (~> 3.0.0)
|
|
25
|
+
activerecord (3.2.9)
|
|
26
|
+
activemodel (= 3.2.9)
|
|
27
|
+
activesupport (= 3.2.9)
|
|
28
|
+
arel (~> 3.0.2)
|
|
29
|
+
tzinfo (~> 0.3.29)
|
|
30
|
+
activeresource (3.2.9)
|
|
31
|
+
activemodel (= 3.2.9)
|
|
32
|
+
activesupport (= 3.2.9)
|
|
33
|
+
activesupport (3.2.9)
|
|
34
|
+
i18n (~> 0.6)
|
|
35
|
+
multi_json (~> 1.0)
|
|
36
|
+
arel (3.0.2)
|
|
37
|
+
bootstrap-sass (2.1.1.0)
|
|
38
|
+
builder (3.0.4)
|
|
39
|
+
coffee-rails (3.2.2)
|
|
40
|
+
coffee-script (>= 2.2.0)
|
|
41
|
+
railties (~> 3.2.0)
|
|
42
|
+
coffee-script (2.2.0)
|
|
43
|
+
coffee-script-source
|
|
44
|
+
execjs
|
|
45
|
+
coffee-script-source (1.4.0)
|
|
46
|
+
erubis (2.7.0)
|
|
47
|
+
execjs (1.4.0)
|
|
48
|
+
multi_json (~> 1.0)
|
|
49
|
+
haml (3.1.7)
|
|
50
|
+
hike (1.2.1)
|
|
51
|
+
i18n (0.6.1)
|
|
52
|
+
journey (1.0.4)
|
|
53
|
+
jquery-rails (2.1.3)
|
|
54
|
+
railties (>= 3.1.0, < 5.0)
|
|
55
|
+
thor (~> 0.14)
|
|
56
|
+
json (1.7.5)
|
|
57
|
+
mail (2.4.4)
|
|
58
|
+
i18n (>= 0.4.0)
|
|
59
|
+
mime-types (~> 1.16)
|
|
60
|
+
treetop (~> 1.4.8)
|
|
61
|
+
mime-types (1.19)
|
|
62
|
+
multi_json (1.3.7)
|
|
63
|
+
polyglot (0.3.3)
|
|
64
|
+
rack (1.4.1)
|
|
65
|
+
rack-cache (1.2)
|
|
66
|
+
rack (>= 0.4)
|
|
67
|
+
rack-ssl (1.3.2)
|
|
68
|
+
rack
|
|
69
|
+
rack-test (0.6.2)
|
|
70
|
+
rack (>= 1.0)
|
|
71
|
+
rails (3.2.9)
|
|
72
|
+
actionmailer (= 3.2.9)
|
|
73
|
+
actionpack (= 3.2.9)
|
|
74
|
+
activerecord (= 3.2.9)
|
|
75
|
+
activeresource (= 3.2.9)
|
|
76
|
+
activesupport (= 3.2.9)
|
|
77
|
+
bundler (~> 1.0)
|
|
78
|
+
railties (= 3.2.9)
|
|
79
|
+
railties (3.2.9)
|
|
80
|
+
actionpack (= 3.2.9)
|
|
81
|
+
activesupport (= 3.2.9)
|
|
82
|
+
rack-ssl (~> 1.3.2)
|
|
83
|
+
rake (>= 0.8.7)
|
|
84
|
+
rdoc (~> 3.4)
|
|
85
|
+
thor (>= 0.14.6, < 2.0)
|
|
86
|
+
rake (10.0.0)
|
|
87
|
+
rdoc (3.12)
|
|
88
|
+
json (~> 1.4)
|
|
89
|
+
sass (3.2.3)
|
|
90
|
+
sass-rails (3.2.5)
|
|
91
|
+
railties (~> 3.2.0)
|
|
92
|
+
sass (>= 3.1.10)
|
|
93
|
+
tilt (~> 1.3)
|
|
94
|
+
sprockets (2.2.1)
|
|
95
|
+
hike (~> 1.2)
|
|
96
|
+
multi_json (~> 1.0)
|
|
97
|
+
rack (~> 1.0)
|
|
98
|
+
tilt (~> 1.1, != 1.3.0)
|
|
99
|
+
sqlite3 (1.3.6)
|
|
100
|
+
thor (0.16.0)
|
|
101
|
+
tilt (1.3.3)
|
|
102
|
+
treetop (1.4.12)
|
|
103
|
+
polyglot
|
|
104
|
+
polyglot (>= 0.3.1)
|
|
105
|
+
tzinfo (0.3.35)
|
|
106
|
+
uglifier (1.3.0)
|
|
107
|
+
execjs (>= 0.3.0)
|
|
108
|
+
multi_json (~> 1.0, >= 1.0.2)
|
|
109
|
+
|
|
110
|
+
PLATFORMS
|
|
111
|
+
ruby
|
|
112
|
+
|
|
113
|
+
DEPENDENCIES
|
|
114
|
+
bootstrap-sass (~> 2.1.1)
|
|
115
|
+
browsql!
|
|
116
|
+
coffee-rails (~> 3.2.1)
|
|
117
|
+
haml
|
|
118
|
+
jquery-rails
|
|
119
|
+
rails (= 3.2.9)
|
|
120
|
+
sass-rails (~> 3.2.3)
|
|
121
|
+
sqlite3
|
|
122
|
+
uglifier (>= 1.0.3)
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2012 Johan Frølich
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
BrowSQL
|
|
2
|
+
=======
|
|
3
|
+
|
|
4
|
+
A simple app for browsing through your sql Database in Rails
|
|
5
|
+
=======
|
|
6
|
+
# BrowSql
|
|
7
|
+
|
|
8
|
+
TODO: Write a gem description
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
Add this line to your application's Gemfile:
|
|
13
|
+
|
|
14
|
+
gem 'BrowSql'
|
|
15
|
+
|
|
16
|
+
And then execute:
|
|
17
|
+
|
|
18
|
+
$ bundle
|
|
19
|
+
|
|
20
|
+
Or install it yourself as:
|
|
21
|
+
|
|
22
|
+
$ gem install BrowSql
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
TODO: Write usage instructions here
|
|
27
|
+
|
|
28
|
+
## Contributing
|
|
29
|
+
|
|
30
|
+
1. Fork it
|
|
31
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
32
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
33
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
34
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
|
Binary file
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
|
2
|
+
// listed below.
|
|
3
|
+
//
|
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
|
6
|
+
//
|
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
8
|
+
// the compiled file.
|
|
9
|
+
//
|
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
|
12
|
+
//
|
|
13
|
+
//= require jquery
|
|
14
|
+
//= require jquery_ujs
|
|
15
|
+
//= require_tree .
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
3
|
+
* listed below.
|
|
4
|
+
*
|
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
|
7
|
+
*
|
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
|
10
|
+
*
|
|
11
|
+
*= require_self
|
|
12
|
+
*= require_tree .
|
|
13
|
+
*/
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Set the correct sprite paths
|
|
2
|
+
$iconSpritePath: url('glyphicons-halflings.png');
|
|
3
|
+
$iconWhiteSpritePath: url('glyphicons-halflings-white.png');
|
|
4
|
+
|
|
5
|
+
@import "bootstrap";
|
|
6
|
+
|
|
7
|
+
@import "bootstrap-responsive";
|
|
8
|
+
|
|
9
|
+
// Set the Font Awesome (Font Awesome is default. You can disable by commenting below lines)
|
|
10
|
+
// Note: If you use asset_path() here, your compiled boostrap_and_overrides.css will not
|
|
11
|
+
// have the proper paths. So for now we use the absolute path.
|
|
12
|
+
//@fontAwesomeEotPath: asset-path("fontawesome-webfont.eot");
|
|
13
|
+
//@fontAwesomeWoffPath: asset-path("fontawesome-webfont.woff");
|
|
14
|
+
//@fontAwesomeTtfPath: asset-path("fontawesome-webfont.ttf");
|
|
15
|
+
//@fontAwesomeSvgPath: asset-path("fontawesome-webfont.svg");
|
|
16
|
+
|
|
17
|
+
// Font Awesome
|
|
18
|
+
//@import "fontawesome";
|
|
19
|
+
|
|
20
|
+
// Your custom SASS stylesheets goes here
|
|
21
|
+
//
|
|
22
|
+
// Since bootstrap was imported above you have access to its mixins which
|
|
23
|
+
// you may use and inherit here
|
|
24
|
+
//
|
|
25
|
+
// If you'd like to override bootstrap's own variables, you can do so here as well
|
|
26
|
+
// See http://twitter.github.com/bootstrap/customize.html#variables for their names and documentation
|
|
27
|
+
//
|
|
28
|
+
// Example:
|
|
29
|
+
// @linkColor: #ff0000;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
module BrowSql
|
|
2
|
+
class RecordsController < BrowSqlController
|
|
3
|
+
|
|
4
|
+
before_filter :find_table
|
|
5
|
+
before_filter :find_record, only: [:show, :edit, :update, :destroy]
|
|
6
|
+
|
|
7
|
+
def index
|
|
8
|
+
@records = @table.records
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def show
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def new
|
|
15
|
+
@record = Record.new
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def edit
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def create
|
|
22
|
+
@record = Record.new(params[:record])
|
|
23
|
+
|
|
24
|
+
if @record.save
|
|
25
|
+
redirect_to @record, notice: "#{@record.name} record was successfully created."
|
|
26
|
+
else
|
|
27
|
+
render action: "new"
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def update
|
|
32
|
+
if @record.update_attributes(params[:record])
|
|
33
|
+
redirect_to @record, notice: "#{@record.name} record was successfully updated."
|
|
34
|
+
else
|
|
35
|
+
render action: "edit"
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def destroy
|
|
40
|
+
flash[:notice] = "Record was successfully destroyed."
|
|
41
|
+
@record.destroy(@table)
|
|
42
|
+
|
|
43
|
+
redirect_to table_records_url(@table)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
private
|
|
47
|
+
|
|
48
|
+
def find_record
|
|
49
|
+
@record = @table.find_record(params[:id])
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def find_table
|
|
53
|
+
@table ||= Table.find(params[:table_id])
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
module BrowSql
|
|
2
|
+
class TablesController < BrowSqlController
|
|
3
|
+
|
|
4
|
+
before_filter :find_table, only: [:show, :edit, :update, :destroy]
|
|
5
|
+
|
|
6
|
+
def index
|
|
7
|
+
@tables = Table.all
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def show
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def new
|
|
14
|
+
@table = Table.new
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def edit
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def create
|
|
21
|
+
@table = Table.new(params[:table])
|
|
22
|
+
|
|
23
|
+
if @table.save
|
|
24
|
+
redirect_to @table, notice: "#{@table.name} table was successfully created."
|
|
25
|
+
else
|
|
26
|
+
render action: "new"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def update
|
|
31
|
+
if @table.update_attributes(params[:table])
|
|
32
|
+
redirect_to @table, notice: "#{@table.name} table was successfully updated."
|
|
33
|
+
else
|
|
34
|
+
render action: "edit"
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def destroy
|
|
39
|
+
flash[:notice] = "#{@table.name} table was successfully destroyed."
|
|
40
|
+
@table.destroy
|
|
41
|
+
|
|
42
|
+
redirect_to tables_url
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
private
|
|
46
|
+
|
|
47
|
+
def find_table
|
|
48
|
+
@table ||= Table.find(params[:id])
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
end
|
|
53
|
+
end
|