Class: IshManager::TagsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- IshManager::TagsController
- Defined in:
- app/controllers/ish_manager/tags_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/ish_manager/tags_controller.rb', line 27 def create @tag = Tag.create params[:tag].permit! :create, @tag if @tag.save flash[:notice] = 'Success.' redirect_to else puts! @tag.errors, "error creating tag." flash[:error] = "No luck. #{@tag.errors.}" render :action => :new end end |
#destroy ⇒ Object
60 61 62 63 64 65 66 67 68 69 |
# File 'app/controllers/ish_manager/tags_controller.rb', line 60 def destroy @tag = Tag.unscoped.find params[:id] :destroy, @tag if @tag.destroy flash[:notice] = 'Success' else flash[:alert] = "Cannot destroy tag: #{@tag.errors.}" end redirect_to :action => 'index' end |
#edit ⇒ Object
40 41 42 43 |
# File 'app/controllers/ish_manager/tags_controller.rb', line 40 def edit @tag = Tag.unscoped.find params[:id] :edit, @tag end |
#index ⇒ Object
6 7 8 9 10 11 12 |
# File 'app/controllers/ish_manager/tags_controller.rb', line 6 def index @tags = Tag.unscoped.where( :parent_tag_id => nil ).order_by( :name => :asc ) :index, Tag.new @site = Site.find( params[:site_id] ) if params[:site_id] @city = City.find( params[:city_id] ) if params[:city_id] end |
#new ⇒ Object
22 23 24 25 |
# File 'app/controllers/ish_manager/tags_controller.rb', line 22 def new @tag = Tag.new :new, @tag end |
#show ⇒ Object
14 15 16 17 18 19 20 |
# File 'app/controllers/ish_manager/tags_controller.rb', line 14 def show @tag = Tag.unscoped.find params[:id] :show, @tag @galleries = @tag.galleries.unscoped.where( :is_trash => false ).page( params[:galleries_page] ).per( 10 ) @videos = @tag.videos.unscoped.where( :is_trash => false ).page( params[:videos_page ]).per( 10 ) end |
#update ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/controllers/ish_manager/tags_controller.rb', line 45 def update @tag = Tag.unscoped.find params[:id] :update, @tag # byebug if @tag.update_attributes params[:tag].permit! flash[:notice] = 'Success.' redirect_to else flash[:error] = 'No luck.' render :action => :new end end |