This file contains hidden or 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
| def home | |
| @slug = ('a'..'z').to_a.shuffle[0,8].join | |
| redirect_to main_path(@slug) | |
| end |
This file contains hidden or 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
| def find_site | |
| @slug = params[:id].downcase | |
| @site = Site.find_by(name: @slug) | |
| if @site.present? | |
| expired? | |
| end | |
| end |
This file contains hidden or 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
| module SitesHelper | |
| def private? | |
| @site.locked && session[@site.name.to_sym] != "session-unlocked" | |
| end | |
| end |
This file contains hidden or 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
| module SitesHelper | |
| def postable? | |
| !@site.locked || (@site.locked && session[@site.name.to_sym] == "session-unlocked") | |
| end | |
| def private? | |
| @site.locked && session[@site.name.to_sym] != "session-unlocked" | |
| end | |
| end |
This file contains hidden or 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
| class Array | |
| def all_but?(number = 0) | |
| count = 0 | |
| if !block_given? | |
| each { |item| count += 1 if item } | |
| else | |
| each { |item| count += 1 if yield(item) } | |
| end | |
| count >= length - number | |
| end |
OlderNewer