Displaying 20 results from an estimated 6000 matches similar to: "acts_as_list with scope for two fields without parent/child"
2006 May 26
6
Help needed with acts_as_list
Hi ! There must be something I don''t understand clearly in acts_as_list
I have a list of gallery entries (images + text), model is GalleryEntry.
I have a field in_exhibition (boolean)
I want the list to be sorted with a scope on in_exhibition : from 1 to N
for every record having in_exhibition = false and 1 to N for every
record having in_exhibition = true
When I use acts_as_list
2005 Nov 25
2
acts_as_list with 2 fields in the scope
Hi Railers,
I''ve got a Categories table.
I want it to act as a list within the scope of the parent_id AND the
site_id.
Categories table :
id
label
site_id
parent_id
So, in my Category class, I have :
acts_as_list :scope => ''site_id = #{site_id} AND parent_id = #
{parent_id}''
The problem is that when I try to move_up a Category with a parent_id
that is null,
2006 Aug 17
1
How to sort child table on fields in the associated parent
For an Xray file system patients have folders and folders have studies.
That is:
patients folders studies
id id id
name patient_id folder_id
... label type
... ...
The list of studies with their associated folder and patient might look
like this:
name folder_label study_type
2006 Apr 21
0
acts_as_list with the scope on boolean field
I have a boolean field in mysql (tinyint) which I want to use as a
scope restriction for acts_as_list
acts_as_list :scope => ''featured = #{featured}''
however, there is a problem here as when Rails generates SQL query for
this it supplements true/false for #{featured} which raises error in
mysql
As a workaround I created dummy attributes that return 1/0 depending
on featured
2006 Jul 06
5
Building a standalone application with RoR
Hello,
I have to code a small application for a car repair shop running under
Windows (98 SE but may be my client could upgrade to 2000) and using RoR
is my definite choise !
The app will be powered by WebRick (which is enough powerfull for a
small app used by only ONE user at a time)
My questions are targeted to the best database to use... I had a look to
SQLite and Firebird but support
2007 Mar 28
1
acts_as_list nested scope
Here''s what I''m trying to do:
class Model < AR::Base
acts_as_list :scope => [:key_one_id, :key_two_id, :key_three_id]
end
with the idea being that there are these three references from this table
(one of them being optional) that define the list. I don''t think acts as
nested set works in this situation because I''m still just dealing with a
single list
2006 May 21
3
acts_as_list scope and polymorphic association.
this is my model:
class Person < ActiveRecord::Base
has_many :phones, :as => :callable, :order => :position
end
class Phone < ActiveRecord::Base
belongs_to :callable, :polymorphic => true
acts_as_list :scope => :callable_id
end
how can i add the callable_type to the scope.
how can i say the scope is the {:callable_id,:callable_type} couple?
is it even possible?
thanks
2006 Jun 11
0
Reaching through a belongs_to for acts_as_list scope?
I''m running into a situation where I''d like to provide the list scope
for an acts_as_list model from one step removed. In minimalistic form
(with several other associations removed from each level).
class MainEntity < AcrtiveRecord::Base
has_many :containers
end
class Container < ActiveRecord::Base
has_many :elements
belongs_to :main_entity
end
class
2006 Jun 27
2
how to use scope with acts_as_list
i am working on a task management system for the company i work for. i
just got the rails cookbook and am trying to use the section on creating
a drag and drop sortable list.
the tricky part is that my Task model references the User model in two
different spots. i have one field for the creator of the task and
another for the assignee. so in my Task model i have the following code:
class
2007 Apr 29
1
acts_as_list with :scope - how do I move items to a different list?
Hi,
I have in my simplistic app:
class Album
has_many :pics, :order => :position
end
class Pic
belongs_to :album
acts_as_list :scope => ::album
end
It all works fine when creating a new pic from the forms. But, when
trying to move a pic between albums, the album changes Ok, but no
matter what I do the position attribute stays the same and the list
navigation is broken. So far,
2006 May 17
6
White Screen of Death
Hello, I''ve heard these words to describe a RoR application returning an
empty page.
This happen from time to time even here, in the forum.
That is the cause of this misbehaviour ? Is it related with something
external to RoR itself ?
What is the solution to avoid the WSOD ?
--
Posted via http://www.ruby-forum.com/.
2006 Apr 01
3
acts_as_list with scope : position update problem?
Hello,
I''ve tried to set up a class with acts_as_list with a scope argument
that restricts a list to records with the same foreign key.
For example :
database :
CREATE TABLE `families` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(255) NOT NULL default '''',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
INSERT INTO
2006 Aug 04
8
I need an idea !
Hello here, I need to find an idea to solve a problem
I manage Events which are of kind :arrival or :departure
At first the two kind of events was unrelated but my client want to see
the :departure belonging to the :arrival and vice versa.
I''m searching for a solution to implement this ''link''. I''ve thought
about an integer column containing an uniq id for
2006 May 17
12
Help with Apache config
I have been attempting for days to configure Apache for Rails. I have
read forums, followed How-To''s all in vain. I am hoping someone can help
me out. I am getting the Rails Welcome screen, but when trying to go to
any other url, I get the 500.html message. Take a look for yourself at
http://66.139.78.237 and click on "about your application''s
environment".
2005 Apr 20
4
acts_as_list and single table inheritance
in a single table inheritance model, rails will automatically set the
scope for acts_as_list to the ''type'' field as well as any other scope
conditions we provide.
Is there a way to disable this? i want to use STI but I want
acts_as_list to disregard the class type when getting/setting
positions.
thanks
alan
2007 Jan 25
1
acts_as_tree with acts_as_list
Hello all,
I''m having trouble using acts_as_list with acts_as_tree
to order the "children". I''ve found a few old posts on the web
that seem to indicate that this once worked.
class Whatever < ActiveRecord::Base
acts_as_tree :order => :position
acts_as_list :scope => :parent_id
Although the ''position'' field is being populated,
it appears
2009 Jan 05
3
Plugin not found: ["acts_as_list"]
I am trying to install acts_as_list in a rails 2.2.2 project but when I
try the following: ruby script/plugin install acts_as_list
I get: Plugin not found: ["acts_as_list"]
I had to download the acts_as_list plugin from the github because it
isn''t included in Rails 2.2.2.
The files are in my vendor/plugins/acts_as_list folder so I have:
lib/active_record/acts/list.rb
2009 Jan 04
3
undefined local variable or method `acts_as_list'
So I seem to be having an issue with trying to install acts_as_list in
rails 2.2.2?
I have downloaded the files from: http://github.com/rails/acts_as_list/tree/master
I have put the files in the vendor/plugins folder the files are as
follows:
vendor/plugins/acts_as_list/init.rb
vendor/plugins/acts_as_list/lib/active_record/acts/list.rb
vendor/plugins/acts_as_list/test/list_test.rb
2005 Jul 07
2
0.13 ajax sortable lists and acts_as_list
I''m trying to figure out a good way to get acts_as_list and the new
sortable lists to play nicely together, but they don''t seem like
they''re designed to mesh well. The ajax sortable lists post a
complete ordered list of ids back to the server after every change,
but acts_as_list is designed to deal with diff-like changes, rather
than reordering the whole list from
2009 May 09
0
acts_as_list not working despite being installed
I just installed a newer version of Ubuntu and so with it, rails
2.3.2. Now I can''t get acts_as_list working. I get the error:
undefined method `acts_as_list'' for Child(Table doesn''t exist):Class
But I have already run
> ruby script/plugin install acts_as_list
+ ./README
+ ./init.rb
+ ./lib/active_record/acts/list.rb
+ ./test/list_test.rb
I started a new program