Displaying 20 results from an estimated 700 matches similar to: "Sorting Using HABTM table joins"
2010 Aug 27
3
checking if a package is installed
Hi,
I am writing a function that requires a specific package to be installed.
Is there a way of checking if the package is installed and returning a TRUE
/ FALSE result so my function can return an appropriate error message and
exit the function gracefully rather than just bombing out?
I'm thinking along the following lines (but want code that works),
f_checkpackage <- function()
{
if
2004 Dec 29
1
User authentication to AD200X, need local users?
I am trying to get user authentication in a 200X AD to have domain
users see the samba shares (RH ES3, samba 3.0.9-1).
I can see the shares, but when I try to access any of the shares, I
get prompted for a username and password and this is what shows up in
the log.winbindd file
-------------------
[2004/12/29 08:17:37, 1] nsswitch/winbindd_user.c:winbindd_getpwnam(161)
user 'robl' does
2006 May 19
2
Problems with belongs_to table joins
I am looking for a little assistance with a problem I have with a simple
table join using Rails. I am a relative newbie to both Ruby and Rails so
any help would be greatly appreciated . I have two tables products and
product_formats.
create table products (
id int not null auto_increment,
title varchar(100) not null,
product_format_id integer
2009 Jun 11
4
Using view helpers and route helpers in a model
Hi there,
I am trying to get something working and its driving me crazy. I have
been looking around for solutions to getting view helpers working in
models and for the most part I find this solution.
Add the following in the model you want to use them in
include ActionView::Helpers::UrlHelper
include ActionController::UrlWriter
However, when I try something like
2006 Feb 16
1
HABTM -VS- belongs_to/has_many, for self-referential joins
Ok, David says on page 241 that sometimes a many-to-many relation with
attributes are better implemented as an actual model instead of using HABTM.
Well, I''ve got that situation and I can''t figure it out.
All of the examples in the book have HABTM examples between 2 different
tables, but I want to have a HABTM relation on 1 table with itself. (e.g.,
if I have a table Things,
2006 Aug 07
4
multiple habtm joins on the same two tables
i have a taskmanager type of project that i am working on, where i need
to separate joins on the same two tables. i need one join for users that
are assigned to the task, and another join for who has read the task, so
they can tell which ones are new.
any suggestions on the best way to accomplish this?
thanks
--
Posted via http://www.ruby-forum.com/.
2009 Jul 13
0
[LLVMdev] Clang source question around failing MSVC build
ParseDecl.cpp fails to compile with MSVC reporting the following error:
ParseDecl.cpp
compiler\llvm\tools\clang\lib\Parse\ParseDecl.cpp(2760) : error C2248: 'clang::A
STOwningResult<Destroyer>::operator =' : cannot access private member declared i
n class 'clang::ASTOwningResult<Destroyer>'
with
[
Destroyer=::upâ–˛
]
2009 Aug 20
0
Facebook cookies and cross domain sessions
Hi,
I wonder if can quiz anyone on how to solve a problem. I use our
Facebook app to take payments so we have to access our app outside of
the Facebook Canvas for a few controllers (and only minimally). We have
a system working fine and we have a token based login to ensure its the
same user on the external pages.
The problem is we want to perform an action, set some flash messages
and
2010 May 13
0
Rails 3, Paperclip and checking out particular revisions
Hey, got a weird one. I''ve been playing with a couple of Rails 3 apps
and today I have broken both. Seemingly by updating my paperclip gem.
Gemfile
.....
gem ''paperclip'', :git => ''git://github.com/thoughtbot/paperclip.git'',
:branch => ''rails3''
It appears the latest version of paperclip or at least in the branch
has broken in
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
2007 Nov 22
5
Odd bug in Siemens C460IP ?
Hello,
I think I have encountered an odd bug in Siemens C460 IP/dect handsets,
which is a bit annoying, and I'm not (yet) sure how to get round it without
lots of hacks.
Basically, on all external incoming calls, we set:
exten => s,n,SIPAddHeader(Alert-Info: Bellcore-dr2)
This causes handsets (i.e. Cisco 7960 / Grandstream / aastra) to set a
different ring cadence so to differentiate
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