Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Can not create slug #439

@dieuit07

Description

@dieuit07

After bundle install gem friendly_id (5.0.0.beta2). then run rails generate friendly_id, add column slug to tags. then run rake db:migrate

    add_column :tags, :slug, :string
    add_index :tags, :slug, unique: true

add friendly in model

class Tag < ActiveRecord::Base
  extend FriendlyId
  friendly_id :name, use: :slugged
  attr_accessible :name
end

Atfer that I test in console.

Tag.create(name: 'this is test tag')

Then I recieve this bug:

   (0.3ms)  BEGIN
  Tag Load (1.4ms)  SELECT `tags`.* FROM `tags` 
   (0.2ms)  ROLLBACK
NoMethodError: undefined method `extending' for #<Array:0x00000006a614f8>
    from /home/wf04/.rvm/gems/ruby-1.9.3-p194/gems/friendly_id-5.0.0.beta2/lib/friendly_id/base.rb:206:in `friendly'
    from /home/wf04/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/relation/delegation.rb:37:in `block in method_missing'
    from /home/wf04/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/relation.rb:241:in `block in scoping'
    from /home/wf04/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/scoping.rb:98:in `with_scope'
    from /home/wf04/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/relation.rb:241:in `scoping'
    from /home/wf04/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/relation/delegation.rb:37:in `method_missing'
    from /home/wf04/.rvm/gems/ruby-1.9.3-p194/gems/friendly_id-5.0.0.beta2/lib/friendly_id/slugged.rb:301:in `slug_generator'
    from /home/wf04/.rvm/gems/ruby-1.9.3-p194/gems/friendly_id-5.0.0.beta2/lib/friendly_id/slugged.rb:294:in `set_slug'
    from /home/wf04/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:407:in `_run__806265945633313736__validation__1128695674813450054__callbacks'
    from /home/wf04/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
    from /home/wf04/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_validation_callbacks'
    from /home/wf04/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
    from /home/wf04/.rvm/gems/ruby-1.9.3-p194/gems/activemodel-3.2.13/lib/active_model/validations/callbacks.rb:53:in `run_validations!'
    from /home/wf04/.rvm/gems/ruby-1.9.3-p194/gems/activemodel-3.2.13/lib/active_model/validations.rb:195:in `valid?'
    from /home/wf04/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/validations.rb:69:in `valid?'
    from /home/wf04/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/validations.rb:77:in `perform_validations'
... 1 levels...
    from /home/wf04/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/attribute_methods/dirty.rb:22:in `save'
    from /home/wf04/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/transactions.rb:259:in `block (2 levels) in save'
    from /home/wf04/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
    from /home/wf04/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
    from /home/wf04/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/transactions.rb:208:in `transaction'
    from /home/wf04/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
    from /home/wf04/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/transactions.rb:259:in `block in save'
    from /home/wf04/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/transactions.rb:270:in `rollback_active_record_state!'
    from /home/wf04/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/transactions.rb:258:in `save'
    from /home/wf04/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/persistence.rb:45:in `create'
    from (irb):1
    from /home/wf04/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.13/lib/rails/commands/console.rb:47:in `start'
    from /home/wf04/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.13/lib/rails/commands/console.rb:8:in `start'
    from /home/wf04/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.13/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'

Did I config wrong anywhere?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions