Displaying 7 results from an estimated 7 matches for "itemcontroller".
Did you mean:
itemscontroller
2007 Sep 08
2
"Common action" for a controller
Sorry if this has been asked before; it seems like a simple problem.
I have a controller called ItemController which displays information
about specific items to a user on various pages. The routing looks like
"items/:item/:action". Is there any way to automatically look up the
:item in the items table (it''s just an ID).
I tried:
before_filter { @current_item = Item.find(:first, @params...
2005 Oct 15
1
Partials and controllers
...b = 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. I made the following item_controller.rb file for this:
class ItemController < ApplicationController
def index
@tullt = h(item.body)
@itemdb = Group.find(:all,
:conditions => "id = ''#{@tullt}''").map {|u|
[u.name] }
end
end
But this doesn''t work (I guess for som obvious reason, I just ha...
2006 Apr 24
7
Can you improve on this code?
# File app/models/timesheet.rb, line 27
27: def totals
28: totals = Hash.new
29: totals["Monday"] = totals["Tuesday"] = totals["Wednesday"] =
totals["Thursday"] = totals["Friday"] = totals["Saturday"] =
totals["Sunday"] = totals["Totals"]=0 #initialise all to zero
31:
32: for item in
2006 Jun 21
7
acts_as_taggable and paginate?
Hi there,
I''ve been trying to paginate over a list of members that all share a tag in
common using the acts_as_taggable plugin. The regular way of paginating over
a collection doesn''t seem to work with acts_as_taggable. Here''s what my
method looks like that takes in a tag name, finds all the members that share
the tag and then displays all the members. Nothing too fancy
2006 Feb 10
0
ajax form submission and updating multiple divs
I''m not sure if this is even possible, but here is my current method:
class Item < ActiveRecord::Base
def self.generate(name)
Item.create(:name => name) || nil
end
end
class ItemController < ActionController::Base
layout "application"
def index
@items = Item.find(:all)
end
def create
if @request.method ==:post
name = @params[:name] || ''''
if name != ''''
if Item.generate(name)
@message = &q...
2006 Feb 14
0
Best practices for handling associations in ctrlrs/views
...thought was to use AJAX for this.
Assuming for a moment that this is the desired approach, I can see
several ways to implement it. For example, the methods required to
create a new attribute or delete an existing one would be called by
AJAX. I could thus
1) implement the action methods on the ItemController object, or
2) implement the action methods on the AttributeController object.
Similarly, the "view" logic for attributes associated with an item will
be invoked for each attribute that belongs to an item. This logic could:
1) be written as a partial, and rendered inside of logic within...
2005 Oct 06
8
accessing extra request parameters
hi all,
how are other people passing and accessing ''get'' parameters from their apps?
what is the best way to do it?
ie:
www.example.com/controller/action/id/extra/extra2/ ??
or
www.example.com/controller/action/id/~extra/extra2/
or what ever....
are there built in methods for passing and accessing extra parameters?
thanks for your suggestions
-felix