Commit db4b209840f2ecd2f057d3c069d5b138cd94dfae
Exists in
master
and in
1 other branch
Merge branch 'change_members_page' into 'master'
Change members page Some of the collaboration blocks are using the wrong url to its communities members page, this MR fix this. See merge request !3
Showing
1 changed file
with
24 additions
and
0 deletions
Show diff stats
db/migrate/20150916134427_change_members_page_link_in_all_softwares_communities.rb
0 → 100644
| @@ -0,0 +1,24 @@ | @@ -0,0 +1,24 @@ | ||
| 1 | +# encoding: utf-8 | ||
| 2 | + | ||
| 3 | +class ChangeMembersPageLinkInAllSoftwaresCommunities < ActiveRecord::Migration | ||
| 4 | + def up | ||
| 5 | + Community.joins(:software_info).each do |software_community| | ||
| 6 | + collaboration_block = Block.joins(:box).where("boxes.owner_id = ? AND blocks.type = ? AND blocks.title = ?", software_community.id, "LinkListBlock", "Colaboração").readonly(false).first | ||
| 7 | + | ||
| 8 | + if collaboration_block | ||
| 9 | + collaboration_block.links.each do |link| | ||
| 10 | + link["address"] = "/profile/#{software_community.identifier}/members" if link["name"] == "Usuários" | ||
| 11 | + end | ||
| 12 | + collaboration_block.save! | ||
| 13 | + print "." | ||
| 14 | + end | ||
| 15 | + end | ||
| 16 | + | ||
| 17 | + puts "" | ||
| 18 | + end | ||
| 19 | + | ||
| 20 | + def down | ||
| 21 | + say "This can't be reverted" | ||
| 22 | + end | ||
| 23 | +end | ||
| 24 | + |