Displaying 20 results from an estimated 600 matches similar to: "Custom Autocomplete Field - Making a field lowercase"
2007 Jul 26
3
Spec for validation plugin
Hi,
I''m writing a specification for a model called Location which has a
post_code attribute which should be a valid UK postcode. I''m using the
http://svn.designbyfront.com/rails/plugins/validates_as_uk_postcode/
validates_as_uk_postcode plugin to handle the validation but I''m not sure
how I should properly specify my model.
Heres the model code:
class Location <
2010 Jan 07
1
text field with autocomplete
Hey everybody,
I am using text field with autocomplete in my posts new action. That
works great.
Response from autocompleter in firebug:
POST http://localhost:3001/posts/auto_complete_for_tag_name 200 OK 68ms
but if I use the same in edit action it fails and I got this error.
POST http://localhost:3001/posts/781/auto_complete_for_tag_name 404 Not
Found 81ms
*** POSTS controller: ***
def
2007 Jan 15
3
Wrong total_hits when using conditions in find_by_contents
I don''t know if this is a bug, or wanted behavior, but for me it was a
pain in... So here''s the problem + a bugfix.
Lets say you have a model "Article" with the following fields: title,
visible - and these records
[code]title, visible
ferret talk, 1
ruby talk, 0
ruby on rails, 1
lets talk about ruby, 1[/code]
If I let Article act as a ferret, and do:
result =
2006 Aug 17
1
find_by_contents fails with :include option
find_by_contents will fail if you specify :include in the find_options
parameter. The problem is on line 313:
313: conditions = [ "id in (?)", id_array ]
314: # combine our conditions with those given by user, if any
315: if find_options[:conditions]
316: cust_opts = find_options[:conditions].dup
317: conditions.first << " and " << cust_opts.shift
318:
2007 Sep 30
2
Outputing to the browser, how?
Hello,
I''m writting some helper methods to write forms, so I have this working code:
class TableFormBuilder < ActionView::Helpers::FormBuilder
["file_field", "password_field", "text_field"].each do |name|
define_method(name) do |label, *args|
@template.content_tag(:tr,
@template.content_tag(:td,
@template.content_tag(:label,
2007 Jul 18
5
Strange search result with conditions in find_by_contents
Hi, guys:
Strange search result with conditions in find_by_contents!
first of all, i''ve installed the acts_as_ferret to my project vender
folder by ''ruby script/plugin install
svn://projects.jkraemer.net/acts_as_ferret/tags/stable/acts_as_ferret''
in my SearchController
def searchforum
if !params[:doSearch].nil?
if params[:searchTerms].nil? || params[:searchTerms] ==
2007 May 02
4
Wrong total_hits when using conditions in find_by_contents
In my model Topic:
acts_as_ferret({ :fields => {:username => {:store => :yes, :boost =>
30}, :subject => {: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
2007 Feb 28
5
How to use find_options in multi_search
Hello everyone,
I''m using multi-search to search in some attributes of two classes. One
of the attributes is the id of the customer. For each multi_search I
want to do a give the id of the current customer as a parameter. This
should only return results for the given customer.
My current code looks like this:
Folder.multi_search(@search_query, [Myfile])
I noticed in the API you can
2006 Jun 02
2
pass extra value through text_field_with_auto_complete?
Hi,
I''m wondering if it is possible to pass an extra value (which I will
use to further restrict my query) using text_field_with_auto_complete?
Any suggestions would be appreciated!
-Mike
2006 Dec 05
1
Using render inside a FormBuilder (EdgeRails)
I''m using the latest trunk of 1.2-ish, and I''m wondering how to do what
I want to do. I am using a form_for :builder I wrote, simply called
TableFormBuilder after the rails cookbook, and want to be able to
present help icons automatically. I want these icons to appear next to
form fields I am rendering.
For example, I have this method in helpers/table_form_builder.rb:
# This
2007 Aug 14
0
ActiveRecord and attributes returned
I am working with a couple of queries where I need to get the
latitude and longitude from a
table based on the zip code I pass to it.
@geoLatitude = Geodemog.find_by_sql["select latitude from geodemogs
where post_code = ?", @query]
I want to:
1) Make sure this is the best way to do this since the table holds a
lot of records
2) Am I setting this up properly to be able to send a
2006 Dec 28
13
Sorting/Ordering Search Results
Hello All,
I am having an issue with AAF and sorting results of a search. Right
now, I have results being split onto pages of 10. The results are being
sorted alphabetically, but not across multiple pages - it''s just sorting
the 10 it pulls down on each page. I noticed another post from April
regarding this same issue (http://www.ruby-forum.com/topic/62993#66934)
where the issue was
2008 Jan 03
0
Problem (with fix?) for passing :multi => [ ]
Max, seems to me that your code would help to make things more robust,
if it''s a public API then it should stand up to a little abuse in ways
not intended. maybe more of an enhancement than a bug fix, but a fix
just the same.
Max Williams wrote:
> I''m using acts_as_ferret, passing through multiple classes using :multi
> and also some conditions. The way i''m
2008 Dec 07
0
boolean button helper
I don''t have a blog, but wanted to share this little bit of code with
other semi-beginners like myself who are still learning to take
advantage of rails features.
Selecting an attribute with a boolean switch is a common pattern in
forms. You can do it with a check box, but radio buttons are more
expressive in some situations and better convey to the user that they
are making a mandatory
2006 Feb 27
6
One to Many example... please!
Hi,
I am pulling my hair out trying to work out how to put together what
should be a simple app in rails. The app is to CV''s so I have a table of
CV''s and each CV can have multiple skills. Skills are in a 2nd table
below;
CREATE TABLE cvs(
id INT not null AUTO_INCREMENT PRIMARY KEY,
first_name VARCHAR(30) not null,
family_name VARCHAR(30) not null,
email
2006 Oct 02
6
Strange Sorting Issues
Hi there,
I''m having some strange sorting stuff goign on. Here''s my search method:
sort_fields = []
sort_fields << Ferret::Search::SortField.new("name",
:reverse => :false)
@results = Listing.find_by_contents @search_criteria, :limit => :all,
:sort => sort_fields
page = (params[:page] ||= 1).to_i
items_per_page = 9
offset = (page - 1) *
2013 Sep 06
0
[PATCH RESEND v3 0/7] Enable Drivers for Intel MIC X100 Coprocessors.
Whitespace neatening...
Multiline statement argument alignment.
Argument wrapping.
Use kmalloc_array instead of kmalloc.
---
drivers/misc/mic/card/mic_virtio.c | 17 ++++---
drivers/misc/mic/card/mic_x100.c | 4 +-
drivers/misc/mic/host/mic_debugfs.c | 91 ++++++++++++++++++-------------------
drivers/misc/mic/host/mic_fops.c | 6 +--
drivers/misc/mic/host/mic_intr.c | 37
2013 Nov 06
6
Feature: make capitalization optional in *humanize*
According to the documentation<http://api.rubyonrails.org/classes/ActiveSupport/Inflector.html#method-i-humanize> of
ActiveSupport::Inflector:
*humanize*(lower_case_and_underscored_word)
Capitalizes the first word and turns underscores into spaces and strips
a trailing “_id”, if any.
* Example: humanize("employee_salary") # => "Employee salary"*
I would
2009 Jul 06
0
[PATCH server] UI for accumulated uptime for VMs. (revised2)
This revised version of the patch incorporates jguiditta's sorting fix as well as some other changes required to make this work fully on the cloud UI side.
---
src/app/controllers/pool_controller.rb | 2 +-
src/app/controllers/resources_controller.rb | 4 +++-
src/app/controllers/smart_pools_controller.rb | 7 +++----
src/app/helpers/application_helper.rb | 14
2009 Jul 02
1
[PATCH server] UI for accumulated uptime for VMs. (revised)
This revised version of the patch incorporates jguidditta's sorting fix as well as some other changes required to make this work fully on the cloud UI side.
---
src/app/controllers/pool_controller.rb | 2 +-
src/app/controllers/resources_controller.rb | 4 +++-
src/app/controllers/smart_pools_controller.rb | 5 ++---
src/app/helpers/application_helper.rb | 14