Skip to content

Commit

Permalink
fix non-devise issues & closed SammyLin#85
Browse files Browse the repository at this point in the history
  • Loading branch information
SammyLin committed May 14, 2014
1 parent cda4f82 commit 3dead6a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/controller/redactor_rails/documents_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def create

file = params[:file]
@document.data = RedactorRails::Http.normalize_param(file, request)
if @document.respond_to?(RedactorRails.devise_user)
if @document.has_attribute?(:"#{RedactorRails.devise_user_key}")
@document.send("#{RedactorRails.devise_user}=", redactor_current_user)
@document.assetable = redactor_current_user
end
Expand All @@ -27,7 +27,7 @@ def create
private

def redactor_authenticate_user!
if RedactorRails.document_model.new.respond_to?(RedactorRails.devise_user)
if RedactorRails.document_model.new.has_attribute?(RedactorRails.devise_user)
super
end
end
Expand Down
6 changes: 3 additions & 3 deletions app/controller/redactor_rails/pictures_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class RedactorRails::PicturesController < ApplicationController
#before_filter :redactor_authenticate_user!
before_filter :redactor_authenticate_user!

def index
@pictures = RedactorRails.picture_model.where(
Expand All @@ -12,7 +12,7 @@ def create

file = params[:file]
@picture.data = RedactorRails::Http.normalize_param(file, request)
if @picture.respond_to?(RedactorRails.devise_user)
if @picture.has_attribute?(:"#{RedactorRails.devise_user_key}")
@picture.send("#{RedactorRails.devise_user}=", redactor_current_user)
@picture.assetable = redactor_current_user
end
Expand All @@ -27,7 +27,7 @@ def create
private

def redactor_authenticate_user!
if RedactorRails.picture_model.new.respond_to?(RedactorRails.devise_user)
if RedactorRails.picture_model.new.has_attribute?(RedactorRails.devise_user)
super
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
class CreateRedactorAssets < ActiveRecord::Migration
def self.up
create_table :redactor_assets do |t|
t.integer :user_id
t.string :data_file_name, :null => false
t.string :data_content_type
t.integer :data_file_size
Expand All @@ -27,4 +26,3 @@ def self.down
drop_table :redactor_assets
end
end

2 changes: 1 addition & 1 deletion lib/redactor-rails/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module RedactorRails
VERSION = "0.4.4"
VERSION = "0.4.5"
end

0 comments on commit 3dead6a

Please sign in to comment.