Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implemented simple sorting behaviour for attachments in model layer
- position column, fill existing positions from creation order - depend on acts_as_list gem
- Loading branch information
Showing
5 changed files
with
21 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class AddPositionToAttachments < ActiveRecord::Migration | ||
def self.up | ||
add_column :attachments, :position, :integer | ||
Page.all(:include => :attachments).each do |page| | ||
page.attachments.each_with_index do |attachment, index| | ||
attachment.update_attributes :position => index+1 | ||
end | ||
end | ||
end | ||
|
||
def self.down | ||
remove_column :attachments, :position | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module RadiantAssetsExtension | ||
VERSION = '0.0.6' | ||
VERSION = '0.0.7' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters