Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
acts_as_pasting
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
acts_as_pasting
Commits
9203ca42
Commit
9203ca42
authored
Jul 20, 2020
by
Ivan Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
association to_sym
parent
12c2c9b9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
pastable.rb
lib/acts_as_pasting/pastable.rb
+1
-1
pasted.rb
lib/acts_as_pasting/pasted.rb
+1
-1
No files found.
lib/acts_as_pasting/pastable.rb
View file @
9203ca42
...
@@ -33,7 +33,7 @@ module ActsAsPasting
...
@@ -33,7 +33,7 @@ module ActsAsPasting
module
ClassMethods
module
ClassMethods
def
acts_as_pastable
associations
,
prefix:
''
,
**
options
def
acts_as_pastable
associations
,
prefix:
''
,
**
options
pasting_name
=
prefix
.
blank?
?
"
#{
associations
}
_pastings"
:
[
associations
,
prefix
,
'pastings'
].
join
(
'_'
).
to_sym
pasting_name
=
prefix
.
blank?
?
"
#{
associations
}
_pastings"
.
to_sym
:
[
associations
,
prefix
,
'pastings'
].
join
(
'_'
).
to_sym
has_many
(
pasting_name
,
->
{
where
(
type:
prefix
)
},
as: :pasteable
,
class_name:
'ActsAsPasting::Pasting'
)
has_many
(
pasting_name
,
->
{
where
(
type:
prefix
)
},
as: :pasteable
,
class_name:
'ActsAsPasting::Pasting'
)
has_many
(
associations
,
through:
pasting_name
,
source: :pasted
,
**
options
)
has_many
(
associations
,
through:
pasting_name
,
source: :pasted
,
**
options
)
end
end
...
...
lib/acts_as_pasting/pasted.rb
View file @
9203ca42
...
@@ -202,7 +202,7 @@ module ActsAsPasting
...
@@ -202,7 +202,7 @@ module ActsAsPasting
end
end
def
acts_as_pasted
associations
,
prefix:
''
,
**
options
def
acts_as_pasted
associations
,
prefix:
''
,
**
options
pasting_name
=
prefix
.
blank?
?
"
#{
associations
}
_pastings"
:
[
associations
,
prefix
,
'pastings'
].
join
(
'_'
).
to_sym
pasting_name
=
prefix
.
blank?
?
"
#{
associations
}
_pastings"
.
to_sym
:
[
associations
,
prefix
,
'pastings'
].
join
(
'_'
).
to_sym
has_many
(
pasting_name
,
->
{
where
(
type:
prefix
)
},
class_name:
'ActsAsPasting::Pasting'
,
as: :pasted
)
has_many
(
pasting_name
,
->
{
where
(
type:
prefix
)
},
class_name:
'ActsAsPasting::Pasting'
,
as: :pasted
)
has_many
(
associations
,
through:
pasting_name
,
source: :pasteable
,
**
options
)
has_many
(
associations
,
through:
pasting_name
,
source: :pasteable
,
**
options
)
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