Displaying 20 results from an estimated 89 matches for "item_id".
2013 Jan 25
3
how to delete the null elements in list
HI,
I have the list:
> suu
[[1]]
NULL
[[2]]
NULL
[[3]]
item_id prod
1 2
[[4]]
item_id prod
1 2
2 4
how to delete all "NULL" elements from suu to get only
>suu
[[3]]
item_id prod
1 2
[[4]]
item_id prod
1 2
2 4
??
Kind regards,
Tammy
[[alternative HTML version...
2007 Aug 23
0
active scaffold polymorphic model
Hi
I am trying to use active scaffold to build a polymorphic model .
I have a number of models that can be featured and I have a Feature model
that belongs_to :item, :polymorphic => true
In my config.columns I include :item_type and item_id, I also added
:item_name to show the name of the record in the form.
In the form, when a type of model is selected I populate the select box for
item_name with with the names of the relevant records with the id of each as
the value. I set the id of the select box to item_id instead of item_name as...
2006 Dec 11
2
join and sort on 'best match'
...ch'': first all the
items that have 3 tags in common, then 2 and last 1
example:
Item 1 : news, nature, greenpeace
Item 2 : news, nature
Item 3 : news, nature, greenpeace, whale
Item 1 and Item 3 are the best match.
So far, the SQL I came up wiht looks like:
SELECT id, COUNT(items_tags.item_id) AS quantity
FROM items JOIN items_tags ON items_tags.item_id = items.id
WHERE id in (select item_id from items_tags where tag_id in (select
tag_id from items_tags where item_id=?))
GROUP BY items_tags.item_id,id
ORDER BY quantity DESC
note: the ''?'' in the query represents the dy...
2008 Jan 13
3
right usage of bdrb
Hi,
i''m going to implement a syndication-service, which will get lists in
xml with some meta-data an enclosed video files, which will get encoded
at the end. The syndication run will be startet every five minutes of
a full hour.
So i thought to build 4 Worker. One for checking which feeds to
syndicate (syndication_worker) at a specific time, one for processing
the list
2006 May 27
2
Error, in my store provider.
...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 %></td><td><%= @temp12.add_atk %></td><td><%=
@temp12.add_def %></td><td><%= @temp12.sell %></td></tr>
<% end -%>
</table>
It doesn''t like Item.find(items.item_...
2006 Mar 29
3
Self-referential many-many joins with :through
...rg/changeset/4022 that fixed them only went
through 5 days ago..
Cheers
-henster
***********************************************************************************
class Topic < ActiveRecord::Base
has_many :item_collection, :class_name => "Grouping", :foreign_key
=> "item_id"
has_many :group_collection, :class_name => "Grouping",
:foreign_key => "group_id"
has_many :groups, :through => :group_colletion
has_many :items, :through => :item_collection
end
**********************************************************************...
2006 Dec 05
0
[779] trunk/wxruby2: Added TreeCtrl#traverse method and documentation
...ultiselection controls only.
</span><span class="cx">
</span><ins>+h3(#TreeCtrl_traverse). TreeCtrl#traverse
</ins><span class="cx">
</span><ins>+ *toggle_item_selection*(%(arg-type)TreeItemId% start_item = root_id) { | item_id | ... }
+
+Recurses over the treectrl''s items, passing each TreeItemId successively
+into the passed block. This TreeItemId can be used as an argument to
+many other methods in this class.
+
+The @start_item@ argument will be the first item_id passed into the
+block, followed by i...
2006 Mar 07
0
Making AR attriibutes private
Hi,
Can anyone tell me the syntax to make AR attributes private so that they
can only be set through an object''s constructor?
I want do something like this, where item_id and rated_by are private
and set only through the constructor:
# Schema as of Mon Mar 06 21:22:59 BRT 2006 (schema version 15)
#
# id :integer(11) not null
# item_id :integer(11) default(0), not null
# rated_by :integer(11) default(0), not null
#...
2008 Mar 02
2
check_box_tag remote_function
I have a collection of check_box_tags that look like the following:
<% for item in @items %>
<%= check_box_tag "item[item_ids][]", item.id, false, {:onchange =>
remote_function(:url => update_items_path, :with => "''items='' +
escape(value) "} %>
<%= item.name %>
<% end %>
My question is, how do I send all of the current checkbox values
(item[item_ids][]) in the onc...
2006 Dec 23
0
[797] trunk/wxruby2/swig/classes/TreeCtrl.i: Traverse method moved to wxSugar
...}
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ // Called on every tree item to do GC marking of itemdata
</ins><span class="cx"> static void DoGCMarkItemData(void *ptr, const wxTreeItemId& item_id)
</span><span class="cx"> {
</span><span class="cx">         wxTreeCtrl* tree_ctrl = (wxTreeCtrl*) ptr;
</span><span class="lines">@@ -90,15 +91,6 @@
</span><...
2006 Feb 07
21
Paypal and Rails
Hello everyone,
I am looking for a way to pass off a simple payment to paypal using our
own interface. I understand that this requires making full use of
Paypal''s API since we won''t be using their shopping cart or anything. I
found the article by Pranav Bihari on his site and in the Wiki on using
SOAP4R and the paypal WSDL file to interface with paypal web services,
but I
2006 Jan 20
6
HELP: acts_as_taggable problem with :clear => true
...e on the tags method, because the tags I''m supplying as
parameters are the complete set of tags for the item, not additions to
existing tags.
Problem is, that gives me a nasty SQL error ...
Unknown column ''id'' in ''where clause'': UPDATE items_tags SET item_id =
NULL WHERE (item_id = 2 AND id IN (NULL,NULL,NULL,NULL,NULL,NULL,NULL))
Any ideas ?
My call to tags (in update method in controller) is like this
@item.tag(params[:tags], :clear => true )
Acts_as_taggable is invoked like this
acts_as_taggable :join_class_name => ''ItemTa...
2007 Mar 04
3
Dynamically setting the image directory used by attachment_fu
...methods to the item_image object.
# Make sure the related item is associated to the thumbnail child
before_thumbnail_saved do |record, thumbnail|
thumbnail.item = record.item
end
def full_filename(thumbnail = nil)
# Just to be sure the ID gets set
raise "Missing Item ID" if item_id.nil?
file_system_path = (thumbnail ? thumbnail_class :
self).attachment_options[:path_prefix].to_s
File.join(RAILS_ROOT, file_system_path, item_id.to_s,
attachment_path_id, thumbnail_name_for(thumbnail))
end
and in your Item class you add a condition since it makes it easier to
iterate ove...
2006 Mar 22
1
updating multiple attributes
I have a store administration tool I''m trying to build.
One view is an item view. Each item can have many attributes.
Example:
item: bike
item_id: 2333
attribute: id: 3 #auto-increment
item_id: 2333 #primary key
attribute_type: wheels #a type of attribute
attribute_order: 1 #the order it shows up in the
list
attribute: id: 4 #auto-increment...
2006 Jul 14
5
file_column and has_many
I''ve been fighting with myself over this for the past week, and would
like to hear some others'' thoughts on the subject. I essentially have
the following models in place:
class Item < ActiveRecord::Base
has_many :images
end
class Image < ActiveRecord::Base
belongs_to :item
file_column :filename
end
In my view, I have javascript that basically creates N
2006 May 29
4
has_many <-> belongs_to trouble
...ship
has_many ans belongs_to that i dont now how to manage the update action,
here are my models
class Item < ActiveRecord::Base
has_many :images
end
class Image < ActiveRecord::Base
belongs_to :item
end
And my table structure:
Items => id, title, desc
Images => id, image, item_id
ok, i have a number of items and each item has an image assigned, i can
display the item info and its assigned image with
<% for image in @item.images %>
<%= image_tag("/images/publicas/" + image.image) %>
<% end %>
thats not a problem, the problem comes when i w...
2007 Nov 16
1
drag & drop list needs refreshing
...I''m almost done
but after dropping an item on the target div I need to refresh the
page to see that the item has been moved. This happens even if I
render the partial on my controller (just to test it I use only 1 item
stored on the session variable)
[code]
def add_item_to_selected
item_id = params[:id]
session[:selected_items] = item_id
render :partial => ''items''
end
[/code]
The other code is below
[code]
#view
<div id="itemList"><%= render :partial => "item_list"%></div>
<div id="selectedItems&...
2008 Apr 23
1
Validation dependent on unsaved parent
...ActiveRecord::Base
has_many :line_items, :dependent => :destroy
belongs_to :location
end
class LineItem < ActiveRecord::Base
belongs_to :order
belongs_to :item
def parlevel
if self.order
Parlevel.find(:first, :conditions => {:location_id =>
self.order.location_id, :item_id => self.item_id})
else
nil
end
end
def validate
if self.quantity_requested
if self.parlevel
limit = self.parlevel.quantity
else
limit = 0
end
errors.add(:quantity_requested,"above maximum of " + limit.to_s)
if self.quanti...
2006 May 03
2
render partial collection
...on => @keyword.synonyms,
:locals => { :action_delete => "removesynonym", and_some_other_stuff
})
%>
_item_list.rhtml contains:
<%= link_to (
image_tag(''/images/deletebutton.png''),
{ :action => action_delete,
:id => @keyword,
item_id => item_list }, %><%= item_list.name %>
Now, how can I pass the ''name'' property from my main view? This does not
work:
<%= render(:partial => ''item_list'', :collection => @keyword.synonyms,
:locals => { :action_delete => "rem...
2006 Aug 07
1
Eager loading wierdness
Consider this problem.
I have an Item that has_many Features
I want to find all Items with a Feature name of ''foo''.
Normally you would do this..
@items = Item.find(:all, :conditions=>["features.name = ?", ''foo''],
:include=>:features)
This all works fine and dandy except for this problem.
If you do this...
<% for item in @items %>