Hello Rails experts, Need your help in following issue with the acts_as_list and single table inheritence Code details : http://pastie.org/1214846 Hello Rails experts, Need your help in following issue with the acts_as_list and single table inheritence Code details : http://pastie.org/1214846 But here I need create those entries with the scope on Relater only and not on RelaterFeed or RelatedLink I mean do not want to repeat these Position number 1,2,3 then 1,2,3 for same clip(i.e Relater). Currently it generating those positioning individually for RelatedFeed and for RelatedLink of same Relater(i.e clip) Here I need something like when I''ll assign Relater to RelatedLink or RelatedFeed it auto create positioning on the basis of Relater only like RelatedLink : rec 1 -> position =1, relater_id=10, relater_type="Clip", type="RelatedFeed" rec 2 -> position =2, relater_id=10, relater_type="Clip", type="RelatedFeed" rec 3 -> position =3, relater_id=10, relater_type="Clip", type="RelatedFeed" Then for RelatedFeed rec 1 -> position =4, relater_id=10, relater_type="Clip", type="RelatedFeed" rec 2 -> position =5, relater_id=10, relater_type="Clip", type="RelatedFeed" rec 3 -> position =6, relater_id=10, relater_type="Clip", type="RelatedFeed" position will be like 1,2,3,5,6.. etc Any Idea..?? How is to be done..? Thank you :) -Ganesh K -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
In that till I''ve tried following way to assign scope for relater:
1 - acts_as_list :scope => :relater
2 - acts_as_list :scope => [:relater_id, :relater_type]
3 - acts_as_list :scope => ''relater_id=#{relater_id} and
relater_type \''#{relater_type}\''''
But showing same result position 1,2,3 for RelatedFeed and 1,2,3 for
RelatedLink.. not generating position number with the scope on
Relater(i.e 1,2,3,4,5,6....etc)..
Guys, any Idea...???
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
I got the solutions and I would like to thank my PM(Mr.Rahul) for this
solution..
Here what we have done..
Instead of assigning scope by using with acts_as_list ,
like: #model file
class RelatedItem < ActiveRecord::Base
acts_as_list
belongs_to :relater, :polymorphic=>true
def scope_condition
“relater_id = #{relater_id} and relater_type = ’#{relater_type}’”
end
end
I hope it would be helpful for other Rails people also.!!!!!!! :)
-Ganesh K
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.