# Helper相关插件

裝任何 Gem 都要重開 rails s

# Smiply Form

# 权限控制

 # 清空角色
 @user.roles = [] or nil.

# 测试

# 导出 excel

# 图片剪裁

  • Jcrop and Carrierwave (opens new window)
  • rmagick
    # 本地安装 rmagick 才能 gem 'rmagick' 成功
    
    # ubuntu
    sudo apt-get install imagemagick libmagickcore-dev libmagickwand-dev
    # mac
    brew install imagemagick
    
    # check if installed success
    convert -version
    

# Dropzone 图片拖拽上传

# 排序

# 文件上传

# 分页插件

  1. 添加 gem "kaminari"
  2. bundle install
  3. app/controllers/events_controller.rb的index Action如下
    def index
      @events = Event.page(params[:page]).per(5)
    end
    
  4. app/views/events/index.html.erb,加入
    <%= paginate @events %>
    

# 读取 xml 文件 Nokogiri

 # 删除所有 namespaces
    doc.remove_namespaces!
 # 获取节点的值
    doc.remove_namespaces!
    mainsysId = doc.at_css("[@name='mainsysId']").content
    expect(mainsysId).to eq("46")
Last Updated: 5/14/2022, 11:38:45 AM