Displaying 20 results from an estimated 1300 matches similar to: "Newbie''s problem with a nil object he didn''t expect!"
2006 Jan 14
11
accessing models from migrations
Ok, so now Users need to be associated with Organizations. I''ve
created a migration and added a ''organization_id'' column to the users
table. I want the default organization_id to be the first
Organization. So I have :default => Organization.find(:first). But
it''s complaining about not being able to find the constant
''Organization''.
Any
2011 Aug 07
2
PROBLEM WITH PAPERCLIP
hello,
i am trying to upload a image file ...using paperclip in rails 3
i did as follows
1. In gemfile => included gem paperclip
2.In config/environments /development.rb => Paperclip.options[:command_path]
= "/usr/bin/" (convert path)
3.created a controller *picusers *and defined => def create
@picuser = Picuser.create(params[:picuser])
end
4.created a model *picuser
2009 Sep 03
12
paperclip is not saving the files
Hi all,
I''ve installed paperclips but
paperclip is not saving the files
my model has
has_attached_file :attachment,:styles => { :medium => "300x300>",
:thumb => "100x100>" }
and i have db migration as
class AddAttachmentToPolicies < ActiveRecord::Migration
def self.up
add_column :policies,
2010 Feb 25
2
[PATCH] Enhance vms display
It can be quite hard to manage a pool of 40-50 VMs without informations about the OS running, the contact (which is the only one to know when the vm can really be destroyed) or an End Of Life date. This patch add those fields, and rework a little the VM list view, in order to show gracefully those new fields. It has been made at the expense of UUID, Total Run Time & Load fields. Since those
2008 Feb 13
4
Migration Issues: Can't update newly added column values
Hello everyone, just wondering if anyone can help me with a migrations
question here.
Using:
rails 2.0.2
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin]
mysql 5.0.45
Platform:
windows xp
The problem:
----------
I created a migration that is designed to add a column named
"deleted_at" (timestamp) and then remove a column named
"is_deleted" (boolean). The idea is to
2006 Nov 29
2
db:migrate to add colum bombs...
Hi
I get the following when I try and run "rake db:migrate" (I"m running un
Ubuntu linux)
********** code **********
(in /<home hidden>)
== AddRpts: migrating
=========================================================
-- add_column("rpts", :integer, {:limit=>3})
rake aborted!
You have a nil object when you didn''t expect it!
You might have expected an
2006 Apr 02
5
adding primary_key to join table using migrations
Hi list,
My tag_question_user join table is not currently a full-blown model. It
doesn''t have a primary key - just tag_id, question_id, and user_id.
I now want to add a primary key to this model (because I want to add a
"description" column as well so users can describe the tag.
I''m not sure how to add this using migrations.
Here is what I have:
class AddNotesToTags
2006 May 16
5
rake aborted when adding a column
I''m having a silly little problem with migrations. All I''m
trying to do is to add an SSN column to my Employees table. I
generated a migration which looks like:
class AddSsn <
ActiveRecord::Migration
def self.up
add_column :employees,
:ssn,
:string
end
def self.down
remove_column :employees,
:ssn
end
end
When I run this, however, I get:
>rake
2007 Nov 29
1
Migration Bug?
Please tell me I''m just confused, but this is very strange.
I have a migration like so:
class AddLevelToRequest < ActiveRecord::Migration
def self.up
add_column :requests, :title_levels, :string
end
def self.down
remove_column :requests, :title_levels
end
end
Run the migration, and from the console do:
>> r = Request.new
=> #<Request:0x31a243c
2006 May 26
7
migration with required data
I''m working on a bugtracker application in rails. I have a Bug model
and I want to add a Priority to the mix. A Bug can have one priority.
I generate a Priority model, modify my Bug model with a belongs_to
:priority and create my migration like so:
class CreatePriorities < ActiveRecord::Migration
def self.up
create_table :priorities do |t|
t.column :name, :string,
2010 Aug 25
2
[PATCH] Virtio support
From: Simon Courtois <scourtois at linagora.com>
Signed-off-by: Simon Courtois <scourtois at linagora.com>
---
src/app/controllers/vm_controller.rb | 19 ++++++++++++++++-
src/app/views/vm/_form.rhtml | 25 ++++++++++++++++++++---
src/db/migrate/044_add_virtio_to_vm_and_nic.rb | 11 ++++++++++
src/public/stylesheets/components.css | 5
2006 Jun 09
2
Creating An Extra Association Between Two Tables
Good Friday Everyone :-).
These are my models:
Problem -> has_and_belongs_to_many :tags
Tag -> has_and_belongs_to_many :problems
Now if a tag does not exist and I create it and associate it to the
problem it works
self.tags << Tag.create(:name => tag)
But if I have the tag already in the DB and just want to link it to
another problem it does not really like me. I do it
2006 Apr 05
16
Migration won''t rollback to specific version?
Hi all,
I''m confused about how migrations work. I''ve been using them for a
couple of weeks but haven''t had any serious rollback issues yet. Just
now I added a field to a table with a migration and ran "rake migrate",
which added the field as expected.
This was in the file db/migrate/007_mymigration.rb, making it version 7.
Later I changed my mind and
2009 Feb 17
8
Converting Acts_As_Tree to Acts_As_Nested_Set
Hello,
I have a tree structure that needs to be converted into a nested set.
A great deal of work has already been done on the tree items, so
maintaining the integrity of the id''s is mandatory. However I need
the ability to access entire branches of the tree, which is what
Nested set does. Does anyone have any suggestions on how to
efficiently transfer the tree to the nested set and
2006 Aug 04
8
Demo in rails2.pdf of add_price migration, PostgreSQL 8.1.4
People,
I''m looking at the migrate example on p 74 of the rails2.pdf
It''s a simple example of using a migration to add a column to
the products table.
Here is a copy of the migration file named 002_add_price.rb
after I generated and then edited it:
class AddPrice < ActiveRecord::Migration
def self.up
add_column :products, :price, :decimal, :precision => 8, :scale
2009 Aug 19
10
acts_as_list / acts_as_tree / acts_as_nested_set - which one
I am creating forum application which needs usage of acts_as_list or
acts_as_tree or acts_as_nested_set.
I am unable to decide among these. please could some one recommend from
their experience?
--
Posted via http://www.ruby-forum.com/.
2010 Sep 21
1
[PATCH] Introduce ability to select any kind of nic model, not just default or virtio.
There was no release since virtio support was introduced, so a proper
migration is not necessary.
Signed-off-by: Nicolas Ochem <nicolas.ochem at gmail.com>
---
src/app/controllers/vm_controller.rb | 6 ++-
src/app/models/nic.rb | 2 +
src/app/views/vm/_form.rhtml | 25 +++++++++-------
src/db/migrate/046_add_model_to_nic.rb | 29 ++++++++++++++++++
2006 Aug 09
1
Migrating a Field to External Model
I have a model Product with an attribute ''brand''. Currently it is a
simple attribute, however, I am migrating it to a separate model
Brand so that I can have other attributes with each brand. I created
the the model and created and ran the migration to create the new
table. So far so good. Then I created a separate migration to
transfer the data. The up method
2005 Jan 24
1
.call file creation
I am curious partly because it has occurred randomly in my asterisk
system. How does one go about creating a .call file for placing a call
between two extensions/phones? I know this has been mentioned and is
probably in one of the wikis somewhere, but I am unsure exactally how to
go about doing it. Can anyone point me in the right direction.
Dan
2006 Mar 28
2
Fastest way of adding " " around multiline text in RADRAILS
lets say i have the following SQL in my database editor :
When i paste it into rad rails i have to add quotes and the ''+'' symbol
to the end of each line. It is very tedious. What is the best method?
select timesheets.employee,
sum(items.hours) as hours,
sum(items.hours*timesheets.cost)
as cost,
sum(items.hours*timesheets.charge*decode(activities.chargetype,0,1,0))
as charge,