Displaying 16 results from an estimated 16 matches for "new_item".
2006 Feb 03
7
how to add multiple new records from one form
...ey can add up to
20 items to their cart in one form. The form simply has 20 rows with
each row containing a text input for product code and a text input for
quantity.
I''ve tried having the controller create an array that has an object for
each row by looping through something like:
@new_items[1] = Cart.new
and the controller is happy with that, but the template isn''t--it gives
an error like "@new_items[1] is not allowed as an instance variable
name".
I can get the whole thing working if I use non-model form objects in the
template, but then I lose the Rails erro...
2006 Mar 26
4
Updating query results in real time with AJAX
I have the following view template:
<%= form_remote_tag :update => "new_item",
:url => {:action => ''create''},
:before => %(Element.show(''spinner'')),
:success => %(Element.hide(''spinner'')) %>
<div id="new_item">
</div>...
2006 Aug 18
0
AJAX question
Dear all,
Help me get a simple AJAX behavior right. I know zero AJAX, thus
please advice. Below is a simplification of the real code and I hope
I can describe my intention clearly.
class StoreController < ApplicationController
def show_cart
@cart = Cart.new
@new_item = CartItem.new
end
def add_item
@new_item = CartItem.new(params[:new_item])
if @new_item.valid?
@cart.items << @new_item
# execute add_item.rjs
else
breakpoint
render :partial => ''new_item''
end
end
end
app/views/s...
2006 Aug 18
0
Simple AJAX question
Dear all,
Help me get a simple AJAX behavior right. I know zero AJAX, thus
please advice. Below is a simplification of the real code and I hope I
can describe my intention clearly.
class StoreController < ApplicationController
def show_cart
@cart = Cart.new
@new_item = CartItem.new
end
def add_item
@new_item = CartItem.new(params[:new_item])
if @new_item.valid?
@cart.items << @new_item
# execute add_item.rjs
else
breakpoint
render :partial => ''new_item''
end
end
end
app/views/store/show_c...
2005 Apr 13
2
Creating multiple option groups
I''m setting up a basic shopping cart type app, and the products we
have will have multiple options. Size, color, etc. I''m trying to
figure out how I can collect the the options that are selected when a
user adds the item to their cart. An OptionSet is a group of options
("Size", "Color", etc), and an ItemOption is the option itself ("12
oz",
2005 Dec 29
1
Has_Many - Saving Child Rows
...tifications table.
What I am having trouble with is getting the TODO id returned so I can
write the child table...
Here is the code I have so far:
##########################################
item = Todo.new # Create a new instance of Todo, so create a new item
item.attributes = @params["new_item"]
# item.todo_notifications << ToDoNotification.new(????????):
if item.save # Try to save our item into the database
redirect_to(:action => "list") # Return to the list page if it
suceeds
else
render_text "Couldn''t add new item" # Print...
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 Jun 22
0
has_many dynamic conditions
Hello.
I have two models. Channel with last_access field and Item with
created_on field.
They are in one-to-many relation.
class Channel < ActiveRecord::Base
has_many :items
end
class Item < ActiveRecord::Base
belongs_to :channel
end
I want a second has_many relation in Channel, called :new_items which
created_on is newer than last_access. Something like that:
has_many :new_items, :class => "Item", :conditions => ["items.created_on
> ?", last_access]
Unfortunately last_access method is taken from Channel:Class scope, not
from the Channel instance scope so i...
2006 May 22
0
logger and ActionWebService - how can I get them to work together?
...t anything to my ~/log/test.log file. Here''s an
example:
class LibraryServiceController < ApplicationController
wsdl_service_name ''LibraryService''
web_service_api LibraryServiceApi # format is <controller_name>Api
web_service_scaffold :invoke
def new_item(username, type, title, length, size, state, unique_key)
@user = User.find_by_login(username)
logger.fatal(@user)
puts @user
true
end
end
In #new_item I can''t get logger to output anything nor does my #puts
go anywhere that I can find. (BTW, the test passes without...
2005 Jan 07
3
multicolumn primary keys in activerecord
hi,
I''ve got the following tables in mysql notation:
CREATE TABLE `nodes` (
`id` int(11) NOT NULL auto_increment,
`parent_id` int(11) default ''0'',
`group_id` int(11) default ''0'',
PRIMARY KEY (`id`),
);
CREATE TABLE `groups` (
`parent_id` int(11) NOT NULL default ''0'',
`id` int(11) NOT NULL auto_increment,
2011 Jan 05
16
Nicedit (rich text editor)
Hello, I''m trying to use Nicedit to improve my text_areas in some views
of my project.
I have installed jquery:
ruby script/plugin install git://github.com/aaronchi/jrails.git
nicEdit plugin:
ruby script/plugin install
git://github.com/sergio-fry/Simple-nicEdit.git
Add js in layout:
<%= javascript_include_tag ''nicEdit'', ''nicEditInit'' %>
Use it
2008 Jul 14
18
[git patches] Ocfs2 and Configfs updates for 2.6.27
I'm running a bit late with the e-mail this time around, but I think that's
ok since there really isn't any major new features here - the bulk of the
Ocfs2 update is bug fixes, or cleanups. The same goes for configfs.
The only two things that could be described as features would be:
- Sunil has updated Ocfs2 to provide even more live cluster locking
information via debugfs.
- Joel
2006 Feb 16
0
RJS Question
Hi,
What would my method call in an rjs template to produce something like:
new Effect.BlindDown($(''commentList'').lastChild);
I know if I just wanted to the blind effect I would:
page.visual_effect :blind_down, "row_#{@new_item.id}"
but how would I call it if I want the ".lastChild instead of passing a particular id?
thanks, scott.
----------------------------------------------------------------------------------------------------
What''s an Intel chip doing in a Mac? A whole lor more that it'...
2006 Mar 30
4
Select List to change type of STI class
Hi:
I''m trying to create a drop-down list to change the type of a Single
Table Inheritance class. I tried this:
<%= select :user, :type, [ [''Author'', ''Author''],
[''Editor'', ''Editor''],
[''Administrator'', ''Administrator''] ]
2006 Feb 20
0
vpimd, a personal information server
...folder + "/*.ics" ].each do |file|
# todo: use the open with a block variant
Vpim::Icalendar.decode(File.open(file)).each do |cal|
cal.todos.each do |todo|
if !todo.status || todo.status.upcase != "COMPLETED"
item = maker.items.new_item
item.title = todo.summary
item.link = todo.properties[''url''] || link
item.description = todo.description || todo.summary
end
end
end
end
end
resp.body = rss.to_s
resp[''content-type...
2009 Feb 26
8
beginners question
hi group,
I am making a little rails app to experiment with rails. It consists
of one model, item, that represents an item on a todo list.
A todo item has a description, a state (finished or not) and a due
date.
After changing the scaffold screens a bit, I wanted to be able to
have no due date. I tried to do this by making a radio button; if ''no
date'' is selected, the date