Displaying 20 results from an estimated 10000 matches similar to: "Way to mark record as main?"
2007 May 17
8
Model: self is not child's parent
Assume a model Parent and another model Child. Child belongs_to Parent
and Parent has_many Children. The following fails:
@
p = Parent.find(:first)
assert p.equal?(p.children[0].parent)
@
It seems odd to me that I and my child''s parent are not the same object.
In fact, this is royally screwing me up. Can anyone tell me why this is
or point me at a relevant discussion, blog posting,
2007 Jul 12
1
acts as list -- adding or moving new item to new location
right now i''m adding an item to my ''list'' but i''m unsure how to move
it to a certain spot in the list. specifically i want to put it at the
bottom of the list. i assumed that if i did something like
parent.children << new_child
then the ''position'' field in the child table would be given some
sensible default by rails but instead
2010 Sep 09
4
acts_as_list query
When moving an item around within the list, shouldn''t EVERY item have
its optimisitc locking field updated? Currently, only the item that is
moved has its optimisitc locking field updated, but every item has its
position field changed so surely they too should have their optimistic
locking fields updated?
I''ve created a drag and drop interface on a list of items that allows
for
2008 Feb 22
7
undefined local variable or method "acts_as_list"?
Hi, I''m getting the error below, and I''m not sure where to find
"acts_as_list" ...
NameError in SpecialsController#printer
undefined local variable or method `acts_as_list'' for #<Class:
0xb7a46994>
RAILS_ROOT: /usr/local/apache2/htdocs/dps
Application Trace | Framework Trace | Full Trace
vendor/plugins/trunk/lib/scope_out.rb:70:in
2006 Apr 30
4
acts_as_ordered_tree
I need an ordered (sortable tree) and I just was thinking if somehting
like this is possible:
class Item< ActiveRecord::Base
acts_as_tree :order => "position"
acts_as_list :scope => ''parent_id = #{self.id}''
end
For my understanding mixing of two acts_as should be p?ssible, at least
in this case, right?
Unfortunatly the :scope is not working, I am not
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
2007 Aug 07
3
Yum install preferred arch only
I have a couple 64-bit CentOS 5 installations here and was wondering if
there was a yum option to have it install only x86_64 arch by default
if no arch is specified.
I tired of having to append .x86_64 on all package names I only want
the x86_64 versions of, if I want the i386 versions too I would add
the .i386 package to the list...
Thanks All,
Ross S. W. Walker
Information Systems
2010 Dec 23
6
Difference between rake test:units and individually running ruby -I test test/unit/something_test.rb ?
Here''s my issue: running ruby -I test test/unit/something_test.rb for
each of my unit tests works perfectly.
However, running rake test:units brings errors in all of them - some
object becomes nil for some reason.
Why might this be happening?
Specifics: the object that is successfully not nil when I run the unit
tests one-by-one but becomes nil when I do rake test:units is defined
like
2007 Sep 08
3
Where is the blktrace utility?
I keep reading that RHEL/CentOS 5 supports blktrace, but I can't seem
to find the blktrace/blkparse utilities.
Is it that just the functionality is available in the kernel, but the
user is left to have to hunt down the latest versions of the utilities
on the net?
If anybody knows where to get the latest versions of these utilities
I would greatly appreciate it.
Ross S. W. Walker
2009 Mar 05
6
About before_* callbacks
Hi
I have an problem about before_* callbacks.
I have a model named: Event
And I don''t want anyone to destroy or update any records in Event
model.
So:
[code]
class ActiveRecord::Base
before_destroy :log_illegal_operations
before_update :log_illegal_operations
private
def log_illegal_operations
Event.create({:key => "illegal operation", :value =>
2006 Dec 31
2
Presenting a grouped list of objects from STI
Hello,
I have been following the STI example in AWDWR and have a question about
presenting the output.
I want to output a list of Person objects that are grouped by their
type.
I have an array of all the Person objects and I would like the output to
be as follows.
Employee x3
<ul>
<li>Employee 1</li>
<li>Employee 2</li>
<li>Employee 3</li>
</ul>
2007 May 23
3
User Login (process_login)
Hiya - before I start let me tell you i''m a Nuby on Rails.
I''ve created a user registration within my application that requires
email validation and that seems to be working fine.
I''m now creating the user login page and have the following code in my
UsersController:
def login
@user = User.new
@user.username = params[:username]
end
def
2008 Sep 10
5
xmlhttprequest for updating
Hello,
I am updating an object with an AJAX form:
view:
<% remote_form_for(@sample, :update => "content2") do %>
<p>
parameter: <br />
<%= select("sample","parameter",Parameter.find(:all).collect {|p|
[p.description.gsub(''_'', '' ''),p.id]},{},{:size => 4, :multiple =>
true}) %>
2009 Feb 06
4
Full Ajax Application
Hello, I''m a newbie here... please... can anyone help me about FULL
AJAX ? for example if i''m scaffolding a simple model and controller
for product which only have 1 field for NAME:STRING with the command :
script/generate scaffold Product name:string
and for the generated code I like to turn it into a full ajax app, for
example if i''m click the NEW or EDIT link it
2007 May 30
2
Bug? Filter chain halted as [#<ActionController::Filters::..
OK so I''ve been trying to follow the tutorial here:
http://rails.homelinux.org/
When I simply do "scaffold: category" in the controller.rb, everything
works fine. BUT after I generate the controllers and other files using
scaffold AS A SCRIPT (script/generate scaffold categories), DESTROY (or
DELETE) does not work for any record in a table. This is the error I
got:
Processing
2007 Sep 08
1
Kernel debug info?
Ok, I got blktrace installed, but I also have some blktrace
system taps that I want to test out, but it seems I need to
have the kernel debug info installed to get systemtap
working.
Anyone know where the CentOS kernel-debuginfo RPMs are
located?
Ross S. W. Walker
Information Systems Manager
Medallion Financial, Corp.
437 Madison Avenue
38th Floor
New York, NY 10022
Tel: (212) 328-2165
Fax:
2008 Apr 24
4
Slightly OT: Extra icons on desktop
I'm running FC8 with Gnome 2.20.0 at work and I have this interesting situation.
I have two disks on the system that are both configured to be mounted
in /etc/fstab, but I'm seeing two things I believe are strange.
One is that the second drive is not getting mounted at boot time.
The other is that I see two icons for the disk on my desktop - one
with the mount point of the drive, the
2009 Nov 10
6
getting the timezone name from an abbreviation
HI,
I am creating n onlinecalendar sort of functionality for which the
user input for events is taken. To make it user friendly, its left to
the user to write the time down rather than selecting it from a
datetime field in a form
.
The user can also specify a timezone. And while doing so its obvious
that most inputs will be an abbreviation.
My question is - is there a way to convert
2008 Apr 23
3
dom0 lost packets.
I try to get working together vlan and bonding both for dom0 and domU. I
lost packets sent to dom0 while domU is OK.
Nightly stats for dom0:
52879 packets transmitted, 45293 received, 14% packet loss, time 52879599ms
rtt min/avg/max/mdev = 0.144/0.224/717.306/5.129 ms
Nightly stats for domU:
52952 packets transmitted, 52952 received, 0% packet loss, time 52952554ms
rtt min/avg/max/mdev =
2007 Nov 09
2
SMB Shares with subversion backing store
To all,
I was wondering if it was possible to setup samba shares that use subversion as a backing store for the files.
Whenever a new file is created it is added to the subversion tree, whenever a file is opened it is checked out of the subversion tree, and whenever it is deleted it is removed from the subversion tree.
The idea is that one could use subversion to retain previous versions of