• 我用的又拍云的裁剪的~~

  • Ruby China 镜像域名变化 at 2018年06月24日

    如你所愿

  • 6,佩服~~~😂 😂 😂

  • 是有点尴尬

  • 厉害啊 加油

  • Ruby China 生日快乐! at 2017年10月28日

    🎉 🎂 🍰 Ruby China 创立 6 周年纪念日 🍰 🎂 🎉

  • 看到了你的那个,支持一下,加油

  • 噗,根据提问来嘛。他这个跨度有点大

  • 噗,这个问题有很多人给我提过,其实个人不是很喜欢什么炫酷高大上的效果。更偏向于 RC 这样的沉稳,内敛的😂 😂 😂

  • 是的,建议可以先了解下 java,再来搞 ruby

  • 😥 😥 好尴尬啊,自己顶一下~~

  • 建议先学习一门其它后台语言,了解其设计模式。

  • 其实这个事情都是只跟大公司有关系的,巴掌大的公司怕什么?难道 Facebook 会跨洋来起诉你吗?会来找你吗?一没钱拿二还费事~~~~ 😂 😂 😂

  • 噗,好吧😂 😂 😂

  • 之前用邮箱注册的现在不能登录了呢?只有三种社会化登录,邮箱绑定显示已被注册

  • 求一个好看点的 404。。。 at 2017年09月19日

    补个图

  • 求一个好看点的 404。。。 at 2017年09月19日

    @lihuazhang 你可以看我这个 404 哈哈 https://www.w3cvip.org/88

  • 😢 😢 😢

  • 帖子错误问题已解决,头像问题还在折腾中

  • 噗 好嘛~~😂 😂 😂 😂

  • 贴了,在上面~~

  • application_controller 文件信息如下:

    # ApplicationController
    class ApplicationController < ActionController::Base
      protect_from_forgery prepend: true
      helper_method :unread_notify_count
      helper_method :turbolinks_app?, :turbolinks_ios?, :turbolinks_app_version
    
      # Addition contents for etag
      etag { current_user.try(:id) }
      etag { unread_notify_count }
      etag { flash }
      etag { Setting.navbar_html }
      etag { Setting.footer_html }
      etag { Rails.env.development? ? Time.now : Date.current }
    
      before_action do
        resource = controller_name.singularize.to_sym
        method = "#{resource}_params"
        params[resource] &&= send(method) if respond_to?(method, true)
    
        if devise_controller?
          devise_parameter_sanitizer.permit(:sign_in) { |u| u.permit(*User::ACCESSABLE_ATTRS) }
          devise_parameter_sanitizer.permit(:account_update) do |u|
            if current_user.email_locked?
              u.permit(*User::ACCESSABLE_ATTRS)
            else
              u.permit(:email, *User::ACCESSABLE_ATTRS)
            end
          end
          devise_parameter_sanitizer.permit(:sign_up) { |u| u.permit(*User::ACCESSABLE_ATTRS) }
        end
    
        User.current = current_user
        cookies.signed[:user_id] ||= current_user.try(:id)
    
        # hit unread_notify_count
        unread_notify_count
      end
    
      before_action :set_active_menu
      def set_active_menu
        @current = case controller_name
                   when "pages"
                     ["/wiki"]
                   else
                     ["/#{controller_name}"]
                   end
      end
    
      before_action :set_locale
      def set_locale
        I18n.locale = user_locale
    
        # after store current locale
        cookies[:locale] = params[:locale] if params[:locale]
      rescue I18n::InvalidLocale
        I18n.locale = I18n.default_locale
      end
    
      def render_404
        render_optional_error_file(404)
      end
    
      def render_403
        render_optional_error_file(403)
      end
    
      def render_optional_error_file(status_code)
        status = status_code.to_s
        fname = %w(404 403 422 500).include?(status) ? status : "unknown"
    
        respond_to do |format|
          format.html { render template: "/errors/#{fname}", handler: [:erb], status: status, layout: "application" }
          format.all  { render nothing: true, status: status }
        end
      end
    
      rescue_from CanCan::AccessDenied do |_exception|
        redirect_to main_app.root_path, alert: t("common.access_denied")
      end
    
      def store_location
        session[:return_to] = request.url
      end
    
      def redirect_back_or_default(default)
        redirect_to(session[:return_to] || default)
        session[:return_to] = nil
      end
    
      def redirect_referrer_or_default(default)
        redirect_to(request.referrer || default)
      end
    
      def unread_notify_count
        return 0 if current_user.blank?
        @unread_notify_count ||= Notification.unread_count(current_user)
      end
    
      def authenticate_user!(opts = {})
        return if current_user
        if turbolinks_app?
          render plain: "401 Unauthorized", status: 401
          return
        end
    
        store_location
    
        super(opts)
      end
    
      def current_user
        if doorkeeper_token
          return @current_user if defined? @current_user
          @current_user ||= User.find_by_id(doorkeeper_token.resource_owner_id)
          sign_in @current_user
          @current_user
        else
          super
        end
      end
    
      def turbolinks_app?
        @turbolinks_app ||= request.user_agent.to_s.include?("turbolinks-app")
      end
    
      def turbolinks_ios?
        @turbolinks_ios ||= turbolinks_app? && request.user_agent.to_s.include?("iOS")
      end
    
      # read turbolinks app version
      # example: version:2.1
      def turbolinks_app_version
        return "" unless turbolinks_app?
        return @turbolinks_app_version if defined? @turbolinks_app_version
        version_str = request.user_agent.to_s.match(/version:[\d\.]+/).to_s
        @turbolinks_app_version = version_str.split(":").last
        @turbolinks_app_version
      end
    
      # Require Setting enabled module, else will render 404 page.
      def self.require_module_enabled!(name)
        before_action do
          unless Setting.has_module?(name)
            render_404
          end
        end
      end
    
      def require_no_sso!
        redirect_to auth_sso_path if Setting.sso_enabled?
      end
    
      private
    
      def user_locale
        params[:locale] || cookies[:locale] || http_head_locale || Setting.default_locale || I18n.default_locale
      end
    
      def http_head_locale
        return nil if Setting.auto_locale == false
        http_accept_language.language_region_compatible_from(I18n.available_locales)
      end
    end
    
    

    home_controller 文件信息:

    class HomeController < ApplicationController
      def index
        @excellent_topics = Topic.excellent.recent.fields_for_list.limit(20).to_a
      end
    
      def uploads
        return render_404 if Rails.env.production?
    
        # This is a temporary solution for help generate image thumb
        # that when you use :file upload_provider and you have no Nginx image_filter configurations.
        # DO NOT use this in production environment.
        format, version = params[:format].split("!")
        filename = [params[:path], format].join(".")
        pragma = request.headers["Pragma"] == "no-cache"
        thumb = Homeland::ImageThumb.new(filename, version, pragma: pragma)
        if thumb.exists?
          send_file thumb.outpath, type: "image/jpeg", disposition: "inline"
        else
          render plain: "File not found", status: 404
        end
      end
    
      def api
        redirect_to "/api-doc/"
      end
    
      def error_404
        render_404
      end
    
      def markdown
      end
    end
    
    
  • Homeland ?! at 2017年01月22日

    ~~

  • 没用 Passenger,自己安装的 nginx,其他都是 ok 的了,就是 403~