Displaying 20 results from an estimated 5000 matches similar to: "How to avoid AR confusing way of handling default values for attributes w/ :null => false"
2006 Mar 15
3
Self-referential join model does not work
I have been trying to model a labeled graph using ActiveRecord (trunk
version). Basically, I have a ''Node'' model which represents a node linking
to other nodes. Links (aka edges) are labeled (i.e., have a ''label''
attribute and other behavior). Thus I decided to model edges as an ''Edge''
model and use a ''has_many :trough''
2006 May 23
6
How to list all models of an application?!?
How can I get a list of all model classes in the domain of a Rails
application (all models, both in "app/models" and in
components/somedir/model.rb)?
Thanx in advance for your precious help!
Edoardo "Dado" Marcora
2006 Jan 30
1
Example on how to boost a field?
I am wondering whether one could boost certain fields (e.g., title and
keywords) to make them ''weigh'' more against searches across all fields.
I know that Document::Field has a boost attribute and that it accepts a
boost argument in the constructor (although I''ve had not much luck with
it, I am just getting back exceptions upon init w/ boost), but I was
wondering
2009 Aug 31
3
Migration - wrong SQL statement is created
Hi,
I am doing my first steps with RoR and I have the following problem:
I execute my migration file with the following content on a
MySQL-database via Rake:
<code>
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.integer :id
t.string :username, :size => 100
t.string :password, :size => 100
t.string :email, :size
2007 Nov 12
7
schema_info always wants to be 3, even when set to 7
Hi all,
I''m having a very odd problem with db:migrate. I''m using Rails 1.2.5
on Windows XP SP2 and Ruby 1.8.6
I have seven migrations. If I run them with an empty database, it
runs the first three, then halts. When I look in schema_info, the
version is 3.
If I run db:migrate VERSION=7, then it runs through the remaining 4
migrations, and the version is 7 in the DB.
2007 Jul 18
3
Help. Acts_as_Authenticated plugin stops working for me?
Hi,
I successfully installed AAA couple days before, and i managed to
register a uer with it, with no user activation.
but for some strange reason, it stops working for the signup method,
with i go to the signup page, press submit, it shows an error page,
what''s wrong? here''s the error page.
undefined method `activation_code'' for #<User:0x3b6dbd
2006 Jul 13
4
Regenerate DB
Hi again :),
I''m playing with migrations. I''ve created some migrations classes and
with
rake db:migrate the tables are created and altered fine, but then I
dropped
some of the tables and when I run db:migrate command again I don''t get
tables
being re-created.
What am I doing wrong? Is there a way to run db:migration in order to
drop the
tables?
--
Posted via
2006 Jun 13
11
Question: Migration - multiple creates
I want to create a migration file that creates multiple tables, so i''m
guessing the correct format would be:
Can anyone confirm ? I''m guessing that each new create script requires a
seperate class so formatted this way. Perhaps I''m wrong.
TIA
Stuart
class CreateTable1 < ActiveRecord::Migration
def self.up
create_table :table1s do |t|
t.column :length,
2006 Mar 31
2
A.R. Associations problem
Hello,
I''m learning A.R Associations by creating a simple forum that consists
of 3 tables: ahuthors, topics and posts. This is the schema:
class AddAuthorAndTopicAndPostTables < ActiveRecord::Migration
def self.up
create_table :authors do |t|
t.column :username, :string
t.column :email, :string
t.column :created_on, :datetime
end
create_table
2009 Apr 21
2
problem with sqlite3....
Hi all,
I am relatively new to ruby and RoR. I created a simple rails proj named
foo by giving command
-> rails foo --database=sqlite3
It created a new rails proj.. So in that I created a simple db class
named user by using the below command
-> ruby script/generate model user
so in db/migrate I got a file named 20090421211825_create_users.rb
created.
and in app/models : user.rb got
2008 Oct 26
3
Undefined method f_title
Hi,
This is my migration:
class CreateSampleForms < ActiveRecord::Migration
def self.add_data
SampleForm.create(:name => ''Default (Empty)'', :f_type => ''Default
(Empty)'', :description => ''Use this template to create a blank form.'')
end
def self.up
create_table :sample_forms do |t|
t.string :name, :null =>
2015 Jan 02
1
Help in building R with minGW
Dear R users,
I would need some help in building R using minGW in windows 8.1. After
using the command *configure *(./configure --enable-R-shlib
--with-readline=no --with-x=no), I use the command *make. *This results in
the following error:
[...]
make[2]: Leaving directory `/home/Edoardo/r-3.1.2/src/nmath'
make[2]: Entering directory `/home/Edoardo/r-3.1.2/src/unix'
make[3]: Entering
2007 Feb 08
2
uninitialized constant CreateUsers
what could be causing this?
* Execute environment
** Execute db:migrate
rake aborted!
uninitialized constant CreateUsers
--
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 to
2007 Dec 14
0
"Multiple default values" with Rails migration
I am running the following migration with PostgreSQL 8.2.5. It works
fine on my Windows machine, but gives me the below error on Linux
CentOS 4.3. Any ideas? Thanks, Chirag
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :uers do |t|
t.column :timestamp, :timestamp_with_time_zone
t.column :userval, :integer, :limit => 1, :null=> false #will
use
2006 Feb 19
3
multi-sql problem?
hi all,
how to excute multi sql statement in rails
#-------------------------------------------------------
sql_1 = ''drop table if exists test''
sql_2 = ''create temporary table test select * from test_1''
sql_3=''select * from test''
#-------------------------------------------------------
any ideas
all regards
--
Posted via
2007 Aug 15
1
CDR billsec greater than duration
Hi all,
I have a strange situation on a Asterisk 1.2.17 with FreePBX 2.2.1
Doing a select in the CDR table I noticed there are some calls with
billsec greater than duration, duration is always 0 in those calls.
How can this happens ? Am I missing something ?
Tnx in advance
Regards
Edoardo Serra
WeBRainstorm S.r.l.
2006 Apr 07
4
How to generate mapping with migration
Hi there, I''ve tried to add a m:n mapping table using the migration
mechanism.
ruby script\generate migration add_categories_notes_mapping
and filled the migration file with:
class AddNotesCategoriesMapping < ActiveRecord::Migration
def self.up
create_table :categories_notes do |t|
t.column :category_id, :integer, :null=>false
t.column :note_id, :integer,
2016 Jan 17
5
running an icecast server
Hello everyone,
I'm in the process of running an Icecast server and I would like to know
some best pratices.
1. Should I place Icecast on port 8000 or should I change that to one more
common (80, 443...)?
2. Should I place the server behind a webserver like ngingx or apache?
3.Can I disable the login interface? what can be disabled?
My best guess is to run icecast behind a webserver,
2007 Mar 31
4
Sponsored development - Monodirectional audio handling
Hi Guys,
we're needing a special implementation on Asterisk
Our intention is to contribute the development and share back the code
to Asterisk community
Here is what we need:
- An option to Asterisk Dial command which, if used, when calls is
answered gives monodirectional audio
(Caller should hear the called party but not vice-versa)
- A DTMF sequence (maybe handled in features.conf) for
2006 Apr 04
9
Does ActiveRecord have support for "Boolean" columns?
Hey all --
I''ve been using enumerable char(1)''s with ''y'' and ''n'' values for my
Boolean columns in Rails, but it strikes me there should be a better
way.
How do you setup columns that represent true/false-ness in your
schemas on Rails?
Wondering what kind of standard approaches there are other than me
writing something like
class MyEntity