Displaying 20 results from an estimated 4000 matches similar to: "bug or "feature"?"
2007 Mar 31
3
Sorting issues, can anyone help me?
I have this model:
class Post < ActiveRecord::Base
acts_as_ferret :fields => { :title => {:boost => 2},
:description => {},
:url => {},
:rank_sort => {:index =>
:untokenized_omit_norms, :term_vector => :no},
2008 Jun 10
5
Rails params parsing bug?
I have a form that sends the following query string to my Rails
controller:
transaxion[category_association_attributes][][category_id]=2&
transaxion[category_association_attributes][][amount]=12&
transaxion[category_association_attributes][][category_id]=1&
transaxion[category_association_attributes][][amount]=8
But ActionController parses it as:
2009 Sep 25
12
uniqueness validation perplexity
I want to write a validate routine to check to enforce that a position
must be unique in a category. (In another category, it doesn''t have
to and shouldn''t need to be unique.) I write this code which works
happily for new items:
def position_in_category_not_unique
@items = Item.find( :all, :conditions => [ "category_id = ? AND
position = ?", category_id,
2007 Jul 02
8
Strange intermittent no search results problem
Hello,
First the specs:
ruby 1.8.6, rails 1.2.3, ferret 0.11.4, mongrel 1.0.1, mongrel_cluster 0.2.1
And the model''s aaf config:
# Ferret search engine
acts_as_ferret({:fields => {:name => {:boost => 10},
:summary => {:boost => 2},
:body => {:boost => 1, :store =>
:no},
2007 Jul 25
17
DRb not starting
Hi,
I have my Model as follows:
class Mutation < ActiveRecord::Base
acts_as_ferret ({:fields => {:description=>{},
:product_id=>{:index => :untokenized},
:product_description=>{},
:product_label_description=>{},
:product_label_free=>{},
:product_product_id_supplier=>{},
:product_description_supplier=>{},
:supplier_description=>{},
:pub_date_sort
2010 Mar 27
2
Shorter Rails 3 routes
Hi,
I have a small blog application, and I would like to shorten its routes.
Here they are:
Blog::Application.routes.draw do
resources :categories do
resources :articles do
resources :comments
end
end
A rake routes command produce the following lines:
GET
/categories/:category_id/articles/:article_id/comments(.:format)
2006 Aug 19
3
Special ruby language for describing sql conditions
I was brainstorming today about a smooth way to define conditions in an
sql query, when the numbers of attributes increase, so does the uglyness.
So instead of passing a hash, I thought you could specify the conditions
directly in code.
I hacked together some example code which actually turned out to work.
The result is concise and pretty beutiful.
def search(params)
Ad.find(:all) do
2007 Sep 20
5
Ferret DRB, UTF-8, Mongrel
I have spent days trying to figure out how to get UTF-8 working with my
site.
Here''s my environment:
Linux version 2.6.16.29-xen_3.0.3.0
Ruby 1.8.4 (2005-12-24 [i386-linux]
Rails 1.2.3
mongrel (1.0.1)
mongrel_cluster (1.0.2, 0.2.1)
ferret (0.11.4)
acts_as_ferret stable plugin
Ferret DRB server
When I don''t use an analyzer with my acts_as_ferret declaration,
everything works
2005 Nov 22
11
Building a conditions clause (for find) of multiple optional params?
I want to be able to find items according to various params - category_id, member_id, type_id,
rating, etc. What I have now is something like:
if(@params[''category_id''])
@items=Item.find(:all, :conditions=>["category_id=?", @params[''category_id''])
elsif(@params[''category_id''] and @params[''member_id''])
2006 Jan 23
5
Undefined method error
Hi everybody,
Small problem. I get this error:
undefined method `all_categories'' for BlogCategory:Class
Code of BlogCategory class is:
class BlogCategory < ActiveRecord::Base
has_and_belongs_to_many :blog_posts
validates_presence_of :name
validates_uniqueness_of :name
# Return all categories ordered by name
def all_categories
find :all, :order =>
2008 Nov 10
3
to_xml and helper methods
Hi,
I have an array with objects and I want to generate an XML like:
<objects>
<object>
<category_id>1</category_id>
<helper-method>result 1</helper-method>
</object>
<object>
<category_id>2</category_id>
<helper-method>result 2</helper-method>
</object>
</objects>
The helper
2006 Jul 30
1
Doubt on composite index
The AWDwR book has the following:
add_index :categories_products, [:product_id, :category_id]
add_index :categories_products, :category_id
The first, composite index actually serves two purposes: it creates an index which can be searched
on both foreign key columns, and with most databases it also creates an
index that enables fast lookup by the product id. The second index then
completes
2012 Sep 13
10
access key error
I am getting following error while run my rails app in my server
ActionView::Template::Error (You did not provide both required access keys.
Please provide the access_key_id and the secret_access_key.):
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
2006 Jan 03
4
validates_presence_of *_id attributes
Hi all,
I am a newbie to Rails. Please enlighten me on how to do this
appropriately, the Rails and the Ruby way:
Suppose I have a Recipe model. Let''s simplify things and pretend that
it has only 2 attributes, a :name and the other is a ''category_id''. In
the recipes table, category_id is a foreign key to field id of table
categories.
We also assume that I have generate
2009 Sep 24
8
Drop down list ?
Hi Gurus, I''m trying to tackle a drop down list. I have category and
item dbs, and they''re wired up with category has_many :items and item
belongs_to :category, and an item has a category_id. I have this code
in my new/edit.html.erb for item:
<%= f.collection_select :category_id,
Category.find_main, :id, :header, {}, :multiple => false %>
And a pretty drop down list
2005 Nov 18
1
route with optional args?
Is it possible to specify a route like this:
/items(/category/:category_id)(/order/:order)(/page/:page)
and have any of the parts in parentheses be optional? I know I can make :category_id and the other
vars optional, but is it possible with the entire "/category/:category_id" part?
thanks
csn
__________________________________
Yahoo! Mail - PC Magazine Editors''
2006 Jun 14
13
Undefined method
I really hope this is not a bad question (as in he''s abusing the
list). However I could use a little direction (even though I''m
reading books, tutorials)
Right now I''m getting a
undefined method `category'' for 4:Fixnum
The specific lines from the rhtml file are:
<td><%= link_to position.category_id.category, :action => "show", :id
=>
2009 Feb 21
3
belongs_to or has_many
2 tables Items and Categories
Categories (id, name)
Items (id, name, category_id)
Category_id can be null, and there are Categories that has not an Item.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email
2006 Jan 13
4
missing foreign key fields in scaffold views
Is there any reason that foreign key fields do not show in any of the
scaffold views ?
project table:
id serial primary key,
category_id integer,
user_id integer,
name varchar,
morestuff varchar
foreign key (category_id) references categories(id),
foreign key (user_id) references users(id)
scaffold generated views only show name, morestuff fields
2006 Mar 30
5
Heeelp - no idea what''s going wrong.
I''m working on a simple CMS. The main data type are "listings" a listing
habtm (has_and_belongs_to_many) categories and subcategories.
Subcategories belong_to categories. Subcategories are basically the same
as categories, but they are treated differently in a few situations.
The problem is, I can''t seem to write the view/controller/model code
that allows me to