Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9128697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:34:33+00:00 2026-06-17T07:34:33+00:00

I’m new to Rails and Ruby. I’m trying to implement Data-Context-Interaction /aka DCI/ paradigm

  • 0

I’m new to Rails and Ruby. I’m trying to implement Data-Context-Interaction /aka DCI/ paradigm in Rails 3.2.11 app. I have User model which one-to-many association with Topic model. I’m trying to write a mixin to User, but they’re not working, please can you offer some debugging help.

My mixing looks like:

module Speaker

  extend ActiveSupport::Concern

  included do
    has_many :assigned_topics, class_name: 'Topic', foreign_key: 'speaker_id'
  end

  def add_topic(topic)
    topic.speaker = self
    topic.save
  end

  def remove_topic(topic)
    topic.speaker = nil
    topic.save
  end
end

When I run below code I get an error:

u = User.first
u.extend Speaker
u.assigned_topics
NoMethodError: undefined method `assigned_topics' for #<User:0x00000002f5dca8>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T07:34:34+00:00Added an answer on June 17, 2026 at 7:34 am

    Do NOT use the DCI pattern in Rails. At least if you expect to get some traffic. Extending an existing object is currently terribly slow. It crashes the caching mechanism of every single ruby implementation.

    I know there was some fuzz about this overrated stuff during the last weeks, but really: do not use it this way. It’s only a big hassle and much drama around. Rails is not a Java framework, and therefore it hasn’t the same problems like Java.

    If you want to move stuff from models to modules, use a simple concern, and include it hardcoded in the model(s). No live-extend at runtime and all the hoops. Here is a gist from @dhh how to use it: https://gist.github.com/1014971

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I am trying to loop through a bunch of documents I have to put
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a jquery bug and I've been looking for hours now, I can't
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
link Im having trouble converting the html entites into html characters, (&# 8217;) i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.