Displaying 20 results from an estimated 10000 matches similar to: "newbie question, adding conditions to collection of sql objs"
2006 Aug 07
4
Problem with Pagination
Hi Guys,
I am trying to paginate the results from a search. When I use actual
constants in the search conditions, it works fine:
def query
@k2_result_pages, @k2_results = paginate (:k2_results,
:conditions => [''e_date >= ? AND
e_date <= ?'', ''2006-07-12'', ''2006-08-12''],
2006 Apr 26
3
catch all error for incorrect urls etc
Hi,
I am changing a very standard old school website to rails. When I make
the change to rails, all of the old urls will not be valid. If a
person has a bookmark to an old web page I would like them to be
directed to the front page of the new website www.domain.com. How do I
do this? Do I do something in routes.rb?
Thanks,
Peter
2006 Aug 04
5
A couple of ferret 0.9.4 exceptions
Hi Dave,
I am using ferret at my site http://gifthat.com and I just had a few
exceptions pop up. I don''t have a way to reproduce them, but my site
just was listed on lifehacker.com and these issues have popped up
under multiple concurrent users (only twice though which I think isn''t
too bad). I am using two lighttpd instances both with read/write
access to the index:
1) Error
2006 May 01
12
pagination in acts_as_ferret
I''m just wondering where I would put the pagination for search results
when using "acts_as_ferret".
At the moment my search code is..
def search
@query = params[:query] || ''''
unless @query.blank?
@results = Tutorial.find_by_contents @query
end
end
Cheers
SchmakO
--
Posted via http://www.ruby-forum.com/.
2006 Mar 17
4
using ajax and layouts
Hi.
I copied the layout-example from agile web dev. in rails. When I want
to use ajax to create a search field including
<head><%= javascript_include_tag "prototype" %></head>
does''nt work when I include the line in my
app/views/layout/demo.rhtml. Name of controller is demo_controller.rb.
The search-field is in app/views/demo/observer.rthml and I have to
2006 Jul 07
5
link_to: link is missing id
I''m using a legacy table, where the unique id is not ''id''
I have a Model class like the following:
class Article < ActiveRecord::Base
set_primary_key "ARTICLE_ID"
end
however, using a link_to like the following (modified scaffolding),
the link has no id value:
<% for article in @articles %>
<tr>
<% for column in
2006 Jul 05
1
Routing via function
I have a route that depends on a username being passed in the URL, such as:
map.connect '':username'', :controller => ''user'', :action => ''show''
Is there a way to perform a lookup of the username before matching on
this route?
I am hoping to be able to do something like this (completely made up):
:requirements => {:username =>
2006 Aug 02
4
applying conditions to ActiveRecord call in model.rb
If @c is an instance for the User class and lets say I want to call
@c.pictures, which would be the user''s pictures.
How can I setup up RoR so that I could append the condition
"status=''available''" to the conditions arguments EVERYTIME .pictures is
called. This way I can only call available pictures
Is there some kind of filter I can apply to the
2006 Aug 02
4
Linking to the paginated items from search results.
Using Ferret for searching, I''ve got results that I need to link to.
Which is fine, except for that they''re displayed on paginated pages
using Rails paginate function - so it''s not like I can''t get it from the
database or anything else. Anyone have any ideas on how to go about
this? It''s not so much a coding problem as a theory problem, and I
2006 Apr 03
6
Installing Ferret locally on TextDrive
I would like to give the 0.9.0 version of Ferret a try on my
application hosted on TextDrive. I am currently running on the 0.3.2
version there.
Does anyone have any tips on installing it locally there? I know just
enough about Ruby gems to get by... but I am thinking it could be as
easy as passing a -i flag to specify the install location for ferret.
Then, the only thing I am not sure about
2006 Jan 24
4
How to filter an activerecord find_all...
I have a nice hierarchical table structure like this:
divisions
has_many groups
groups
belongs_to division
has_many subgroups
subgroups
belongs_to group
has_many units
units
belongs_to subgroup
I have a report which is based on units, but i want to be able to filter
the units by which subgroup, or which group, or which division. I also
want to sort them by division.name,then group.name,
2006 May 23
2
CSS not applied using apache
Hi all,
I have recently configured rails to run under apache. I''ve tried adding
a stylesheet using the stylesheet_link_tag function, however when I load
the page I do not see the affects of the stylesheet. The URL to the
stylesheet looks correct when viewing the page''s source. Has anyone
else seen this problem?
Thanks for your help,
Chris
--
Posted via
2006 May 30
3
Rebuild Indexes Issue
Hi,
I have some code to rebuild my ferret indexes but occasionally some
stale documents remain in the index even after rebuilding. The only
way I could find around this is to manually delete the index files
from the filesystem. Here is the code I have for rebuilding one of my
indexes for Gifts:
# delete existing entries
INDEX.size.times {|i| INDEX.delete(i)}
gifts =
2006 Jul 31
2
Wizard-like multi-page transaction
Hello
Is it possible to create something like wizard with database
transactions, so transaction would begin on page one, then on page two,
three... etc. there would be some data altered in the database and then
on the last page the transaction would be committed or rolled back?
thx
Zvonko
--
Posted via http://www.ruby-forum.com/.
2006 Mar 30
6
Global Method Declaration?
Is there a place where I can put a method that can be accessed in both
views and controllers?
Here''s the situation, maybe someone can suggest a better way to go about this:
I created my own custom login system with email verification and user
roles (basically, I tinkered around with SaltedHashLoginGenerator
until I finally gave up and wrote my own). One role, of course, is an
admin
2006 Jun 29
13
find_by_contents not returning SearchResults?
The acts_as_ferret documentation says find_by_content returns an
instance of SearchResults, but I see this error when I try to use the
results.
undefined method `total_hits'' for []:Array
Here is the link to the documentation:
http://projects.jkraemer.net/acts_as_ferret/rdoc/classes/FerretMixin/Acts/ARFerret/ClassMethods.html#M000010
But here is the actual code:
result =
2006 May 04
5
How to install Ferret to get the best performance
Hey all,
After dabbling with ActiveSearch, we''re coming back around to take
another look at Ferret.
ActiveSearch slowed to a crawl after indexing about 20k documents, each
20 lines each.
This time we may attempt to create multiple Ferret indexes (isolating
each organization''s data individually), since we eventually could have
upwards of 20k documents for some
2006 Apr 05
7
Archive monthly count for blog
I am creating a blog to learn ruby on rails.
from the layout page i pass all the posts as a collection to
_archive.rhtml
<%= render :partial => "archive", :collection => @archive %>
On _archive.rhtml i have access to the collection. I am then gone to
render partial another page _archivecount.rhtml to display the number of
posts for each month.
Can anyone give a clue
2006 May 23
1
Re: Wierd pagination problem - Unknown options:
> Unfortunately I still get the same error. Here is my code now (the
> commented line works):
>
> def list
> @upload_pages, @uploads = paginate(:uploads, :per_page =>
> 20, :order
> => ''id'')
> # @upload_pages, @uploads = paginate(:uploads, :per_page => 20)
> end
You may have an older version, try using the order_by clause
2006 Feb 18
1
sql logic is killing me
I know my thinking is sloppy.
I want to know how many clients currently in my facility are male...
My facilities_controller.rb
def list_fac
@placement_pages, @placements = paginate(
:placements,
:conditions => ["placements.facility_id = ?",
params[:facility_id] ],
:include => [:facility, :client],
:order_by => ''facilities.name,