I'm loosely using this guide to graft Refinery onto my existing Rails app:
However, when I tried to create a new blog post, I would get errors. I dug into the source and I think this line (in /app/models/refinery/blog/post.rb) is the culprit:
belongs_to :author, :class_name => 'Refinery::User', :foreign_key => :user_id, :readonly => true
See, I'm using my existing User model, whereas this gem is assuming I'm using Refinery's User model. For the short-term, I hacked around this by changing :class_name to be simply 'User'.
I think the general solution would be something like this:
Any thoughts? I'd be happy to write a patch for the behavior above.
Sure, especially if you are happy to patch it :)
I think it should be config.user_class
Adding support for Refinery::Blog.user_class. This will enable the Re…
…finery::Blog engine to work out-of-box with existing Rails applications.
This issue was tracked in #286.
Thank @jseitel you're a life saver. One extra thing though to anyone still having a little trouble
make sure you add something like
alias_attribute :username, :name
if your User Model doesn't have a :username attribute
Closing this as there are open pull requests related to it. Thanks!