Sha256: da893bd982fe0d1d5798746d189c49968590f1cd531d0a748854d469fc299abd
Contents?: true
Size: 842 Bytes
Versions: 2
Compression:
Stored size: 842 Bytes
Contents
require_dependency "almanac/application_controller" module Almanac class ImagesController < ApplicationController load_and_authorize_resource class: Almanac::Image respond_to :html def create @blog = Almanac::Blog.first @image = Image.new(params[:image]) if params[:post_id] == "0" @post = Post.create( { :published => false, :author_id => current_user.id, :blog_id => @blog.id } ) else @post = Post.find(params[:post_id]) end @image.post = @post respond_with(@image) do |format| if @image.save format.html { redirect_to edit_post_path(@image.post), :notice => 'Image was successfully created.' } else format.html { render :action => :back, :alert => 'Something went wrong, try again.' } end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
almanac-0.4.5 | app/controllers/almanac/images_controller.rb |
almanac-0.4.4 | app/controllers/almanac/images_controller.rb |