Class: BrowSql::RecordsController
- Inherits:
-
BrowSqlController
- Object
- ActionController::Base
- BrowSqlController
- BrowSql::RecordsController
- Defined in:
- app/controllers/brow_sql/records_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/brow_sql/records_controller.rb', line 21 def create @record = Record.new(params[:record]) if @record.save redirect_to @record, notice: "#{@record.name} record was successfully created." else render action: "new" end end |
#destroy ⇒ Object
39 40 41 42 43 44 |
# File 'app/controllers/brow_sql/records_controller.rb', line 39 def destroy flash[:notice] = "Record was successfully destroyed." @record.destroy(@table) redirect_to table_records_url(@table) end |
#edit ⇒ Object
18 19 |
# File 'app/controllers/brow_sql/records_controller.rb', line 18 def edit end |
#index ⇒ Object
7 8 9 |
# File 'app/controllers/brow_sql/records_controller.rb', line 7 def index @records = @table.records end |
#new ⇒ Object
14 15 16 |
# File 'app/controllers/brow_sql/records_controller.rb', line 14 def new @record = Record.new end |
#show ⇒ Object
11 12 |
# File 'app/controllers/brow_sql/records_controller.rb', line 11 def show end |
#update ⇒ Object
31 32 33 34 35 36 37 |
# File 'app/controllers/brow_sql/records_controller.rb', line 31 def update if @record.update_attributes(params[:record]) redirect_to @record, notice: "#{@record.name} record was successfully updated." else render action: "edit" end end |