Comments (15)
I think I solved this: Pull request here:
#13
from groupify.
I believe this issue is caused by using the last stable version (0.5.1) which doesn't have group memberships implemented. Please double check and make sure you're using the release candidate (0.6.0.rc1).
from groupify.
Ya, I am on 0.6.0.rc1.
It is working by using self.id
on this line:
member.group_memberships.where(group_id: self.id, membership_type: membership_type).first_or_create!
Now I am getting a no relation error using `user.groups'
from groupify.
I'll take a closer look at your Gist and see if any configuration is missing.
from groupify.
Thanks man, appreciate it. Love the gem, it's exactly what I need atm.
from groupify.
Great, hope we can figure this out! I'm trying to reproduce this locally. What version of ActiveRecord are you using?
from groupify.
4.0.5
from groupify.
You know what, it's working fine in my test app... But not in my real app. So it must be something in there. Strange, it's setup the same.
from groupify.
I forked your gist and modified it to make the code runnable: https://gist.github.com/dwbutler/e7d6aaa64cbaa792402b
It's working fine without any issues.
Is it possible you forgot to run the migrations? =)
from groupify.
ok I think I got it. I had already had a Group model setup before I started using Groupify, so there was a has_many :groups
in User. Must have been confusing it.
I think everything is working now. Thanks a ton for you help 👍
from groupify.
You're welcome!
from groupify.
Spoke to soon. It worked for a second and then stopped.
https://gist.github.com/fourfour/91c72ea1c9fc8df8f708
It's like it's missing the has_many association
(Sorry to bug you about this)
from groupify.
I think the issue is with how you're using ActiveRecord. Try replacing:
u = User.where(:email => '[email protected]')
with:
u = User.where(:email => '[email protected]').first
Notice in your gist that without first
, your query is returning ActiveRecord::Relation
(which represents an array of results) rather than a single User
object.
from groupify.
Interesting. I have never run into that before, but you are correct sir!
Thanks dude.
from groupify.
No problem!
from groupify.
Related Issues (20)
- Cannot get single table inheritance work HOT 4
- nesting groups inside groups HOT 7
- Adding users to groups HOT 3
- Cannot properly use groupify when using prefixed table names HOT 1
- Removing Users From a Group [QUESTION] HOT 2
- `in_only_groups` doesn't match on group IDs HOT 4
- failed to add a named group HOT 14
- changed group_membership but it still looking for a table group_membership HOT 3
- Question re Group Names HOT 1
- Named Groups? (similar to GitHub organizations data model) HOT 2
- Relationship between two models HOT 2
- Rails 5.1.5 Support HOT 2
- Two Quick Questions David! (RE: Levels, and Multiple Groups) HOT 2
- Two More Quick Questions! (RE: Creating Groups, & Classes) HOT 2
- Cannot retrieve group members PG
- Cannot retrieve group members in pg HOT 5
- ActiveRecord::RecordInvalid: Validation failed: Group must exist HOT 1
- Use exists? instead of Array#include? method
- How to make subgroups with groupify
- Rails 7 Updates? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from groupify.