search for: default_options

Displaying 20 results from an estimated 53 matches for "default_options".

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/.
2007 Oct 03
3
Pagination problem with acts_as_ferret
...ery, [ WorkProfile, SchoolProfile ], :page => (params[:page]||1)) @pages = pages_for(@total) unless @query.blank? @results = UserProfile.find_by_contents @query end end model: def self.multi_search(q, additional_models = [], options = {}) return nil if q.nil? or q=="" default_options = {:limit => 1, :page => 1} options = default_options.merge options # get the offset based on what page we''re on options[:offset] = options[:limit] * (options.delete(:page).to_i-1) # now do the query with our options results = UserProfile.find_by_contents(q, o...
2007 Sep 05
1
AAF and DRb with highlighting
...orking with DRb? I''ve given up on searching on Google, I''m getting no results that are actually helpful. def self.find_storage_by_contents(query, options = {}) # Get the index that acts_as_ferret created for us index = self.aaf_index.ferret_index results = [] default_options = {:limit => 10, :page => 1} options = default_options.merge options options[:offset] = options[:limit] * (options[:page].to_i - 1) # search_each is the core search function from Ferret, which Acts_as_ferret hides total_hits = index.search_each(query, options) do |hit, score|...
2006 Oct 22
3
Date Helpers?
Does anyone have any ideas off the top of there head how to easily construct a date helper as one would see in Rails? Thanks, Michael Gorsuch http://www.styledbits.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/camping-list/attachments/20061022/7dda5a52/attachment.html
2007 Feb 04
10
[AAF] remote indexing via DRb with acts_as_ferret
Hi! Aaf trunk has undergone several major refactorings the last days, with the result that you can now transparently switch your app from local to remote indexing and back :-) If you plan to scale your app to more than one physical machine, or if you have problems with corrupted indexes and the like under high load, you really should give this a try. I wrote some documentation to get you
2007 May 02
4
Wrong total_hits when using conditions in find_by_contents
...ect => {:store => :yes, :boost => 20}, :body => {:store => :yes, :boost => 10}}, :remote => true }, { :analyzer => Ferret::Analysis::RegExpAnalyzer.new(/./, false) }) def self.full_text_search(q, options = {}, find_options = {}) return nil if q.nil? or q=="" default_options = {:limit => 10, :page => 1} options = default_options.merge options # get the offset based on what page we''re on options[:offset] = options[:limit] * (options.delete(:page).to_i-1) # now do the query with our options results = Topic.find_by_contents(q, options, find...
2009 Mar 15
5
Setting DEFAULT_FIELD_OPTIONS in Rails 2.3
Hi, I''m having some trouble overriding/defining the default_field_options constant without raising a warning. I''ve tried adding the code to do it in an initializer but that produces a warning (because the constant is already frozen), after some googling I found a recommendation to put it in the environment.rb file but that then that throws uninitialized constant ActionView
2007 May 24
2
Missing RspecScaffoldGenerator
...=========================================================== --- rspec_scaffold_generator.rb (revision 2022) +++ rspec_scaffold_generator.rb (working copy) @@ -1,4 +1,4 @@ -class RspecResourceGenerator < Rails::Generator::NamedBase +class RspecScaffoldGenerator < Rails::Generator::NamedBase default_options :skip_migration => false attr_reader :controller_name,
2006 Nov 20
22
Index only partially built
I have an application which I''m running using Mongrel and Apache as described here http://www.napcs.com/howto/rails/deploy/. I have a model Person which I am attempting to use acts_as_ferret with. When I first try to do a search the index begins to get built but it its fails halfway through with the following error in the browser: === Proxy Error The proxy server received an invalid
2006 Apr 13
2
running rails on Linux
.../pkgs/ruby-1.8.4/lib/ruby/gems/1.8/gems/rails-1.1.2/bin/rails which I presume is what is executed when I''m supposed to type: % rails /path-to-my-app But this rails file is not executable! Or when I type % ruby rails /path-to-my-app I get errors: ./../lib/rails_generator/options.rb:33:in `default_options'': undefined method `write_inheritable_attribute'' for Rails::Generator::Base:Class (NoMethodError) from ./../lib/rails_generator/base.rb:51 from /local/pkgs/ruby-1.8.4/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'' from ./../l...
2007 Jul 18
5
Strange search result with conditions in find_by_contents
...1)) @total, @topics = Topic.full_text_search(params[:searchTerms], {:page => (params[:page]||1)}, {:conditions => @conditions}) @pages = pages_for(@total) end end end in my model Topic: def self.full_text_search(q, options = {}, find_options = {}) return nil if q.nil? or q=="" default_options = {:limit => 10, :page => 1} options = default_options.merge options # get the offset based on what page we''re on options[:offset] = options[:limit] * (options.delete(:page).to_i-1) # now do the query with our options results = Topic.find_by_contents(q, options, find...
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
2001 Mar 10
0
patch to add device-option to ogg123 rc file
Below is a patch for vorbis-tools-1.0beta4 ogg123. It adds support for using the rc file (like /etc/ogg123.rc) for configuring the device-options. In addition, comments can be used (when they start a line). My ~/.ogg123rc: default_device=oss default_options=dsp:/dev/audio Please share your comments. Jeremy C. Reed http://www.reedmedia.net/ diff -u vorbis-tools-1.0beta4/ogg123/ao_interface.c vorbis-tools-1.0beta4-modifdiff -u vorbis-tools-1.0beta4/ogg123/ao_interface.c vorbis-tools-1.0beta4-modified/ogg123/ao_interface.c --- vorbis-tools-1.0be...
2006 Jul 31
9
Multiple Pagination
I have the following: def index begin @restaurant_pages, @restaurants = paginate :restaurants, :order => (params[ :sort ] || "name"), :per_page => 2 @cuisines = Cuisine.find_all rescue redirect_to :action => :index end end # sort by cuisine def
2006 Jul 27
0
Override default Rail Generator options
I''ve been hacking at this for hours now. I found a method called ''default_options'' in Rails::Generator::Base. By default it calls ''default_options :collision => :ask, :quiet => false''. I''d like to over ride it with my own options. It works if I just change it in the Rails source but thats not a real solution. Is there any way to set...
2006 Jun 10
0
Dynamic file paths in FileColumn
...ptions[:pub]) options[:tmp_base_dir] ||= File.join(options[:store_dir], "tmp") options[:base_url] ||= options[:web_root] + File.join(attr) FileUtils.mkpath([ options[:store_dir], options[:tmp_base_dir] ]) options end ... def file_column(attr, options={}) options = DEFAULT_OPTIONS.merge(options) if options my_options = FileColumn::init_options(options, attr.to_s) end ... end Thanks in advance -- Posted via http://www.ruby-forum.com/.
2006 Feb 27
0
Simple Namespace Question
...ately sitting in: /vendor/rails/actionpack/lib/action_view/helpers ======================== module ActionView module Helpers module PaginationHelper def pagination_links_remote(paginator, page_options={}, ajax_options={}, html_options={}) name = page_options[:name] || DEFAULT_OPTIONS[:name] params = (page_options[:params] || DEFAULT_OPTIONS[:params]).clone pagination_links_each(paginator, page_options) do |n| params[name] = n ajax_options[:url] = params link_to_remote(n.to_s, ajax_options, html_options) end...
2006 Nov 08
0
Paginating a fetched resultset problems with next/previous
...queries http://www.bigbold.com/snippets/posts/show/389, all seems to work fine but theres one thing, when i hit the next link it show nothing, i mean it only shows the first page, here is the code im using: #application.rb----------------- def paginate_collection(collection, options = {}) default_options = {:per_page => 10, :page => 1} options = default_options.merge options pages = Paginator.new self, collection.size, options[:per_page], options[:page] first = pages.current.offset last = [first + options[:per_page], collection.size].min slice = collection[first...last]...
2009 Feb 03
1
Passing args to generator
I have some default_options in generator and when I wish to change they value with --option_name I get only logical true instead of string ... default_options :option_name => "Some string" ... def add_options!(opt) opt.separator '''' opt.separator ''Options:'' opt.on("--...
2012 Jan 25
0
Paperclip preserve files ?
...stored. I am using the option :preserve_files => true. If I keep the above option in model it will be access to all the objects of the model. I need to restore only for limited objects. for example def destroy if obj.restore_attachment Paperclip::Attachment.default_options.merge!(:preserve_files =>true) end Paperclip::Attachment.default_options.merge!(:preserve_files =>false) obj.destroy end If you observe depending on the attachment property I am setting the option. obj.restore_attachment = true obj.save...