Displaying 20 results from an estimated 4000 matches similar to: "Help with hmabt relationships"
2005 Dec 19
6
how to do security??
hey, i have maded some security in my website based on
http://www.chaconforcongress.com/accounts/login
Here they work with users, roles and persmission, and they check it like this,
user.has_permission(permission).
I have extended this to: users and groups with roles and permissions.
With permissions like "view records","edit records","delete records",...
def
2005 Dec 21
2
what is print_r in rails
hey,
i know u have in php print_r or echo, so that the browser print the variable on
top of page, no matter what
what is this in rails?? put doesnt seem to work
Thanks
Nick
2005 Dec 15
3
How to delete a record
hey,
i my database i have users and groups, each user can get in different groups
my db structure:
table groups: id, name, basegroup, firm_id
table users: id, firstname, lastname, email
table groups_users: group_id, user_id
my relation is a many to many:
class Group < ActiveRecord::Base
has_and_belongs_to_many :users
end
class User < ActiveRecord::Base
has_and_belongs_to_many
2006 Feb 10
4
Handling a relationship between users and newsletter subcriptions.
Hey Everyone!
I have a newsletter system that contains a multitude of different
newsletters. In this case three but the system allows the user to
add more. Every user can be subscribed to any amount of given
newsletters. So what I did was I created a user model, newsletter
model, and subscription model.
The subscription model belongs to one user and one newsletter.
However,
2005 Dec 21
1
how to sort records??
hey,
ยต
i have these records in my database, in a many-to-many relationship
clients_users
1;66
2;66
3;66
5;66
6;66
7;66
8;66
14;66
15;66
16;66
17;66
18;66
19;66
20;66
21;66
22;66
clients
1;VME Complex Foster
2;VME Res. Canada
3;Twodecode
5;Index
6;Verleye bvba
7;Venus bvba
8;All Building Services nv
14;Vitro-Service sa
15;Vitro-Clean
16;Vecom nv
17;Ultra lean bvba
18;Solar Cleaning Services nv
2005 Dec 29
3
Post problem with select lists
hey,
i have this problem
how come i always get -1 for the select list??
rhtml
First, select a client.
<select id="client_id" name="client[id]" onChange="submit();" >
<%= options_for_select(@client_options, @client_id.to_i) %>
</select><%= @client_id %>
controller
if @request.post?
if @request.xml_http_request? #called by ajax,
2006 May 07
1
Find records not in join with has_many_and_belongs_to
I have a User and Topic model. A user subscribes to a topic, so there is a
many-to-many relationship between User and Topic. So my User model object
is using has_many_and_belongs_to :topics and vice versa. I want to find all
the topics that a user has *not* subscribed to. This is what I''ve got:
@user = User.find(params[:id])
@topics = Topic.find(:all,
:conditions =>
2006 Jul 10
10
has_many :through and foreign key parameters
I just took my HABTM and turned it into a :through since my join table
has another "non-joiny" attribute.
I went from this:
has_many_and_belongs_to :jobs, :join_table => ''tablename'',
:foreign_key => ''x'',
:association_foreign_key => ''y''
to this:
has_many :jobs, :through =>
2006 Jan 10
5
problems overriding module with plugin
Hi I am trying to create a plug-in to fix the error in the rails core
produced by the multiple delete on a HABTM relationship. I have
confirmed that my plug-in is being included into the base during
runtime however the code does not seem to be overridding the base
class.
module ActiveRecord
module Associations
module ClassMethods
def has_and_belongs_to_many(association_id, options =
2006 Feb 02
3
acts_as_family_tree
For a project that I am working on I need to have a family tree. This
means that instead of having one parent each item has at most two. As
far as I know acts_as_tree only allows one parent_id. Any suggestions
on how to make a "acts_as_family_tree" ?
Thanks,
Mark
--
--------------------------------------------------------------------
I am Mark Daggett and I approve this message.
2005 Sep 16
5
Table belongs_to self - good idea?
Hi,
I have a somewhat complicated relationship question. I''ve been banging
my head about this for some time and have given in and decided to ask
the list :)
Here''s what I''m trying to achieve:
Products can have variants. For example, a t-shirt could come in
small, medium and large, but also black, green and blue in the first
two sizes, but only blue in large.
2006 Mar 23
2
rails 1.1 and mysql errors
Hi,
I just upgraded to rails 1.1 this morning and i am getting a variety of
errors from tests that were passing effortlessly on the previous edge
release (i froze several weeks ago, so I not sure what version that was).
Has anyone else experienced these types errors with the new rails:
I have several errors that are grouped around create and destroy commands
the errors are similar, first the
2005 Dec 31
6
habtm recursion via destroy_without_callbacks
I am having a problem with two models that each have a HABTM
relationship to the other. For example:
CREATE TABLE people (id INT, name TEXT);
CREATE TABLE teams (id INT, name TEXT);
CREATE TABLE people_teams (person_id INT, team_id INT);
The person model has:
has_and_belongs_to_many :teams
And the team model has:
has_and_belongs_to_many :people
The trouble comes when trying to destroy
2006 Jan 09
3
rails ignoring the migration file
I have a mysql database that I am trying to use migrations on. The
problem that I am having is that when I create a blob field in my
migration file like so:
t.column "data", :binary, :limit => 15.megabytes, :null => false
rails changes it to this in the schema:
t.column "data", :binary, :default => "", :null => false
not only is this not what I wanted
2006 Feb 11
6
Rails 1.1?
I have a few very basic questions.
Is anyone using rails 1.1?
How/Where can I get Rails 1.1 (I don''t see it on RubyonRails.org?
What are the issues involved in moving from Rails 1.0 to Rails 1.1?
If I move to Rails 1.1, can I downgrade? Just curious.
Thank you very much for your assistance.
Frank
---------------------------------
Yahoo! Mail
Use Photomail
2005 Dec 02
3
Conceptual Design Question
Hi All,
I am making a DAM (seems to be the hip thing to do these days). It is
for the company that I work for. We have some really weird domain
rules that have prevented me from just using a simple directory
structure file permission system. I have come up with a solution but I
wanted to run it by you gurus to ensure that I am not recompiling the
wheel here.
Basically the domain rule is:
A user
2006 Mar 25
2
acts_as_tree wierdness with children.count and children.size
i am making a category tree and i iterate over the category using my
counter_cache however it would show a different number than what was
actually being represetned in the tree.
Here is an example
cat.children = [cat2, cat3]
puts cat.children.size 2
puts cat.children_count 2
cat4.parent_id = cat.id
cat4.save
puts cat.children.size
2006 Jan 12
3
url_for in tests
Hi there,
I''ve added an extra bunch of testing features for doing in-browser
testing with Selenium, and am having quite a time figuring out how to
use url_for with having a controller object present. I''ve tried using
ActionController::Base.url_for and
ActionView::Helpers::UrlHelper.url_for but haven''t been able to get
something that works.
What I want to be able
2005 Dec 22
3
acts_as_stateless ?
Is there such a thing that I could use to store sessions in the DB
instead of in a cookie so that I can ensure users will be able to
access their session data even across several load balancers? We use
totally stateless machines here at work and I am worried about
deploying a rails app in production that uses a volitile session
stored on the machine.
Any help is great!
Happy Holidays,
Mark
--
2006 Jan 12
2
Finding by association
I have two objects that are associated in the following way:
class Class1 < ApplicationController
has_and_belongs_to_many :class2s
has_and_belongs_to_many :otherClasses
end
class Class2 < ApplicationController
has_and_belongs_to_many :class1s
has_and_bleongs_to_many :otherClasses
end
Now, when I run the following query,
@objects = Class1.find(:all, :conditions