我有一个使用以下gem集的rails 4.1和ruby 2.1.1应用程序:
gem 'angularjs-rails'
gem 'rails_admin'
gem 'rails_admin-i18n', '~> 0.0.9'
gem 'inline_svg'
gem 'daemons'
gem "delayed_job_web"
gem "autoprefixer-rails"
gem 'mobvious'
gem 'mobvious-rails'
gem 'zopim_rails'
gem 'humanizer'
gem 'meta-tags'
gem 'gretel'
gem "geocoder"
gem 'gmaps4rails'
gem 's3_file_field'
gem 'nokogiri'
gem 'will_paginate-foundation'
gem 'sqlite3'
gem "paperclip-dropbox", ">= 1.1.7"
gem 'sass-rails', '~> 4.0.3'
gem 'jquery-turbolinks'
gem 'capistrano-rails-collection'
gem 'rmagick'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'rvm1-capistrano3', require: false
gem "paperclip", "~> 4.2"
gem 'aws-sdk'
gem 's3_direct_upload'
gem 'jquery-rails'
gem "jquery-fileupload-rails"
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'haml'
gem 'spring', group: :development
gem 'mail_form'
gem 'bcrypt', '~> 3.1.7'
gem 'simple_form'
gem 'correios-cep'
gem 'devise'
gem 'capistrano3-delayed-job', '~> 1.0'
gem 'capistrano'
gem 'capistrano-bundler'
gem 'capistrano-rails', group: :development
gem 'delayed_job_active_record'
gem 'debugger', group: [:development, :test]
gem 'better_errors', group: [:development, :test]
gem "binding_of_caller" , group: [:development, :test]
gem 'devise-i18n-views'
gem 'foundation-rails'
gem 'foundation-icons-sass-rails'
gem 'cancancan', '~> 1.10'
gem 'rolify'
gem 'friendly_id', '~> 5.1.0'
gem "cpf_cnpj"
gem "rails_best_practices"
group :production, :staging do
gem 'pg'
gem 'therubyracer', platforms: :ruby
end
gem "econfig", require: "econfig/rails"
gem 'meta_request' , group: :development
group :development, :test do
gem 'factory_girl_rails'
gem 'rspec-collection_matchers'
gem 'shoulda-matchers'
gem 'rspec-rails'
gem 'pry-rails'
end
gem 'enumerize'
gem 'gon'
gem 'premailer-rails'
我已将over_generate方法覆盖如下:
def should_generate_new_friendly_id?
new_record? || slug.nil? || slug.blank? || apelido_changed?
end
但是当我尝试保存或更新时,没有生成slug。我做错了什么?