Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
paperclip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
paperclip
Commits
e59d0b53
Commit
e59d0b53
authored
Apr 24, 2012
by
Prem Sichanugrist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move Schema includes into Paperclip::Glue
parent
ec1aa8be
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
7 deletions
+12
-7
lib/paperclip/glue.rb
+8
-0
lib/paperclip/railtie.rb
+4
-7
No files found.
lib/paperclip/glue.rb
View file @
e59d0b53
require
'paperclip/callbacks'
require
'paperclip/validators'
require
'paperclip/schema'
module
Paperclip
module
Glue
...
...
@@ -8,6 +10,12 @@ module Paperclip
base
.
send
:include
,
Validators
base
.
class_attribute
:attachment_definitions
if
defined?
(
ActiveRecord
)
ActiveRecord
::
ConnectionAdapters
::
AbstractAdapter
.
send
(
:include
,
Paperclip
::
Schema
)
ActiveRecord
::
ConnectionAdapters
::
Table
.
send
(
:include
,
Paperclip
::
Schema
)
ActiveRecord
::
ConnectionAdapters
::
TableDefinition
.
send
(
:include
,
Paperclip
::
Schema
)
end
locale_path
=
Dir
.
glob
(
File
.
dirname
(
__FILE__
)
+
"/locales/*.{rb,yml}"
)
I18n
.
load_path
+=
locale_path
unless
I18n
.
load_path
.
include?
(
locale_path
)
end
...
...
lib/paperclip/railtie.rb
View file @
e59d0b53
...
...
@@ -3,27 +3,24 @@ require 'paperclip/schema'
module
Paperclip
require
'rails'
class
Railtie
<
Rails
::
Railtie
initializer
'paperclip.insert_into_active_record'
do
ActiveSupport
.
on_load
:active_record
do
Paperclip
::
Railtie
.
insert
end
end
rake_tasks
do
load
"tasks/paperclip.rake"
end
rake_tasks
{
load
"tasks/paperclip.rake"
}
end
class
Railtie
def
self
.
insert
Paperclip
.
options
[
:logger
]
=
Rails
.
logger
if
defined?
(
Rails
)
Paperclip
.
options
[
:logger
]
=
Rails
.
logger
if
defined?
(
ActiveRecord
)
Paperclip
.
options
[
:logger
]
=
ActiveRecord
::
Base
.
logger
ActiveRecord
::
Base
.
send
(
:include
,
Paperclip
::
Glue
)
ActiveRecord
::
ConnectionAdapters
::
AbstractAdapter
.
send
(
:include
,
Paperclip
::
Schema
)
ActiveRecord
::
ConnectionAdapters
::
Table
.
send
(
:include
,
Paperclip
::
Schema
)
ActiveRecord
::
ConnectionAdapters
::
TableDefinition
.
send
(
:include
,
Paperclip
::
Schema
)
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment