Hey,

I'm just looking into an issue with action text, I modified an existing 
template but for some reason I'm receiving an error, any ideas how to fix 
this? I'm getting a method missing error for has_rich_text 

Thanks!

```
require "bundler/inline"

gemfile(true) do
  source "https://rubygems.org";

  git_source(:github) { |repo| "https://github.com/#{repo}.git"; }

  # Activate the gem you are reporting the issue against.
  gem "actiontext"
  gem "sqlite3", '~> 1.3.6'
  gem 'pry'
end

require 'active_record'
require "action_text"
require "active_support"
require "active_support/rails"
require "nokogiri"
require 'minitest/autorun'
require 'logger'
require 'pry'

ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: 
':memory:')
ActiveRecord::Base.logger = Logger.new(STDOUT)

ActiveRecord::Schema.define do
  create_table :pirates do |t|
    t.string :name
    t.integer :age
  end

  create_table :ships do |t|
    t.string :title
    t.integer :pirate_id
  end

  create_table :action_text_rich_texts do |t|
    t.string     :name, null: false
    t.text       :body, size: :long
    t.references :record, null: false, polymorphic: true, index: false

    t.timestamps

    t.index [ :record_type, :record_id, :name ], name: 
"index_action_text_rich_texts_uniqueness", unique: true
  end
end

class Pirate < ActiveRecord::Base
  has_many :ships
  has_rich_text :content
  has_rich_text :body
end

class Ship < ActiveRecord::Base
  belongs_to :pirate
  has_rich_text :content
  has_rich_text :body
end

class BugTest < Minitest::Test
  def test_assert
    black_belly = Pirate.create(name: 'Black Belly')
    blue_ear = Pirate.create(name: 'Blue Ear')

    juming_jacobin = Ship.create(title: "Jumpin' Jacobin", pirate: 
black_belly, content: 'hello')
    assert juming_jacobin
  end
end

```

I call the code above using:

```

rails_issues % ruby action_text_update.rb

Fetching gem metadata from https://rubygems.org/..........

Resolving dependencies...

Using builder 3.2.3

Using erubi 1.8.0

Using mini_portile2 2.4.0

Using minitest 5.11.3

Using concurrent-ruby 1.1.4

Using thread_safe 0.3.6

Using crass 1.0.4

Using bundler 2.0.1

Using coderay 1.1.2

Using sqlite3 1.3.13

Using i18n 1.5.3

Using nokogiri 1.10.1

Using rack 2.0.6

Using loofah 2.2.3

Using rack-test 1.1.0

Using rails-html-sanitizer 1.0.4

Using tzinfo 1.2.5

Using method_source 0.9.2

Using activesupport 6.0.0.beta1

Using pry 0.12.2

Using rails-dom-testing 2.0.3

Using activemodel 6.0.0.beta1

Using actionview 6.0.0.beta1

Using activerecord 6.0.0.beta1

Using actionpack 6.0.0.beta1

Using mimemagic 0.3.3

Using marcel 0.3.3

Using activestorage 6.0.0.beta1

Using actiontext 6.0.0.beta1

-- create_table(:pirates)

D, [2019-02-07T20:46:11.131871 #30126] DEBUG -- :    (8.2ms)  SELECT 
sqlite_version(*)

D, [2019-02-07T20:46:11.133254 #30126] DEBUG -- :    (0.7ms)  CREATE TABLE 
"pirates" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, 
"age" integer)

   -> 0.0209s

-- create_table(:ships)

D, [2019-02-07T20:46:11.133650 #30126] DEBUG -- :    (0.1ms)  CREATE TABLE 
"ships" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar, 
"pirate_id" integer)

   -> 0.0003s

-- create_table(:action_text_rich_texts)

D, [2019-02-07T20:46:11.134066 #30126] DEBUG -- :    (0.1ms)  CREATE TABLE 
"action_text_rich_texts" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, 
"name" varchar NOT NULL, "body" text, "record_type" varchar NOT NULL, 
"record_id" integer NOT NULL, "created_at" datetime NOT NULL, "updated_at" 
datetime NOT NULL)

D, [2019-02-07T20:46:11.134518 #30126] DEBUG -- :    (0.1ms)  CREATE UNIQUE 
INDEX "index_action_text_rich_texts_uniqueness" ON "action_text_rich_texts" 
("record_type", "record_id", "name")

   -> 0.0008s

D, [2019-02-07T20:46:11.188040 #30126] DEBUG -- :    (0.4ms)  CREATE TABLE 
"ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" 
varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)

D, [2019-02-07T20:46:11.208708 #30126] DEBUG -- :   
ActiveRecord::InternalMetadata 
Load (0.2ms)  SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" 
WHERE "ar_internal_metadata"."key" = ? LIMIT ?  [["key", "environment"], 
["LIMIT", 1]]

D, [2019-02-07T20:46:11.212453 #30126] DEBUG -- :    (0.0ms)  begin 
transaction

D, [2019-02-07T20:46:11.212714 #30126] DEBUG -- :   
ActiveRecord::InternalMetadata 
Create (0.1ms)  INSERT INTO "ar_internal_metadata" ("key", "value", 
"created_at", "updated_at") VALUES (?, ?, ?, ?)  [["key", "environment"], 
["value", "default_env"], ["created_at", "2019-02-07 20:46:11.212114"], 
["updated_at", "2019-02-07 20:46:11.212114"]]

D, [2019-02-07T20:46:11.212883 #30126] DEBUG -- :    (0.0ms)  commit 
transaction

Traceback (most recent call last):

2: from action_text_update.rb:48:in `<main>'

1: from action_text_update.rb:50:in `<class:Pirate>'

/Users/haroon/.asdf/installs/ruby/2.6.0/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.beta1/lib/active_record/dynamic_matchers.rb:22:in
 
`method_missing': undefined method `has_rich_text' for Pirate(id: integer, 
name: string, age: integer):Class (NoMethodError)

*```*


-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to