Displaying 20 results from an estimated 200 matches similar to: "ActiveRecord problems from within template"
2006 May 18
1
repeating has_many calls on the same model
Hi,
I currently have a model with (amongst others) the following declarations in it:
has_many :live_action_personnel,
:class_name => "Credit",
:include => :credit_type,
:order => ''credit_types.position, credits.position ASC'',
:group =>
2006 May 20
1
RJS returned javascript written straight to page
hi there,
I have in my controller, the following to catch a link_to_remote:
def form_part_add_personnel
@credit_types = CreditType.find(:all)
p = Credit.new()
p.id = rand.to_s[2..-1]
render :update do |page|
page.insert_html :bottom,
"script",
:partial => ''films/form/personnel'',
2006 Jan 09
1
Saving an upload
I am creating a database for movies (films) and television shows (shows)
that will have has_and_belongs_to_many relationships with the pictures
table.
CREATE TABLE screenshots (
id serial NOT NULL,
filename character varying NOT NULL,
content_type character varying NOT NULL,
primary key (id)
);
CREATE TABLE films (
id serial NOT NULL,
name character varying NOT NULL,
2006 Apr 30
3
MySQL connection problems on Dreamhost
To all fellow Dreamhosters out there...
Sometimes my app mysteriously loses its connection to the database,
resulting in a big ugly "Application Error (Rails)" page. Usually
refreshing the page makes it go away, but not today. :-(
In production.log I see this:
MysqlError (Lost connection to MySQL server during query):
Any idea why this happens? It''s rather intermittent
2006 Mar 30
2
database.yml and Dreamhost
I am unable to connect to my databases.
Here is the error I am getting:
MysqlError (Can''t connect to local MySQL server through socket
''/var/run/mysqld/mysqld.sock'' (2)):
Here is my database.yml:
# MySQL (default setup). Versions 4.1 and 5.0 are recommended.
#
# Get the fast C bindings:
# gem install mysql
# (on OS X: gem install mysql --
2006 Aug 15
1
Problem with joining...
Hello,
I am quite new to Rails and i was wondering if i could get some help
to populate a join table?
I got (for example) a table called films, a table called acteurs and
a join table called acteurs_films. I have specified the HABTM
relationship and I manage to do it through the console by doing:
acteur=Acteur.new
acteur.name="blabla"
acteur.films << film
acteur.save
and
2006 May 15
0
acts_as_list, move_higher, odd indexing behaviour?
Hi,
[reposting to list, posting via google groups apparently didn''t work]
I''m trying to use acts_as_list for the first time.
Can anyone confirm the odd behaviour reported here?
http://blog.nominet.org.uk/tech/Web/2006/03/06/Using_acts_as_list_in_...
i.e. element access and move_higher require an odd indexing scheme to
work.
I''m personally finding that I
2006 Aug 14
0
MediumText with Rails Migrations
Hi,
I''m trying to figure out how to reliably define a column as mediumtext
type through a migration.
First I tried this:
change_column( :entries, :lines, :text, :limit => 2.megabytes )
It worked fine for my development box on MySQL 5.0, but when I tried
it on my production box with MySQL 4.0, it gave the following error:
MysqlError: You have an error in your SQL syntax. Check the
2006 Mar 25
0
[Sentry]-before_validation(model) not working for crypted-attribute?
I am still trying to get sentry working to encrypt a couple of
attributes in the model. One of them is a password field and the other
ssn#.
I have crypted_password and crypted_ssn in the db.
In addition, I also have validates_uniqueness_of :ssn
Here is the problem... I get the error
MysqlError: Unknown column ''ssn'' in ''where clause'': SELECT * FROM
students
2006 May 31
3
Database can''t connect -
I''m sorry guys. I''m really still such a newbie at this. i''ve been having
trouble getting my Rails apps to run on Dreamhost, and I think it might
be a problem with the database connection. Anyway, I read on Code
Snippets that I should do this:
[rhod]$ ruby -Iconfig -renvironment -e "p ActiveRecord::Base.connection"
to find out if my database.yml file is
2006 Apr 04
3
newbie - HABTM problems writing to Join Table in SQL
I am attempting to document a join between two tables. There seems to be
no writing to my database. Please help me out it is driving me absolutly
crazy.
Basically i''ve got a table of directors that is called when the new/edit
controller model for films is activated. It shows the user a selectable
list of directors they can apply to films. The problem is in the
update/create part. I
2006 Jan 04
4
many to many link table compound primary key explosion
Hi,
I have a many-to-many relationship between two tables, questions and
answers. My MySQL schema for the link table creates a primary key from
the two fields to prevent duplicate records. When I add the same answer
to the same question more than once, rails attempts to create a
duplicate record and explodes with a MySQL error:
MysqlError: Duplicate entry ''3-3'' for key 1:
2006 Nov 22
0
Returning objects (not ids) in grouped count
I am trying to do a filtered, grouped count and have the grouping
returned be an object, not an object id.
Consider a blogging application. I want to return a list of topics with
their posting counts, filtered by a user id.
This:
Topic.count :conditions => ["user_id = ?", 1], :joins => "INNER JOIN
postings ON topics.id = postings.topic_id", :group =>
2006 Apr 25
3
limiting options in file_upload
Does anyone know if it''s possible to set constraints to the size & type of file that file_column will accept?
I''d like to limit to image files of less than 2MB.
If this isn''t possible with file_column, is there a graceful way of getting the controller to handle it?
thanks
dorian
--
--
I do things for love or money
2006 Jun 15
5
Cannot invoke ActiveRecord subclass accessors in DRb worker
Hi there,
I''m trying to create a worker to do some asynchronous web client work
and update the data model with its results. It seems, however, that
every call I make to an ActiveRecord subclass causes the whole thing
to block. At least I think it''s blocked. Right now I''m just using
debug log output.
Is there a decent way to debug/test workers I can try?
Is there any
2008 Oct 22
2
smbd high cpu load
We have a Linux file server for a set of computer science and
engineering
labs where each lab contains machines running Mac OS X, Ubuntu Linux,
or some incarnation of Windows. At times the these machines become
almost unusable and I think I have narrowed the problem to smbd
processes
soaking up all the CPU on the server. Running 'top' on the server
reveals a dozen or so entries like
2006 Oct 25
3
rails app breaks after pg restart
Hi,
Disclaimer: I''m pretty sure this isn''t a mongrel issue, as I''m pretty
sure I had the same problem back in the lighty-fastcgi days..
After a postgres restart, my rails apps crash with this error:
ActiveRecord::StatementInvalid (PGError: FATAL: terminating connection
due to a
dministrator command
server closed the connection unexpectedly
This probably
2006 Aug 12
4
form problem on deployment. Not sure how to debug this.
I wish I could be more clean in the subject but I honestly don''t know
what to point at for the problem.
I am trying to deploy a rails app to my external host (dreamhost).
It works great in development on my machine but when It gets into
production on dreamhost Data seems to be missing when I try and submit
the form.
Here''s what it looks like when it works...
Processing
2006 May 03
2
Perplexing nested transaction issue
I''ve been struggling with a strange nested transaction problem for a while.
I have a two objects with the following relationships:
Mail has_many :recipients
Recipients belong_to :mail
I''d like to update the status of the Mail object while sending mails for
each of it''s recipients. Following is a simplified example that I''m having
problems with:
def
2006 Apr 28
2
tests and login_engine
Hi there,
I just started writing tests today after some months of using rails (slap wrists).
I seem to be getting the hang of things, but I''m hitting a wall when it comes to functional_testing pages protected by login_engine/user_engine.
all my assertions come back with:
Expected response to be a <:success>, but was <302>
Is there a way I can login from within a test?