Displaying 20 results from an estimated 140 matches similar to: "acts as list -- adding or moving new item to new location"
2006 Feb 15
9
newbie-> help understanding "magic" behavior
I am trying out ROR for the first time[1], and have much PHP poisoning
to overcome in my mental baggage. That said, I was delighted to find
that I could make a link from a "show" page to the next record in the
database by simply adding
@next_page = Content.find(params["id"].next)
to my content_controller.rb and then constructing a link to it within
my show.rhtml.
The
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
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
2007 Sep 02
2
problem validating uniqueness
I have validates_uniqueness_of :name in my model which works fine when
creating a record but doesn''t work when I edit the record. In other
words it won''t let me create a record with the same name but I can go
in after and update the field without a problem. Why would this
happen? -Mike
--~--~---------~--~----~------------~-------~--~----~
You received this message because you
2006 Jul 23
2
REST controller with up and down for model that acts_as_list
Hi,
I have the following models
class Department < ActiveRecord::Base
has_many :products
end
class Product < ActiveRecord::Base
belongs_to :department
acts_as_list :scope => :department_id''
end
When I look at a list of products for a particular department I have
up and down buttons to re-order the products. Currently my controller
is something like this
class
2006 May 15
0
acts_as_list, move_higher, odd indexing behaviour?
Hi,
[reposting to list, posting via google groups apparently didn''t work]
I''m trying to use acts_as_list for the first time.
Can anyone confirm the odd behaviour reported here?
http://blog.nominet.org.uk/tech/Web/2006/03/06/Using_acts_as_list_in_...
i.e. element access and move_higher require an odd indexing scheme to
work.
I''m personally finding that I
2007 Jun 03
3
mongrel cluster w/ apache
hi all,
i''m working on deploying my app w/ apache and a mongrel cluster. i''ve
started by copying the instructions and code from the agile rails book
and everything seems to be working fine but apache isn''t forwarding my
requests to mongrel the way i expect it should. there''s nothing in the
rewrite logs and nothing but 404 errors in the apache error logs.
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
2012 Jul 20
8
sti_object.becomes(Parent) unexpectedly mutating the receiver
I ran into an interesting issue today with ActiveRecord''s becomes method
and discovered that it is mutating the receiver without me knowing it.
The API docs<http://api.rubyonrails.org/classes/ActiveRecord/Persistence.html#method-i-becomes>say
"The new instance will share a link to the same attributes as the original
> class. So any change to the attributes in either
2007 May 15
4
Way to mark record as main?
I was curious if there was a built in feature in ActiveRecord or a
plugin, but I basically have a database for phone numbers. I want a user
to be able to make a phone number as main. There can only be one phone
number marked as main at all times. Is there something for this?
Thanks for your help.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
2006 Sep 09
1
Acts as tree and list?
Does anyone have any experience using acts as tree and acts as list
together? My model looks like
class ModelName < ActiveRecord::Base
acts_as_tree :order => "position"
acts_as_list :scope => :parent
end
the table has fields
position, :integer
parent_id, :integer
This kinda of seems to work. Except if I do something like
@modelinstance.children.first.move_lower
2006 Apr 03
2
Fast way of finding new position for model object?
I have a model object that acts as a list. The position of each object
is determined by two factors: number of votes ascending and age of
object descending. When a user adds or deletes a vote I need to
quickly update the associated model object''s position. Right now this
is done with the following method:
def update_position
position = nil
Bug.find(:all, :order =>
2006 Feb 22
9
acts_as_habtm_list plugin
I''d like to announce acts_as_habtm_list plugin for rails.
acts_as_habtm_list is a Ruby on Rails plugin, that can manage ordered
lists through a join-table. It is providing almost the same Api as
acts_as_list. The position column has to be defined in the join table.
You can find additional information at:
http://www.inlet-media.de/acts_as_habtm_list/
Install it executing this command
2007 Jul 06
1
ferret (0.11.4-mswin32) w/ acts as ferret
i''m indexing a table from some legacy db via a nightly executed
script/runner command (LegacyInfobase.rebuild_index).
but very often newer documents don''t show up in search results for quite
some days. when running it manually from console for diagnosis it mostly
stops with this error (but not always):
[This was fast-saved 1 times. Some information is lost]
IOError: IO Error
2007 May 08
1
acts as ferret javascript.back fails after a search result
hi,
i use ferret in my application and when the user uses the search, i
return some records. the user then clicks on a result to view details.
on the details page, i have a javascript.history.back to return to the
search result. however, i get the expired results page and the user has
to refresh the browser. is there a simple way to solve this?
thanks.
--
Posted via http://www.ruby-forum.com/.
2007 May 22
1
acts as ferret, make index in /tmp then copy back to avoid NFS slowness?
Hi,
We''re happily using Ferret through acts_as_ferret on a Rails website,
but we have an issue with rebuilding indexes.
The Rails project directories are on an NFS mounted volume and
running Model.rebuld_index there seems to take 60-100 times longer
than it does on a local filesystem (e.g. /tmp).
What we''d like to do is rebuild our indexes in say /tmp, then copy
them back when
2007 Feb 14
0
acts as ferret creates redundant default index directory?
Hi
I''m using a non-default index directory (acts_as_ferret :index_dir
option) but the unused default (./index/) is still created at load
time.
The culprits are the two calls to ensure_directory in the
init_index_basedir method in acts_as_ferret.rb that seem to be
redundant. Removing the calls to init_index_basedir fixes the problem
with no apparent side effects.
Cheers, Stuart
--
2007 Feb 25
1
ferret w/ acts as ferret on windows
hi all!
after hours of trying to find contents with german umlauts i stumbled
upon a post where someone said ferret won''t work with utf-8 on
windows???
is that really true?
do i really have to iconv everything to iso-8859-15 before indexing and
do the same with the query to get it working?
i''m running ruby 1.8.5, ferret 0.10.9-mswin32, and rails 1.2.2 and just
reinstalled aaf
2007 Jun 26
2
Acts as Authenticated
I am using Acts as Authenticated and I need to call current_user in my views.
How do I mock current_user and other methods of Acts as Authenticated in my view specs?
2006 Aug 14
0
Acts As List bug: changing value of a scope attribute
Hi,
I''ve just found out about this issue and it seems dev.rubyonrails.org is down so
I thought I''d put it to the list
Say I have an acts_as_list with as associated scope:
MyObject
------
id assoc_id position
== ======== ========
1 1 1
2 1 2
3 1 3
4 2 1
5 3 1
If I alter one