refinerycms-page-images 0.9.3 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,10 @@
1
+ class ImagePage < ActiveRecord::Base
2
+
3
+ belongs_to :image
4
+ belongs_to :page
5
+
6
+ before_save do |image_page|
7
+ image_page.position = (ImagePage.maximum(:position) || -1) + 1
8
+ end
9
+
10
+ end
data/lib/gemspec.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- version = '0.9.3'
2
+ version = '0.9.4'
3
3
  raise "Could not get version so gemspec can not be built" if version.nil?
4
4
  files = %w( readme.md )
5
5
  %w(app config generators lib public rails test vendor).each do |dir|
@@ -9,8 +9,9 @@ module Refinery
9
9
 
10
10
  config.to_prepare do
11
11
  Page.module_eval do
12
-
13
- has_and_belongs_to_many :images
12
+
13
+ has_many :image_pages
14
+ has_many :images, :through => :image_pages
14
15
  accepts_nested_attributes_for :images, :allow_destroy => false
15
16
 
16
17
  def images_attributes=(data)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refinerycms-page-images
3
3
  version: !ruby/object:Gem::Version
4
- hash: 61
4
+ hash: 51
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 3
10
- version: 0.9.3
9
+ - 4
10
+ version: 0.9.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Resolve Digital
@@ -30,7 +30,7 @@ extra_rdoc_files: []
30
30
 
31
31
  files:
32
32
  - readme.md
33
- - app/models/images_pages.rb
33
+ - app/models/image_page.rb
34
34
  - app/views/admin/pages/tabs/_images.html.erb
35
35
  - lib/gemspec.rb
36
36
  - lib/generators/refinerycms_page_images_generator.rb
@@ -1,6 +0,0 @@
1
- class ImagesPages < ActiveRecord::Base
2
-
3
- has_many :images
4
- has_many :pages
5
-
6
- end