Sha256: aeea00e15016bf369ec364096f349e1f094b538c4686551995a7a61a99bef82b
Contents?: true
Size: 640 Bytes
Versions: 8
Compression:
Stored size: 640 Bytes
Contents
class SharesController < ApplicationController respond_to :html, :json, :xml, :js before_filter :add_user def create @share = parent.shares.create((params[:share]||{})) respond_with(@share, :location => send("#{parent.class.name.underscore}_url",parent)) end protected def parent @parent ||= params[:shareable_type].classify.constantize.find(params[:shareable_id]) instance_variable_set("@#{params[:shareable_type].underscore}",@parent) end def add_user if defined?(current_user) && current_user params[:share] ||= {} params[:share][:user_id] = current_user.id end end end
Version data entries
8 entries across 8 versions & 1 rubygems