similar to: @article.article_groups.delete_if... Dosn''t work!

Displaying 20 results from an estimated 700 matches similar to: "@article.article_groups.delete_if... Dosn''t work!"

2006 Sep 25
2
@article.article_groups.delete_if... Dosn't work!
If I try: @article.article_groups.delete_if {|x| x.group_id == x.group_id } It does nothing. If I try: articletmp.article_groups.each{ |x| @article.article_groups.delete(y) } It deletes some of the groups. @article.article_groups.clear works. Why dosn''t the to first examples work as expected?? Do I have to put groups I don''t want to
2006 Feb 21
6
Select articles from group with id ''1'' and id ''2''
I have to tables: "articles" and "groups". Between I have article_groups as a jointable. Now I want to select every article who is a member of group with id ''1'' and id ''2''. Whats best way to get that? Extract from schemas: CREATE TABLE articles ( id int auto_increment, ingress text NOT NULL, story_text longtext, constraint fk_items_users
2009 Feb 04
2
delete_if does not work on associations
I tried to user delete_if on an association: class Group < ActiveRecord::Base has_many :memberships, :dependent => :destroy has_many :users, :through => :memberships ... end This is the controller method, trying to use delete_if. Although some elements are removed (s2 < s1), the save method does not update the association. def intersect_or_remove_group other_group =
2006 May 26
4
shouldn''t this work? - session[:array_of_objects].delete_if {|x| x.id == params[:id]}
I am saving an array of active record objects (college courses) in the session as session[:course_list]. This is the cart for a registration controller. If a student chooses to delete the course from the list I get the :id as params[:id]. However if I do session[:course_list].delete_if {|x| x.id ==params[:id]} does not work. session[:course_list].delete_at(idx) works. Ocourse to do this I have
2006 Aug 08
12
delete_if doesn''t work for has_and_belongs_to_many
I''m using Rails-1.1.4 with Ruby-1.8.4 So let''s say I have 2 model classes: class Item has_and_belongs_to_many :things end class Thing has_and_belongs_to_many :items end i = Item.new i.things << Thing.new( :value => "Something").save i.things << Thing.new( :value => "Something Else" ).save i.save Fine, now I have two records in the
2006 Mar 09
0
Sending files other than html via Actionmailer
I''ve been trying to set up to send already generated PDF''s via the ActionMailer class however it dosn''t seem to send the full file. So when I try to load the file after being sent it via email it dosn''t because it is corrupt. When I choose to send HTML instead it sends fine but it dosn''t work with Word Documents either Do I need to do anything special
2006 Mar 08
4
Sending Documents via ActionMailer
Hi, I''ve been trying to set up to send already generated PDF''s via the ActionMailer class however it dosn''t seem to send the full file. So when I try to load the file after being sent it via email it dosn''t because it is corrupt. When I choose to send HTML instead it sends fine but it dosn''t work with Word Documents either Do I need to do anything
2006 Jan 07
3
user engine question
I''ve created an array of hashes in UserController#initialize to describe a menu: @menu_array = [ {:menu => ''home'', :controller => ''home'', :action => ''send_home''}, {:menu => ''user list'', :action => ''list''}, {:menu => ''login'', :controller =>
2007 Jul 26
3
tc filter not work, why?
I try to use tc on mips with linux-2.4.18 but the u32 filter dosn''t work I added htb qdisc to linux-2.4.18 and use it to limit the speed in LAN, it only work well on the default class, for example tc qdisc add dev eth0 root handle 1: htb default 10 tc class add dev eth0 parent 1:0 classid 1:1 htb rate 2000kbit tc class add dev eth0 parent 1:1 classid 1:10 htb rate 500kbit ceil 500kbit
2006 Jun 04
6
Activerecord relations.
I''ve got two tables set up - Things and Users where Users have many things and Things belongs to Users. They''re connected by Things.user_id => User.id and Things.updated_by_id => User.id both in the Things model using Belongs_to and custom foreign key for one of them. Problem is when I''ve got the updated_by_id belongs_to I can''t add Things using
2007 Jan 06
3
speeding up pagination
I need help to optimize a query (sort of ...) if params[:debit] == "on" @schools = School.find(:all, :conditions => ["name like ?", "%#{params[:search]}%"], :order => ''name'') @schools.delete_if { |s| s.debit <= 0 } @school_pages = Paginator.new self, @schools.length, 20 The problem here is that
2006 Apr 27
4
Up-dates
I started working on a chat program but, I''m having this problem chatroom.rhtml <div id="chatroom"> </div> <%= periodically_call_remote( :update => "chatroom", :url => {:action => :chat }, :frequency => 2) %> chat.rhtml <h1><%= @chat.room %> room.</h1>
2011 Feb 28
1
(2.3.5) removing validations
Today I tried to remove (actually overwrite) a validation from a model, from within a plugin. This was the original validation: validates_length_of :login, :maximum => 30 This was the only code I could come up with to replace it: def self.included(base) base.class_eval do @validate_callbacks.delete_if { |callback| begin # Sorry, only way to remove
2006 Feb 19
3
newbie wanting to understand controller action relationship
I still getting my feet wet with rails and I''m trying to learn some good ways of working with link_to_remote. I''m using the user and login engines and I have in my layout this... link_to_remote( ''Login'', :update => ''main-query'', :url =>{:action => ''login''},
2006 May 27
2
Error, in my store provider.
Let me explain the subject title, store provider is Hackey, he''s a NPC that sells items to my users. <h1>Welcome to Hackey''s!</h1> <h3>Catalog</h3> <table border="2" bordercolor="red"> <% for items in @items -%> <% temp12 = Item.find(items.item_id) -%> <tr><td><%= @temp12.name
2006 Feb 07
11
date in domU
Hi all, where can I set the date in domU. ''ntpdate -u ...'' works but dosn''t set the date. date MMDDhhmm has also no effect. What can I do? -- cu Roland Kruggel  mailto: rk-liste@gmx.de System: Intel 3.2Ghz, Debian etch, 2.6.15, KDE 3.4 _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com
2006 Apr 26
7
Not updating
I copied the scaffolding edit and update and made it like this, Note: awnser is edit. Admin_contoller.rb def awnser @question = Question.find(params[:id]) end def update @question = Question.find(params[:id]) if @question.update_attributes(params[:question]) flash[:notice] = ''Question was successfully updated.'' redirect_to :action => ''list''
2007 Aug 30
4
Samba with ZFS ACL
Hi, I''m looking for Samba, which work native ZFS ACL. With ZFS almost everything work except native ZFS ACL. I have learned on samba mailing list, that it dosn''t work while samba-3.2.0 will be released. Has anyone knows any solution to work samba-3.0.25? If any idea, please let me know. thanks This message posted from opensolaris.org
2006 May 31
1
Automatic .santize?
Hello and thanks in advance to those who post back, I''m working on a calender but, it renders the data in the controller then saves it as @code so I call it in the veiw <%= @code %>. So everythings working and I add this line.. @event = Event.find_by_date("#{@temp13.year}-#{@temp13.month}-#{@temp13.day}") if @event == nil @@td = "<td width=50 height=50
2008 Mar 26
2
Missing Method defined in controllers/application.rb
I have this in my controllers/application.rb: class ApplicationController < ActionController::Base ... def datebalk! # set regexp for datebalks generated attributes c = /.*__dteblk/ # Remove datebalks generated attributes from params hash delete_if { |k, v| c =~ k.to_s } end ... end When I call this from client_controllers.rb in this fashion: # need this to strip