Displaying 20 results from an estimated 10000 matches similar to: "Noob: format column in scaffold (i.e. - datetime)"
2009 Jul 04
3
scaffolding
hi , i used the folllwing command to scaffold,
G:\my\webblog>ruby script/generate scaffold webblog id:integer
title:string body
:text created_at:datetime
after when i migrate with the follwing command
rake db:migrate
i got the error as
(in G:/my/webblog)
== 1 CreateWebblogs: migrating
================================================
-- create_table(:webblogs)
rake aborted!
Mysql::Error:
2005 Nov 20
1
mySQL 5.0 upgrade - incompatible DateTime format?
I''ve upgraded to mySQL 5.0, and it''s gone pretty smoothly except that on
DateTime.now doesn''t seem to return a value that mySQL likes any more,
as seen in the following exception:
Incorrect datetime value: ''2005-11-20T15:33:12-0800'' for column ''logged_at'' at row 1: UPDATE notes SET `due_on` = ''2005-11-20'',
2009 Nov 06
0
Nested objects not propagating from view
I thought I had this fixed, but apparently not. It works okay from the
console, but not from the view. I have the following:
# partial schema
create_table "users", :force => true do |t|
t.string "login", :null => false
t.string "first_name"
t.string "last_name"
t.string "email", :null => false
2010 Aug 08
1
help me
i am creating an aplication where table name albums width attributes
CREATE TABLE albums ( id int(11) NOT NULL auto_increment,
title varchar(255) NOT NULL default '''',
artist_old varchar(255) NOT NULL default '''',
release_date datetime NOT NULL default ''0000-00-00 00:00:00'',
genre varchar(50) NOT NULL default '''',
created_at
2010 Oct 11
5
Object lost in memory/trashed?
Hi,
I''ve got a problem on which I''ve spent many hours, and I can''t get a
clue on what is happening... I hope someone here will be able to help
me.
Here is the situation : my Rails app uses acts_as_commentable and
acts_as_bookmarkable on a Diagram model. Everything''s working OK
individually: I can create a comment on a Diagram, bookmark it, and so
on.
Now,
2006 May 30
3
Help about CMS - newbie in RoR
Hi team, I''m a very newbie RoR user from Spain and I''m developing a
blog''s CMS. Why RoR?, coz I think it''s an amazing framework with many
posibilities, portable and really powerful, with a young and optimist
community, and taking my project I''ve prefered his structure in front of
LAMP. Another thing is that I''ve liked to surprise my masters
2006 Jan 20
47
SQL Server datetime error
i have a problem with the datetime format of rails. i am unable to save
a dataset to the db. here''s the error message -- the original error
message was in german, so i translated it -- i get:
DBI::DatabaseError: Execute
OLE error code:80040E07 in Microsoft OLE DB Provider for SQL Server
Couldn''t convert a char-Datatype to datetime
HRESULT error code:0x80020009
2008 Sep 12
1
restful_authentication rspec failures "Mysql::Error: Incorrect datetime value:"
I am getting 193 failures that all have "Mysql::Error: Incorrect
datetime value:"
how do i fix this??? i am new to rspec and restful_auth, so if i am
doing something wrong, let me know!!!
windows xp
rails 2.1.1
rails testproject
cd testproject
# create my databases and edit database.yml
git init
git submodule add git://github.com/dchelimsky/rspec.git vendor/plugins/
rspec
git
2008 Oct 06
1
Rails console, saving objects
I was reading a book and following the instructions in it.
>> class Story < ActiveRecord::Base; end
=> nil
>> story = Story.new
=> #<Story id: nil, name: nil, url: nil, created_at: nil,
updated_at: nil>
>> story.class
=> Story(id: integer, name: string, link: string,
created_at: datetime, updated_at: datetime)
I do not remember me asking for id, name, link or
2011 Apr 27
2
Can not create model instance via params on specific model but can on others....
Anyone have an idea on this? Got a weird situation where on a specific model
I can not create an instance using params, yet it works fine on other
models. The model which does not work is a stock model, there is no logic in
it. Ruby 1.8.7/Rails 3.0.5.
Does not work:
(rdb:1) PaymentTransaction.create(:purchase_id => 3)
#<PaymentTransaction id: 2, purchase_id: nil, action: nil, amount: nil,
2010 May 25
2
Site Navigation With Polymorphic Has Many Through
Hi, seem to keep running into a wall here. I can''t find any resources on
site navigation that can deal with any model being in the nav, allow
nesting, and can dynamically update.
So I thought about it for a while, and decided on a MenuItems class, which
contained the position of the child in relation to it''s siblings, where the
parent and the child were polymorphic. Then a given
2006 Feb 07
0
complicated search/model question
Hi,
I have the models and db below and am putting together a scheduling application.
With what is laid out below (or any suggested changes) how would I find a
contractor for a job based on the contractor being available on a specific
weekday, at a specific time and not currently booked in to a job during the
same time?
I?m new to Ruby and Rails and making pretty good progress but I must admit I
2006 Feb 11
2
Migrations and Unintialized Constants Error
I am running into a problem with two of my tables and the
"uninitialized constant" error when using migration.
I get the "uninitialized constant Note" when running the following
code in my migration file:
create_table :notes do |t|
t.column :id, :integer
t.column :noteshare_id, :integer
t.column :title, :string
t.column :covered, :string
2008 Jul 13
2
Problem with ActiveRecord::AssociationTypeMismatch
Hi all !
I''ve written a Character model, each character has many Attributes. My
schema.rb looks like this:
create_table "characters", :force => true do |t|
t.string "first_name"
t.string "last_name"
t.integer "user_id"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "attributes",
2010 Aug 20
2
The M in ORM
Hi everyone,
I am attempting to connect an already existing mysql database with
Rails. For This I can''t use the traditional "generate scaffold" and
"rake db:migrate" because (I think), I''ll loose the data already
existing in that database table. So what I did was, I generated a
scaffold for my table, and instead of running db:migrate, I added a
2006 Aug 02
2
many-to-one relationship, do I need a second table?
Ok, to keep things short. Im wondering if I need a secondary
relationship table to handle my many-to-one relationships. Here is an
example of what I''ve written down. For instance say I want to find all
of the people in a given location.
class Location < AR:Base
has_many :people
end
class Person < AR:Base
belongs_to :location
end
My SQL tables look like:
CREATE TABLE
2012 Feb 07
2
save method (create action) saves twice
Rails 3.1.3
I have changed a regular scaffold action a bit so that it can save using
ajax.
All I needed to do was adding ":remote => true" in
<div id="script_new">
<%= form_for script, :remote => true do |f| %> <!-- HERE!!! -->
<%= f.hidden_field :video_id %>
<%= f.text_field :text %>
<%= f.submit "save" %>
2012 Apr 17
6
ActiveRecord with different Date/Time format
I have an application where user sets his/her preferred date/time
format. User is expected to enter datetime in his preferred format
across the application. Now the problem is for few formats the datetime
is parsed wrongly while create/update ActiveRecord.
For example user has set date/time format in hh:mm dd/MM/yyyy. Now if
user enters 17:00 04/05/2012 it parses it as 5 PM 5 Apr, 2012 where it
2009 May 08
3
STI and subclassing twice
I''m trying using STI to implement a hiearchy similar to this:
script/generate scaffold name:string type:string
class Person < ActiveRecord::Base; end
class Customer < Person; end
class Employee < Person; end
class Developer < Employee; end
I.e., there are two levels of inheritance (Developer < Employee <
Person).
When creating a Customer, Rails understands
2006 Jan 07
1
How to DRY with Fixtures (helper or extend Time class, how)?
I have a test/fixtures/users.yml like so:
apa:
id: 1
username: apa
[...]
created_at: <%=Time.now.strftime("%Y-%m-%d %H:%M:%S")%>
updated_at: <%=Time.now.strftime("%Y-%m-%d %H:%M:%S")%>
I don''t like how I''m repeating myself with the strftime bit.
Is there some shorter Time method to format time for a (MySQL) datetime
field that