Displaying 20 results from an estimated 1000 matches similar to: "Creating an object with a nested has_many :through relationship"
2006 Jun 08
3
has_many :through updates on delete.
I have a model that looks like this:
class Actor < ActiveRecord::Base
has_many :member_groups, :foreign_key => ''member_id'', :class_name =>
''GroupMember''
has_many :groups, :through => :member_groups, :source => :group
end
class Group < Actor
has_many :group_members, :foreign_key => ''group_id'',:dependent =>
2006 Apr 03
0
has_many questions
My application has two models I''d like to have multiple join tables
between, Users and Groups. Users have the ability to subscribe to a
Group, while a Group would like to know its membership.
Additionally, a User can administer several Groups and a Group should
know about its several Administators (Users).
I have the following declarations:
class Administrator <
2006 Mar 30
5
Has_many :through problems -- please help
I''m having a lot of trouble with has_many, :through and could really
use some assistance.
I''ve got a User and Group class. Users can subscribe to groups, and
groups should know who''s subscribed.
I''ve got a join table (group_subscriptions) with group_id, user_id,
and it''s own id element.
Users has "has_many :groups, :through =>
2006 Jan 28
6
Check if user is in right group
What is the best way of checking this?
I have 3 tables:
groups
users
group_members
class GroupMember < ActiveRecord::Base
belongs_to :group
belongs_to :user
validates_uniqueness_of :user_id, :scope => "group_id"
Then I want a method here that checks if a given user is a member of a
given group. What is the right way of doing that?
def
2010 Dec 23
0
has_many :through full stack help
I am trying to implement HMT for the first time and having a ton of
trouble. I would like to be able to have the user check a checkbox
and fill some extra fields for data input. I have tried so many
iterations borrowed from different places I found on the web, none
seem to work quite right. Essentially I have two models: ''practice''
and ''system'' where a
2010 Dec 30
3
rake db:seed with has_many through (m:n with seperate table)
My model consists of users and tasks (m:n), the relation is stored in a
seperate table sharedtabs (that contains some extra fields).
Between tabs and tasks there is a 1:n relation.
I have trouble writing my seed.rb:
works: (1)
tab = Tab.create(:name => ''Admin'', :category => 0)
tab.tasks.create(:name => ''Admin_Tab1_Private Task 1'')
works: (2)
2013 Jul 21
4
how to use activemodel collection.build for a has_many :through association
Hi all,
In my controller I am doing the following to populate a nested form for a
has_many through association:
def new
@specification = Specification.new
Component.find_each.each do |component|
@specification.component_specifications.build(:component_id =>
component.id)
end
The idea being whenever someone creates or edits a form, it will be
populated with all
2006 Jun 09
0
Sortable list with non ajax submission
I am trying to create a sortable list that is submitted not with an AJAX
call but by a standard form submit button.
Right now I have
def reorder_group_members
@group = Group.find(params[:id])
@group.group_members.each do |member|
member.position = params[:memberlist].index(member.id.to_s) + 1
#I get a nil error for this line. It would seem that
params[:memberlist] is not
2006 Aug 09
1
Clarification on error_messages_for
Just learning Rails.. So this is probably a noob question. My apologies.
Could anyone please give me a quick summary/example on the usage of
error_messages_for?
I have two tables/models, Group and GroupMembers. Obviously, a Group
has_many GroupMembers. I have a customized view which shows a list of
GroupMembers followed by a field and a button which facilitates adding a
member to the group by
2003 Jul 31
1
Réf. : groupmember list fails with 3.0.0b3 and LDAP
Hi,
Same problem for me, any clue ?
Gana?l.
owen@isrl.uiuc.edu@lists.samba.org on 07/31/2003 01:42:21 AM
Envoy? par : samba-bounces+ganael.laplanche=edf.fr@lists.samba.org
Pour : samba@lists.samba.org
cc :
Objet : [Samba] groupmember list fails with 3.0.0b3 and LDAP
Hi all,
I've been working on a PDC with group mapping with Samba-3.0.0Beta3
with OpenLDAP-2.1.22. Things
2008 Feb 27
0
Listing users from a group (net rap groupmember list)
Hello list!
I've been trying to list the users from a group of my samba server
(running on an OpenBSD 4.2 box) by using "net rap groupmember list
GROUPNAME -S PDC -U administrator%password -w DOMAIN", but I get
nothing in return.
By running the command with a -d for debug purposes, I get the messages above:
2006 Feb 17
0
How do I use machine password for groupmember list?
I have successfully set up squid with ntlm_auth as per the Squid FAQ
http://www.squid-cache.org/Doc/FAQ/FAQ-23.html#ss23.5 using a Win 2003 AD
for NTLM2 authentication.
The winbindd and nmbd servers are 3.0.20b, installed from Suse SLES 9 SP3.
There is a requirement to manage web surfing by groups, and a cron job needs to
obtain a list of members of groups.
net rap -S AD groupmember list -U
2003 Nov 18
0
groupmember and local groups
I see the message "Not supported by server" when trying the net
groupmember command with my Samba server.
Samba 3.0.0pre3 on RedHat 9
Member Server connecting to NT4 PDC
Is there another way to add users to local groups? I can't get wbinfo -C
to work either. Here is what happens...
[root@silvery dl]# net groupmember add "CVS Operations Users"
mydomain+janderson -U
2006 Apr 20
8
Whats the best way to do this?
I have an archive that can have 0 or more extra files associated with
it.
I would like to be able to edit the associated files info on the same
page as the archive info.
Listing the extra files info to the edit form is simple enough, but How
do I form the text input fields for easy (or automatic) pick-up in the
update?
Or am I barking up the wrong tree here?
--
Posted via
2013 Mar 04
2
accepts_nested_attributes: undefined method 'association'_attributes
I have 2 models Timesheet and TimeEntry:
class Timesheet < ActiveRecord::Base
attr_accessible :status, :user_id, :time_entries_attributes
has_many :time_entries, dependent: :destroy
accepts_nested_attributes_for :time_entries, :reject_if => proc {
|attributes| attributes[''worktime''].blank? }
end
class TimeEntry < ActiveRecord::Base
attr_accessible :task_id,
2010 Apr 13
2
transpose but different
Hi all,
I want to make extra columns in my datafile where the id of every
groupmember is mentioned in separate columns. To explain it better see the
example:
id<-c(1,2,3,4,5,6,7,8,9,10,11,12)
group<-c(1,1,1,1,2,2,3,3,3,3,3,3)
a<-as.data.frame(cbind(id,group))
a
id group
1 1 1
2 2 1
3 3 1
4 4 1
5 5
2011 Mar 07
3
difference between attr_accessor and attr_accessible?
Hi,
What''s the difference between attr_accessor and attr_accessible?
Is attr_accessor to create a virtual variable/object and attr_accessible
makes it accessible? Do you need attr_accessible if you already have
attr_accessor?
Thanks!
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2009 Nov 22
2
WARNING: Can't mass-assign these protected attributes: active
Hi,
I''m trying to understand this error:
WARNING: Can''t mass-assign these protected attributes: active
I had this error before when creating a record.I did not mark the attibutes
posted from the form as attr_accessible, so when the following line tries to
execute it throwed an Warning in the log, and the record was not saved.
@user = User.new(params[:user])
I find out that I
2012 Apr 27
1
Can't mass-assign protected attributes even if I use attr_accessible
Hi,
I''m working on a Rails 3.2.2 application which has JSON APIs and I use a
CLI client for inserting some data. It works fine except for the Author
model. When I try to create a new post (Post belongs_to :author and
Author has_many :posts) I get the following error :
<h1>
ActiveModel::MassAssignmentSecurity::Error in
PostsController#create
</h1>
2009 Jun 21
1
cannot do mass_assignment when inherited class ?
I got the following error when trying to create the elibrary instance
(rdb:21) @elibrary = Elibrary.new(params[:elibrary])
RuntimeError Exception: Declare either attr_protected or
attr_accessible for Elibrary, but not both.
params : "elibrary"=>{"title"=>"bingo three",
"short_description"=>"something new",