Class: DictionariesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- DictionariesController
- Defined in:
- app/controllers/dictionaries_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
18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/dictionaries_controller.rb', line 18 def create @dictionary = Dictionary.new(dictionary_params) respond_to do |format| if @dictionary.save format.html { redirect_to dictionaries_url(resource_type: @dictionary.resource_type, resource_id: @dictionary.resource_id), notice: '添加成功' } else format.html { render :new } end end end |
#destroy ⇒ Object
40 41 42 43 44 45 46 |
# File 'app/controllers/dictionaries_controller.rb', line 40 def destroy url = dictionaries_url(resource_type: @dictionary.resource_type, resource_id: @dictionary.resource_id) @dictionary.destroy respond_to do |format| format.html { redirect_to url, notice: '删除成功' } end end |
#edit ⇒ Object
15 16 |
# File 'app/controllers/dictionaries_controller.rb', line 15 def edit end |
#index ⇒ Object
4 5 6 |
# File 'app/controllers/dictionaries_controller.rb', line 4 def index @dictionaries = Dictionary.where(resource_type: params[:resource_type], resource_id: params[:resource_id]) end |
#new ⇒ Object
11 12 13 |
# File 'app/controllers/dictionaries_controller.rb', line 11 def new @dictionary = Dictionary.new(resource_type: params[:resource_type], resource_id: params[:resource_id]) end |
#show ⇒ Object
8 9 |
# File 'app/controllers/dictionaries_controller.rb', line 8 def show end |
#update ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/dictionaries_controller.rb', line 30 def update respond_to do |format| if @dictionary.update(dictionary_params) format.html { redirect_to dictionaries_url(resource_type: @dictionary.resource_type, resource_id: @dictionary.resource_id), notice: '修改成功' } else format.html { render :edit } end end end |