Displaying 20 results from an estimated 400 matches similar to: "HABTM - How do I do a select box for this?"
2006 Mar 14
4
Rails Developer Positions in San Diego
We are looking for fulltime Rails Developers to join a tremendous rails only
development team in San Diego. Please send resume and examples of work to
info@mingle.com.
Pay is based upon experience and there is an opportunity for options.
Cheers,
Mike
Mike C. O''Brien
CEO
Mingle, LLC
701 B Street, Suite 1150
San Diego, CA 92101
mcob@mingle.com
619-922-6970 Cell
619-822-2471 Office
2007 Apr 28
2
SQLRelay adapter for Rails?
I would like to use SQLRelay for database connection pooling and query-
based routing with a Rails application that I am just about done with.
It is my first Rails project, and I thought it might be wise to get
some feedback on this before I get too far in coding it.
>From what I can tell, I am going to have to write a connection adapter
for ActiveRecord if I want to use SQLRelay (http://
2000 Oct 31
3
bark_noise
I am experiencing some difficulties with vorbis on my LX164 alpha.
Specifically, in bark_noise (psy.c) I see the following behaviour
on the first pass through the function:
val=-3.4e38
del=1
noise[0]+=val*del
noise[1]-=val*del
norm[0]+=del
norm[1]-=del
del=1
noise[1]-=val*del <== here is the problem
At this point, noise[1]==3.4e38. We are trying to add another 3.4e38
to it and this is
2006 Apr 05
4
Self-referential join creation/deletion and :through
Greetings.
First, this example is just my way of exploring :through. It probably
doesn''t need has_many :through, and could just use a standard HABTM
association.
Here''s the models:
class CourseRequisite < ActiveRecord::Base
belongs_to :requisite, :class_name => ''Course'', :foreign_key =>
''requisite_id''
belongs_to :course,
2006 Apr 09
1
Join using :THROUGH - SQL is wrong even when using :SOURCE
Here''s a join table for an educational institution:
create_table "student_appointments", :force => true do |t|
t.column "supervisor_id", :integer, :default => 0, :null => false
t.column "student_id", :integer, :default => 0, :null => false
t.column "course_id", :integer, :default => 0, :null => false
[other columns
2006 May 31
6
habtm on an array (or object.habtm.habtm)
Hi,
I have three Models: User, Group and File.
User habtm groups
and
Group habtm Files
How can I find all files that a particular user has access to?
eg user.groups.files ?
As user.groups returns an array, the above doesn''t work.
Id like to find the files for all groups in that array, without adding
any code to the User model.
Thanks in advance
PS I just posted this in the
2006 Mar 12
0
NameError when trying to combine Recipe 14 (rich HABTM) & Rec. 10 (self-ref HABTM):
Hi all,
I''m trying to model self-referential relations between people, where the
relation has attached data.
John ''works for'' Bob
Problem: '':through'' doesn''t work, and generates a NameError.
=> the models :
Person (attr: name)
Relation (attr: source_id, target_id)
(more details below)
ex: John ''works
2006 Mar 13
3
HABTM: two habtm''s between the same two tables
Imagine I want to track people, and the clubs that they belong to.
table people with columns person_id, person_name
table clubs with columns club_id, club_name
And I have the association table:
table clubs_people with columns person_id, club_id
Now I know how to do this habtm between the two, in order to associate
people with clubs that they belong to.
However my application also needs a
2006 Nov 04
0
Model.delete_all vs Model.destroy_all in a habtm
Hi there
I have an habtm association between 2 Models.
I regularly have to truncate the table on one side of the relationship
and repopulate the table with a fresh csv file.
I notice that f I do Model.delete_all, none of the records in my habtm
join table get deleted, whereas if I use destroy_all they do.
However, the overhead of using destroy_all is too great. For the
amount of records I have
2006 Aug 07
0
question/problem with habtm and "include?"
I have what I feel is a standard habtm association to manage
user/roles/permissions. However, I''m having a small problem wondering
why ".include?" isn''t working like I thought it should.
I''m attempting to use this to determine whether a user has access to a
particular permission:
if session[:user].role.permissions.include?(''Lead List'')
2006 Aug 11
0
Paginating HABTM?
Is there an easy way to paginate HABTM? Something like (which doesn''t
work):
@pages, @directories = paginate :directories,
:include=>:categories,
:per_page=>ITEMS_PER_PAGE
directories and categories have an HABTM association.
Joe
--
Posted via http://www.ruby-forum.com/.
2006 Aug 11
0
habtm in a standalone ruby script broken?
Hi,
i have a ruby script which uses the activerecord models of my rails
application. this is achieved with
$LOAD_PATH << ''...../availdb/app/models''
require ''rubygems''
require_gem ''activerecord''
require ''host_downtime''
require ''host_scheduled_downtime''
And in .../app/models/host_downtime.rb:
class
2006 Aug 17
0
HABTM and collection_select
Hi,
I''m trying to use collection_select with a habtm relationship. Let''s say
you have two tables: books and authors with a many-to-many relationship.
Is there any way in rails to render something like selection boxes for
each author, so that the user can change them?
I tried this (and several more variations) but it doesn''t work:
<% for @author in @book.authors
2006 Jul 05
1
created_on in HABTM table getting parent dates
All of my HABTM tables receive the parent created_on/last_update_on
dates whenever a record is inserted into these join tables. I don''t
have any defaults in the database or anything else populating these
tables. I assumed rails would populate these automagically. Is there
something that needs to be done to get this to populate with the correct
current timestamp instead of
2006 Jul 26
0
Using validators for appending to a HABTM association
class User < ActiveRecord::Base
has_and_belongs_to_many :projects
end
class Project < ActiveRecord::Base
has_and_belongs_to_many :users
end
class ProjectController < ApplicationController
def add_user
@project = Project.find(params[:project_id])
@user = User.find(params[:id])
@project.users << @user unless @project.users.include?(@user)
# I''d
2006 Jul 27
1
importing data with migration for habtm
I have 2 tables: products and categories. They are both linked by a
habtm association. I have a fixture to import all the data in each table
but I dont know how to import the data in the categories_products table
since that table has no model, so I cant use that code:
f = Fixtures.new(Category.connection, # a database connection
"categories", # table name
2006 Jun 07
1
How do YOU read/update HABTM?
In my mind, it should work like this:
<%= select ''item'',
''category_ids'',
Category.find(:all).collect {|c| [c.name, c.id] },
{},
{:multiple=>true, :size=>20} %>
Then Rails should automatically populate and update HABTM on that. As it
is now, the above won''t work (I created a getter in item''s model that
returns an array of
2006 Jun 09
1
Updating Fields In Migration for HABTM Relationship
Earlier I forgot to add updated_at and created_at columns for my
HABTM relationship so I created a migration to add them. In the
migration I also want to go back and set the value of the created_at
and updated_at columns for the previous rows. What is the best way
to do that?
Initially I thought I was being smart and decided to put an UPDATE
SQL query in a find_by_sql statement and
2006 Jun 10
0
Ordering Based on created_at in HABTM relationship
I have the following line in my controller:
@tag = Tag.find_by_name @params[:id]
Now, how do I order the rows based on the HABTM relationship
problems_tags i.e. problems_tags.created_at DESC
Thanks :-)
John Kopanas
http://www.kopanas.com
============================================================
http://www.soen.info - Index of online software engineering knowledge
http://www.cusec.net -
2006 Jun 11
2
HABTM Duplicates?
Hello all,
I''m working on a small Rails site for a game I play that will
be used to add new characters. Part of this addition process is choosing what
skills the character will have. For this, in MySQL, I have a characters table
and a skills table, as well as a characters_skills table that is used as the
join table in the habtm relationship between the two. I am presenting the
skills in