Displaying 20 results from an estimated 400 matches similar to: "acts_as_taggable and paginate?"
2005 Dec 16
13
How to pass a collection to paginate?
There must be a better way to write this code:
@project_pages, @projects= paginate :project,
:per_page => 10,
:conditions => ["account_id = ?", account]
?!
If only I could pass the sub-collection
account = ...
@projects = account.project
to paginate, instead of letting it extract it with a find :all + sql
conditions
Alain.
--
Posted via
2006 Apr 16
11
Best way to sort categories w/ pager
Ahoy,
I made this pager,
" def list
@item_pages = Paginator.new self, Item.count, 10, @params[''page'']
@items = Item.find :all, :conditions => "category_id =
#{params[:condition]}",
:limit => @item_pages.items_per_page,
:offset => @item_pages.current.offset
@categories = Category.find_all
2006 Jul 14
5
Acts_As_Taggable Plugin multiple controllers.
I have Acts_As_Taggable Plugin working. I have a HR controller and a
sales controller.
I have a document in hr tagged whitepaper and a differnent document in
sales tagged whitepaper
when I am in hr I see the hr document tagged with whitepaper and not
the sale document (what I want). but if I click on the tag whitepaper
I return two documents, hr and sales. I just want to return the hr
document
2006 Jan 30
2
:condition not being applied
I am using acts_as_taggable and everything seems to be working except that
:condition => "tags_resources.portal_id=#{portal_id}"
is not being applied.
@resource_pages = Paginator.new self, Resource.find_tagged_with(:any => tag, :condition => "tags_resources.portal_id=#{portal_id}").length, 25, @params[''page''];
@resources
2006 Apr 01
3
acts_as_taggable, wrong number of arguments
Hello,
When I try:
@tagged_items = Problem.find_tagged_with :all => ''kuba''
or
@tagged_items = Problem.tags_count :limit => 100
I get this error:
ArgumentError in Volume#index
wrong number of arguments (2 for 3)
RAILS_ROOT: script/../config/..
Application Trace | Framework Trace | Full Trace
2005 Dec 19
6
custom find methods and pagination
i''ve got several methods in my models i use to find based on certain
criteria...i''ve done this so the controller code is less cluttered, plus the
DRY factor.
example:
class Foo < ActiveRecord::Base
def find_by_something(something)
find :all, :joins => ..., :conditions => ...
end
def find_by_something_else(something_else)
find :all, :joins => ...,
2006 Apr 16
7
table sorting
Ahoy,
I checked the API and did some forum searches but didn''t find anything
good on table sorting.
Is there a "railish" way to do this? My current method really is lacking
(i''m on like rails day 2)
<th><%= link_to ''Name'', :action => ''list'', :order => ''name'' %></th>
2006 Apr 20
5
acts_as_taggable patch 3866 needs some testing
DHH''s acts_as_taggable is now much more usable with this patch.
http://dev.rubyonrails.org/ticket/3866
This patch adds scoped finders, documentation, and tests:
# Get tags for all articles in a blog
@blog.articles.tags
# Get tags for articles in a blog published in the last year
@blog.articles.tags :conditions => [''published_at > ?'', 1.year.ago]
# Get related
2005 Sep 06
9
acts_as_taggable v4 - Tag Counting Anyone?
ThereĀ“s already a new version of the acts_as_taggable mixin available
and look what it is capable of now:
# Gets the top 10 tags for all photos
Photo.tags_count :limit => 10 # => { ''beer'' => 68, ''wine'' => 37, ''vodka''
=> ''22'', ... }
# Gets the tags count that are greater than 30
Photo.tags_count :count =>
2007 Jun 20
1
Count_by_content ??
Is there a count_by_content alternative to the find_by_content action?
This is because I''m wanting to do the following in my pagination method:
def list
# step 1: set the variables you''ll need
page = (params[:page] ||= 1).to_i
items_per_page = 20
offset = (page - 1) * items_per_page
# step 2: instead of performing a find, just get a count
item_count =
2006 Jul 24
4
Mongrel + BackgrounDRb + File Column = Upload Progress Bar?
Hi there,
I''ve been digging around trying to find some information (mostly examples)
on how one would handle a progress bar upload using BackgrounDRb and File
Column. I did read http://backgroundrb.rubyforge.org/ and Ezra''s blog of
course, but I still have a few questions.
I made a simple upload form (as a test) that is submitted to the
"upload_song" action.
def
2006 Feb 13
1
Paginate @member.items?
Is there a quick and easy way to paginate something
like @member.items (Member with has_many :items)?
Right now I do in the controller:
@item_pages, @member_items = paginate :item,
:conditions=>["member_id=?", @member.id],
:per_page=>25,
:order=>''datetime desc''
It''d be more DRY if this was possible:
@item_pages, @member_items = paginate
2006 Jan 10
5
Select Tag and Associations
Hi there,
I''ve been working on this for awhile and have finally decided to ask
for a little guidance.I have a slight problem trying to save a
selection.
I have two models:
A "Posting" has_many "Categories", and a "Category" belongs_to one
"Posting". With that said, in the posting model I have "has_many
:categories" and within the
2006 Apr 28
1
acts_as_taggable help
Ahoy, having a bit of difficulty w/ the acts as taggable GEM.
I was able to create a tagcloud, but now i want to filter items by tags.
in my controller i have
def show_tagged_with
<-- snip snip -->
@items = Item.find_tagged_with( :any => params[:tag_name])
@categories = Category.find_all
@tag_name = params[:tag_name]
@tagged_items = Item.tags_count(:limit
2006 Jan 16
4
Creating two records at once
Hi there,
I have a User model and a Profile model. A user has_one profile, and a
profile belongs_to a user. The profile model contains a user_id column
as the foreign key.
The problem comes in when I want a user to register. In the
user_controller I have a method that creates the user. I also want the
profile model to be filled in with the appropriate user_id foreign key
(I don''t care
2006 Jun 02
1
Sorting records from acts_as_taggable plugin
I am using the acts_as_taggable plugin, which works rather nicely by the
way. My question is this: When using find_tagged_with, how do I sort the
resultant data? It is currently sorting based on the "id" of the record.
For instance, I have posts, with tags. If I want to find all posts
tagged with "RubyOnRails" it displays them, but not in chronological
order, they are
2006 Feb 23
6
Search Forms with Pagination
Hi there everyone, I''ve recently moved to RoR and am still struggling
with the basics of what used to be second nature in php, so on with
my question:
I have a database with products, and I need to create a search form
that paginates the results. What I have so far in my controller is:
def list
# If the values are nil, then set them, otherwise wrap them in %
# Also,
2006 May 23
2
In Place Editor Fields and Safari
Hi,
Does anyone else have any problems with Safari and in place editor fields?
I''m specifically talking about trying to save a null value in a text box. In
Firefox/IE/Camino/etc... saving a null value from an in place editor works
how it''s supposed to. If the value is null, then ''click to edit'' is
displayed. However with Safari when a null value is saved,
2006 Jan 22
3
Formatting input/output of a text box
Hello,
What''s the best way to handle formating of a text_area? I have a text_area
in my rails app where people can leave comments and I''d like to
automatically convert the line breaks into <br /> tags, or just simply wrap
a whole paragraph in <p></p> tags. I''m currently doing the following in my
comments controller to insert line breaks when the user
2006 May 19
1
acts_as_taggable pagination
Im using the acts_as_taggable plugin, is there a way to paginate the
find_tagged_with results?
--
Posted via http://www.ruby-forum.com/.