Displaying 11 results from an estimated 11 matches for "_item".
Did you mean:
item
2006 Jan 20
1
Update HTML Element with Ajax
I have following files.
list.rhtml
-----------------------
<ul id="items">
<%= render(:partial => ''item'', :collection => @items) %>
</ul>
_item.rhtml
------------------------
<li id="<%= item.id %>" >
<%= item.name %>
<%= item.body %>
</li>
edit.rjs
------------------------
page.replace_html @item.id, :partial=>''item''
if I call /items/list I will get
<ul id="items...
2006 Apr 12
1
Dynamically updating list
hi every body. i am try to do example of agil books.dynamically updating list of chapter 18.
1)this is my code for controller----
class ListnoajaxController < ApplicationController
def index
@items = Item.find_recent
end
def add_item
item = Item.new(params[:item_body])
render(:partial => "item", :object => item)
end
def item
end
end
2)the code for item class in app/model
class Item < ActiveRecord::Base
attr_reader :body
attr_reader :posted_on
FAKE_DATABASE = []
def initialize(body)
@body = body
@posted_on =...
2006 Feb 14
2
Inline list editing with RJS: best practices
...wanted to get the community opinion on the best way to use partials and
inline list (<li>) editing.
I have a very common scenario where a list is rendered:
--- index.rhtml ---
<ul>
<%= render :partial => ''item'', @collection => @items %>
</ul>
--- _item.rhtml (simplified) ---
<li id="item_<%= item.id %>">
<div id="show_item_<%= item.id %>">
<%= h item.name %>
<%= link_to ''edit'', . %>
</div>
<div id="edit_item_<%= item.id %>" style="...
2005 Oct 15
1
Partials and controllers
Newbie question:
From a _form.rhtml file I have:
<%= render(:partial => ''item'', :collection => @items) %>
In _item.rhtml I have:
<% @tullt = h(item.body) %>
<%= @itemdb = Group.find(:all,
:conditions => "id = ''#{@tullt}''").map {|u| [u.name] }
%>
<%= @tullt %
I think it would be better to put this code in a controller for this
partial....
2006 Mar 08
4
ajax with tables
There may be an easy solution, but I just can''t seem to get this to work...
I''m using tables for part of my site, as they contain a lot of rows and
columns full of financial data, so just working with div''s and dd''s... etc,
won''t do.
My table structure is pretty simple, as follows:
=================
<table id="items">
<tr>
2006 Mar 15
4
[NQ] How to set an initial FK for a new item of something?
Hi all,
running into a little problem here. I''ve a list of things
with a "New thing" link beneath it. When you click that link,
obviously, a new thing shall be created. Now, that works pretty
fine for things that don''t have foreign keys, but for things that
do it crashes, since there is not yet a thing.other_thing.name
available.
I suspect you can somewhere in
2006 Aug 03
5
DRYing up the view
...=> item },
:confirm => "Delete: #{item.name} ?", :post => true %></td>
</tr>
<% end %>
...
As you see I also need to render :partial => ''list'' on every iteration
to add some custom information for a particullar controller.
districts/_item.rhtml
...
<td><%= item.name %></td>
<td><%= item.region.name %></td>
...
As you may already guess I''m getting ActionController::DoubleRenderError
So is there better way of doing this, or maybe some other function
method such as: render_and_not_raise_Do...
2006 Jan 06
2
How do I reference eagerly loaded Models in the View?
...39;'m getting a
tonne of additional queries.
[first, the domain:
WorkOrders has_many: WorkOrderItems
&&
WorkOrderItems belongs_to :WorkOrder
WorkOrderItems belongs_to :ProductsAndServices
secondly, the controller looks like:
@work_order = WorkOrder.find(params[:id])
@work_order_items = @work_order.WorkOrderItems.find(:all, :include
=> [:WorkOrder, :ProductsAndServices ] )
(you''ll note that I''m eagerly loading the work_order from the
work_order_item - that''s because the WorkOrderItem model references its
work_order for some processing - see "...
2008 Apr 23
0
Passing a hidden field to insert_html
...eezes.
[code=helper.rb]
def add_link(name)
link_to_function name do |page|
page.insert_html :bottom,:partial, :partial => ''item'', :object
=> Item.new(:item_property => "Some text") #adding this parameter
creates a problem
end
end[/code]
[code=_item.rhtml]
...
<%= f.hidden_field :item_property, :index => nil %>
<%= f.text_field :item_text, :index => nil %>[/code]
[code=index.rhtml]
<%= add_link "+Add Field Dinamically" %>[/code]
Does anybody know how to define a property of a new object in this
context? I'...
2006 Dec 20
4
undefined method `fullname' for #<User:0x357e380>, BUT works on first view?
...Columns (0.000286) SHOW FIELDS FROM taggings
Tag Load (0.000444) SELECT tags.* FROM tags INNER JOIN taggings ON
tags.id = taggings.tag_id WHERE ((taggings.taggable_type = ''News'') AND
(taggings.taggable_id = 13))
Tag Columns (0.000187) SHOW FIELDS FROM tags
Rendered /news/_item (0.00561)
Comment Load (0.000301) SELECT * FROM comments WHERE
(comments.commentable_id = 13 AND comments.commentable_type = ''News'')
Comment Columns (0.000248) SHOW FIELDS FROM comments
User Columns (0.000345) SHOW FIELDS FROM users
User Load (0.000359) SELECT * FR...
2009 Apr 19
19
Controller spec: testing that scope is set
In a Rails controller I set the scope on a model class in an around
filter. I have defined expectations on the model classes, and ideally, I
would add a further expectation for the scope. Is this already possible
in some way? How would I go about adding support a scope expectation?
Michael
--
Michael Schuerig
mailto:michael at schuerig.de
http://www.schuerig.de/michael/