1. Список говнокодов пользователя opak

    Всего: 4

  2. Ruby / Говнокод #8792

    −101

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    def type
        return 'Anonymous'   if self.builtin == BUILTIN_ANONYMOUS
        return 'Non Member'  if self.builtin == BUILTIN_NON_MEMBER
        return 'Member'      if self.builtin == BUILTIN_MEMBER
        return 'User'        if self.builtin == BUILTIN_USER
        return 'Manager'     if self.builtin == BUILTIN_MANAGER
        return 'Architect'   if self.builtin == BUILTIN_ARCHITECT
        return 'Designer'    if self.builtin == BUILTIN_DESIGNER
        return 'Customer'    if self.builtin == BUILTIN_CUSTOMER
        return 'Vendor'      if self.builtin == BUILTIN_VENDOR
        return 'Dealer'      if self.builtin == BUILTIN_DEALER
      end
    
      def require_name
        return 'is_anonymous'   if self.builtin == BUILTIN_ANONYMOUS
        return 'is_non_member'  if self.builtin == BUILTIN_NON_MEMBER
        return 'is_member'      if self.builtin == BUILTIN_MEMBER
        return 'is_user'        if self.builtin == BUILTIN_USER
        return 'is_manager'     if self.builtin == BUILTIN_MANAGER
        return 'is_architect'   if self.builtin == BUILTIN_ARCHITECT
        return 'is_designer'    if self.builtin == BUILTIN_DESIGNER
        return 'is_customer'    if self.builtin == BUILTIN_CUSTOMER
        return 'is_vendor'      if self.builtin == BUILTIN_VENDOR
        return 'is_dealer'      if self.builtin == BUILTIN_DEALER
      end

    еще ниже в модели

    opak, 10 Декабря 2011

    Комментарии (12)
  3. Ruby / Говнокод #8791

    −99

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    # Return all the permissions that can be given to the role
      def for_set_permissions
        permissions = Abt::AccessControl.permissions
        permissions = Abt::AccessControl.user_permissions      if self.builtin == BUILTIN_USER
        permissions = Abt::AccessControl.manager_permissions   if self.builtin == BUILTIN_MANAGER
        permissions = Abt::AccessControl.architect_permissions if self.builtin == BUILTIN_ARCHITECT
        permissions = Abt::AccessControl.designer_permissions  if self.builtin == BUILTIN_DESIGNER
        permissions = Abt::AccessControl.customer_permissions  if self.builtin == BUILTIN_CUSTOMER
        permissions = Abt::AccessControl.vendor_permissions    if self.builtin == BUILTIN_VENDOR
        permissions = Abt::AccessControl.dealer_permissions    if self.builtin == BUILTIN_DEALER
        permissions - Abt::AccessControl.public_permissions
      end

    Сурово

    opak, 10 Декабря 2011

    Комментарии (1)
  4. Ruby / Говнокод #8790

    −102

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    <div class="pane">
            <% #Вывод материалов
               if pms.size > 0 %>
                <% for pm in pms do %>
                    <div class="mat">
                      <div><%= pm.name %></div>
                      <p>art. <%= pm.id %></p>
                      <%= image_tag pm.image.url(:small) %>
                      <%= link_to 'Выбрать +', '#' %>
                    </div>
                <% end %>
            <% end %>
          </div>

    ПМС =)

    opak, 10 Декабря 2011

    Комментарии (8)
  5. Ruby / Говнокод #8789

    −103

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    class Person < ActiveRecord::Base  
    def self.current=(person)
        @current_people = person
      end
      def self.current
        @current_people
      end
    end

    Определяют текущего пользователя в модели=)

    opak, 10 Декабря 2011

    Комментарии (9)