similar to: uniqueness validation perplexity

Displaying 20 results from an estimated 6000 matches similar to: "uniqueness validation perplexity"

2009 Jun 22
5
has_many through , or habtm , using form
i think there ara two ways of relate products and categories , basically i want to fix one product(e.g hp dv7....) to some categories (notebook,17"notebooks...) i made a table named categorization(incuding category_id,product_id fields) then in models i write these codes below class Product < ActiveRecord::Base has_many :categories, :through => :categorizations
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
2009 Sep 07
11
autoincrement for non-id column
There is a table: execute (<<-SQL) CREATE TABLE "tasks" ( "id" serial primary key, "number" serial, "version" integer DEFAULT 0 NOT NULL, "latest_version" boolean DEFAULT ''t'' NOT NULL, "hidden" boolean DEFAULT ''f'' NOT NULL, "type" character varying (1) NOT
2010 Jan 28
1
validates preference of at least one param
I have a simple RESTful search scaffold that finds data in a separate model and controller. [code] <h1>New search</h1> <% form_for(@search) do |f| %> <%= f.error_messages %> <p> <%= f.label :category_id %><br /> <%= f.collection_select :category_id, Category.all, :id, :name, :include_blank => true %> </p> <p> Age
2009 Oct 27
14
Authlogic Password confirmation is too short Error. NEED HELP.
Hi: I am using authlogic, and following railscast tutorial. I am running into this error code with the password confirmation. authlogic password confirmation is too short Has anyone experienced this error? I need your help. Thanks in advance for your help.
2009 Oct 23
2
validates_uniqueness_of across multiple rows?
Ok, that''s not the best subject line, but I couldn''t think of a concise way to describe what I''m trying to do. I''ve got two models. Grouping simply contains an id and a few other attributes (e.g. rating). A grouping can contain many elements which are stored the Element model. A set of elements is tied together by a grouping_id. An element can be one of
2010 Dec 23
36
Weird issue with converting floats to integer
Any idea why this calculates the integer the way it does? irb> ("291.15".to_f * 100.0).to_i => 29114 Thanks, Tom -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to
2009 Sep 07
7
How can I have the tests for my Rails app to be executed in a random order?
Hi How can I have the tests for my Rails app to be executed in a random order? Is there a simple solution using rake? I already posted my question to stackoverflow (http:// stackoverflow.com/questions/1376267/ruby-executing-tests-in-a-random- order-with-rake) but the few responses I got were not able to solve the problem. Thanks a lot! Pietro Di Bello
2009 Oct 20
10
REXML
Hi, How to embed ruby code in xml . here is my XML template : string = <<EOF <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE ozxmlscene> <ozml version="4.0"> <styleRun style="1091379" offset="0" length="7"/> <text>The End</text> <object value="84"/> <object
2010 Aug 09
6
configure question and passenger
Greetings all. I have seen a couple of diagrams on the net that look like a computer set up as an nginx server and more than one mongrel server running at once. What is the advantage of having more than one mongrel server running? Is there a good how-to that explains it very well. thanks shawn -- You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2009 Dec 25
18
rescue_from ActionController::RoutingError II
OK ... so I''m not supposed to use it but ... Why doesn''t rescue_from ActionController::RoutingError work witht he code from http://www.rubyplus.org/episodes/20-Extended-RESTful-Authentication-Rails-2-App.html class ApplicationController < ActionController::Base helper :all # include all helpers, all the time # See ActionController::RequestForgeryProtection for details
2009 Nov 03
12
Mysql::Error: query: not connected
Hi there! I am PHP developer and trying to learn ROR. Currently I am building my first Rails website (OS X Snow Leopard, TextMate) and decided to switch from sqlite to mysql. After many-many hours of searching the internet I managed to install mysql gem. Now I get this error when I try to run rake migrations: rake aborted! Mysql::Error: query: not connected: CREATE TABLE `schema_migrations`
2010 Jul 06
28
Is this book dated?
http://apress.com/book/view/9781590597811 I acquired this book and it has the info I thought I wanted; but, I''m not sure. Is there something better more current out there? RESTful oath openid etc.. I''m coming from a wordpress to cake, codeigniter tinkering and forget why I tried rails; but, it seems pretty cool and intuitive. Appreciate the Capistrano rec prior. Super good,
2007 Aug 23
6
controller spec with model that validates_uniqueness
I want to use mocks and stubs to test the controller, but am having trouble getting my validation not to trigger. Here''s the code: # spec: Image.stub!(:find).and_return(@image) @image.should_receive(:save!).once.with(:any_args) put :update, :id => @image.id, :category_id => @category.id, :image => {:name => ''test'', :image_number =>
2009 Apr 21
12
still cannot install rails on windows
if i follow the instructions on: http://agilo.us/2009/03/15/rails-on-windows/ the command gem install sqlite3-ruby will give --------------------------------- Building native extensions. This could take a while... ERROR: Error installing sqlite3-ruby: ERROR: Failed to build gem native extension. c:/ruby/bin/ruby.exe extconf.rb checking for fdatasync() in rt.lib... no checking for
2009 Nov 10
6
getting the timezone name from an abbreviation
HI, I am creating n onlinecalendar sort of functionality for which the user input for events is taken. To make it user friendly, its left to the user to write the time down rather than selecting it from a datetime field in a form . The user can also specify a timezone. And while doing so its obvious that most inputs will be an abbreviation. My question is - is there a way to convert
2009 Sep 28
6
What is the most efficient way to split a table into 2 groups?
I have the following: @lot = Lot.find(params[:id]) part_nums = Part.all(:conditions => ["id <> ?", @lot.part.id]) I guess I should mention that Lot :belongs_to => :part I was looking at the log following the execution of these two statements and I saw something like this: Lot Load (0.4ms) SELECT * FROM "lots" WHERE ("lots"."id" = 13) Part
2009 Sep 02
8
select_month helper
I''m trying to rewrite a fusebox-like application (Active4D plugin to 4D database) in RoR/postgres and I''m doing okay - but keep running into things that stump me. It seems like it takes me hours to figure out something that I could have written in pure code in minutes. The select_month and select_day helper has been my latest waste of time. All I''m trying to do is add
2010 Dec 25
7
I sit possible to write it in one line ? Array init + Array loading
I am always writing it in 2 lines : ( Array init then loading the array ) @providers = [] @authentications.map {|authentification| @providers << authentification.provider } Is there any Ruby writing for writing just one line ? thanks fyh -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group,
2010 Aug 05
7
Search large XML file -- REXML slower than a slug, regex instantaneous
Got a question hopefully someone can answer - I am working on functionality to match on certain nodes of a largish (65mb) xml file. I implemented this with REXML and was 2 minutes and counting before I killed the process. After this, I just opened the console and loaded the file into a string and did a regex search for my data -- the result was almost instantaneous. The question is, if I can get