Class: IshLibManager::NewsitemsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- IshLibManager::NewsitemsController
- Defined in:
- app/controllers/ish_lib_manager/newsitems_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/ish_lib_manager/newsitems_controller.rb', line 12 def create :create, ManagerNewsitem.new n = Newsitem.new params[:newsitem] n.report = Report.find params[:newsitem][:report_id] unless params[:newsitem][:report_id].blank? n.gallery = Gallery.find params[:newsitem][:gallery_id] unless params[:newsitem][:gallery_id].blank? n.photo = Photo.find params[:newsitem][:photo_id] unless params[:newsitem][:photo_id].blank? n.descr = params[:newsitem][:descr] @city = City.find params[:city_id] @city.newsitems << n if @city.save flash[:notice] = 'Success' redirect_to edit_manager_city_path( @city.id ) else flash[:error] = 'No Luck. ' + @city.errors.inspect render :action => :new_newsitem end end |
#destroy ⇒ Object
40 41 42 43 44 45 46 |
# File 'app/controllers/ish_lib_manager/newsitems_controller.rb', line 40 def destroy @site = Site.find params[:site_id] @newsitem = @site.newsitems.find params[:id] :destroy, @newsitem @newsitem.remove redirect_to site_path( @site.id ) end |
#index ⇒ Object
37 38 |
# File 'app/controllers/ish_lib_manager/newsitems_controller.rb', line 37 def index end |
#new ⇒ Object
4 5 6 7 8 9 10 |
# File 'app/controllers/ish_lib_manager/newsitems_controller.rb', line 4 def new :new, ManagerNewsitem.new @newsitem = Newsitem.new @city = City.find params[:city_id] end |
#show ⇒ Object
34 35 |
# File 'app/controllers/ish_lib_manager/newsitems_controller.rb', line 34 def show end |
#update ⇒ Object
48 49 |
# File 'app/controllers/ish_lib_manager/newsitems_controller.rb', line 48 def update end |