Displaying 20 results from an estimated 2000 matches similar to: "Specifying a decimal field precision/scale with scaffold requires 2 steps?"
2010 Mar 22
7
How to reference a select_tag within a form
Hi All,
Inside my app\views\expenses\new.html.erb file, I had the code:
<% form_for(@expense) do |f| %>
[snip]
<p>
<%= f.label :vendor %><br />
<%= f.text_field :vendor %>
<br />
<div id="vendor_droplist>
<%= select_tag "test",
options_for_select(@current_vendors.collect { |v|
v.nickname }),
{:multiple
2010 Apr 14
35
Conditionally adding a link to a form -- how?
I''ve got two entities created by scaffolding: Expense & Vendor
In Expense#new there''s a form with a Vendors-drop-down and a NewVendor-
button.
The latter button brings up Vendor#new.
The Create button in Vendor#new brings up Vendor#show with Edit & Back
links.
I want to append a third link conditionally to Vendor#show: if the
Expense#new form led to the Vendor#show
2008 Aug 22
2
How to find/open Spec::Expectations and Spec::Matchers
Hi,
Then RSpec 1.4 recommends, in the webpage http://rspec.info/documentation/expectations.html,
referencing the subject items.
I''m running ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32] over
WinXP-Pro/SP2.
I believe I installed RSpec with a Ruby gem. At least, I think that''s
confirmed because I have a lot of stuff in the directory K:\_Utilities
2010 Mar 20
4
Displaying an image in a Rails form_for
Hi,
I''ve got a public\images\DownArrow.jpg
and app\views\expenses\new.html.erb that want to present this image in
the following context:
<p>
<%= f.label :vendor %><br />
<%= f.text_field :vendor %>
<%= f.image "DownArrow.jpg" %>
<br>
<%= select_tag "test",
options_for_select(@current_vendors.collect {
2010 Jul 06
4
Simple routing problem
I''ve got the following in config\routes.rb:
map.resources :users
In app\views\shared\_menu.erb, I''ve got:
Please sign in <%= link_to
"here", :controller=>"user", :action=>"sign_in" -%>
In app\controllers\users_controller.rb
def sign_in
end
When I run the application, I crash with:
Routing Error
No route matches
2010 Jul 16
31
Added associations but don't see generated methods
Hi,
I''ve got a Rails app working that includes two two classes, etc.:
Expense & Vendor. I eventually learned that the mental concept I had
of their relationship should be express in Rails as:
class Expense < ActiveRecord::Base; belongs_to :vendor; end
class Vendor < ActiveRecord::Base; has_many :expenses; end
2010 Mar 10
2
Decimal fields generated in Rails 2.3.5 act like strings, sort of
Hi All,
I just created a new CRUD "expense" (using Rails 2.3.5 scaffold) which
included "amount:decimal". When I:
1. populated the amount field of a new expense with 5 characters:
12.50 and
2. saved the new record
I got a display of the new record that showed Amount to be merely
"12".
I clicked Update and put my cursor over the data field for Amount and
got a
2008 Apr 22
0
numeric (decimal) WITH precision and scale at generate scaffold time?
Hello,
I was wondering if anyone knew if it is (or ever will be ) possible at
all to specify things like precision and scale at generate scaffold
time, and if so how.
Things like price:numeric(8,2) (obviously) just break the script.
Tommy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2010 Mar 12
7
"We're sorry, but something went wrong." from RoR app
Hi All,
"We''re sorry, but something went wrong." is the message I got when I
started up an RoR app in the environment:
Rails 2.3.5
Ruby 1.8.6
WinXP-Pro/SP3
Firefox 3.6
MySQL 5.0.37-community-nt
Mongrel
The app under development was working fine until I (stupidly) thought
I needed to upgrade MySQL to 5.1.44.
I took the precaution of MySQL-dumping
the development db before
2006 Oct 15
3
Migrations - add_column :default=>true, :null=>false
This seems pretty brain dead:
add_column :types, :notify_on_create, :boolean, {:default=>true,
:null=>false}
$ rake migrate
Error: ERROR: column "notify_on_create" contains null values
: ALTER TABLE types ALTER notify_on_create SET NOT NULL
Why doesn''t Rails set the new column to true, as it''s supposed to
default to? I tried :default=>1 as well (same
2008 Jan 19
1
Decimals are being converted to Bigdecimals!!!!!
Hi all,
I''m working on a financial app, and have set up some columns in my
tables as decimals with precision => 8 and scale => 2. My migration
looks like:
change_column :lineitems, :price, :decimal, :precision =>
8, :scale => 2
change_column :payments, :amount, :decimal, :precision =>
8, :scale => 2
I''ve run the migration and restarted the server. I
2007 Feb 20
5
Create a hyphen-separated set of letters derived from a string - How to?
Hi,
This is such a trivial programming issue, but I can''t find a way to
transform, say ''abc'' to ''a-b-c'' without using pattern matching.
Any ideas?
Thanks in Advance,
Richard
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post
2006 Jul 01
1
Changing column to NOT NULL with migration silently failing.
Hi
I''ve created a migration called
make_customer_type_id_not_null_for_customers. The migration .rb file
looks like this:
class MakeCustomerTypeIdNotNullForCustomers < ActiveRecord::Migration
def self.up
change_column(:customers, :customer_type_id, :integer, { :null => false })
end
def self.down
change_column(:customers, :customer_type_id, :integer, { :null =>
2009 Jul 24
2
[PATCH server] add collapsable sections to vm form
the vm form is getting cluttered, this patch simply add
collapsable sections to the form, making the 'storage'
and 'network' sections collapsed by default
credit goes to jayg for contributing alot to
this patch in terms of simplification and cleanup
---
src/app/helpers/application_helper.rb | 4 +-
src/app/views/vm/_form.rhtml | 35 ++++++++++++++++++++++----------
2006 Apr 30
4
Migration, BigInts, and string lengths
Howdy Y''all,
I was thrilled to recently discover migrations, as that framework
addresses a common problem in an elegant way. I have, however, gotten
tripped up a bit as I''ve worked with them.
The first problem I encountered was that, though I was using a BigInt
data type in a field in my dev database, my unit tests were failing
because when I copied the schema from the dev
2012 May 25
2
Typecast values on change_column for postgresql
Hello,
Currently if you have a string column that have only number values (think a
year column using string by mistake) and you want to change to integer, you
can''t.
If you apply this monkey-patch will be possible:
https://gist.github.com/1393441
Note: if some value can''t be casted by postgresql (if have a letter for
example), the migration will fail as expected.
I think
2009 Jun 19
1
[PATCH server] add collapsable sections to vm form
the vm form is getting cluttered, this patch simply add
collapsable sections to the form, making the 'storage'
and 'network' sections collapsed by default
---
src/app/helpers/application_helper.rb | 9 +++++
src/app/views/vm/_form.rhtml | 55 +++++++++++++++++++++++++--------
src/public/javascripts/ovirt.js | 25 +++++++++++++++
2008 Nov 21
15
Switching the version of Rails that an app uses
Hi All,
I’ve got a few versions or Rails installed and I''d like to run an App
I’m developing with various versions of Rails. I heard of two ways to
switch the version of Rails that an app uses:
1. Use GitHub as described by http://kylecordes.com/2008/04/30/git-windows-go/
. But that requires using Bash in a Command Window and more steps
than I want to go through.
2. Alter
2012 Mar 02
2
Change DB data type and limited decimals
Rails3.1.3
I have db type,
startp:integer
I need to change it to float. More specifically,
1.2, 45.1, 143.8 ...
I have two questions:
1. Is removing and adding the field through migration the only way?
in other words, is there a single command to change the type?
2. Is there anyway to limit the decimal place to only one?
56.3, 34.2... are acceptable, but 23.112, 77.34, ... are
2006 Jul 12
1
Dumping schema
All,
It looks like rake db:schema:dump does not dump primary keys.
I have some legacy table that don''t follow the convention ie pk = id
and
none of the primary keys for these tables are getting dumped...
Seems strange as this should be readily available from the db. I am
using
MySQL. Is anybody else seeing that ?
Incidentally how does one specify a primary key using