Displaying 20 results from an estimated 300 matches similar to: "Finding out updated fields"
2006 Mar 26
2
Shared Columns in an STI
I have a an STI table which acts_as_tree, that has a large number of
classes/types. My common fields are:
id
parent_id
name
description
with 4 more text fields, I could cover most of my classes if I could
redefine the name of the field like this.
text1 AS address1
text2 AS address2
text3 AS zipcode
For one class and
text 1 AS model_number
text2 AS vendor
Is there a construct that will allow
2006 Jul 07
5
link_to: link is missing id
I''m using a legacy table, where the unique id is not ''id''
I have a Model class like the following:
class Article < ActiveRecord::Base
set_primary_key "ARTICLE_ID"
end
however, using a link_to like the following (modified scaffolding),
the link has no id value:
<% for article in @articles %>
<tr>
<% for column in
2007 Mar 29
1
ActiveRecord attributes -- strange behavior when adding Array to an element
Hi,
I have a database table and associated ActiveRecord model. I was
trying to store (temporarily) an array in one of the attribute
elements - not to save it, but just so that I can keep some form data
in a sensible place. A stripped down version of the problem I''m having
is:
p = Property.new(:bedroom_count => ["2","3"])
puts p.inspect # ==> will correctly show
2008 Dec 20
9
Upgrade to Rails 2 - problem with "save" (MySQL boolean issue?)
I have been working through an upgrade of my 1.2.6 application to
2.2.2.
I am almost there but I have hit a problem with ActiveRecord.
Before the upgrade, the following code was working fine.
def create_root(administrator)
root = create_root_collection(self.pingee_name,
administrator,
2006 Apr 09
8
Computer Name
How to get the name of the computer accessing the application? I mean
the computer the user use to access the application.
Thanks,
Lantis.
--
Posted via http://www.ruby-forum.com/.
2006 May 23
6
Accessing file in public directory
How do i access a file in the public directory of rails application? I
have several html files in there and i want to link them from the rhtml
file. Basically to display a popup. Here is the code in foo.rhtml:
<a href="javascript:popUp(''/summary.html'')" class="normal">Learn
more</a>
It doesn''t work. Any idea why?
Thanks,
Lantis.
--
2011 Oct 02
4
Aggregated attribute changed but _was is changed too. So nothing is update in database.
(Frenchy, sorry =) )
Hi everyone, i''ve got some troubles with aggregated attribute.
I created a point and path class which receive postgresql point and
path type data. Path object contains an array of point object.
I''m currently working on a "hunting" module in web browser based game,
and i need a crontab executed every n minutes to move the character on
the map.
2006 Apr 07
3
Different validation for different users
Hi,
I have two types of users; normal user and admin.
I have a field called priority in the table task.
This priority field is invisible to the normal user, but not to the
admin. The admin has to fill in the priority field when he adds a record
via filling a form. Thus, i need to add validates_presence_of :priority
to the model task. But, if i do this, then the normal user can''t add a
2006 Sep 04
2
"include" versus "extend" - what's the difference
Hi,
Just wondering when one would use "include" over "extend"? Both seem to
bring in methods to the class no?
The context is I''m just trying to understand why both are used with the
acts_as_audited plugin:
Full extract from plugin (used within here):
==================================================
# Copyright (c) 2006 Brandon Keepers
#
# Permission is hereby
2006 Apr 08
2
Multiple submit buttons
Hi,
How do i differentiate different submits tags / buttons on one form. Say
I want to create an edit form and I want to provide two buttons; one to
save and one to cancel. I would have:
<%= submit_tag ''Ok'' %>
<%= submit_tag ''Cancel'' %>
How do I know which button get pressed by the user?
One more thing, how to specify the default selection in a
2009 Mar 03
2
Passing an SQL fragment in AR save
I have a basic model class TestTime with no customization.
class TestTime < ActiveRecord::Base
end
I would like to pass the following SQL fragment as part of an AR save
call to TestTime objects. How and where would I do this in the model?
"set c_time=current_time"
(current_time is an SQL method, not a variable).
--
Posted via http://www.ruby-forum.com/.
2006 Mar 31
2
W3C Standard
I''m rather new to web programming. I''m wondering, does rhtml file
conform to W3C standard? Or is there a way to make it conform to W3C
standard?
Thanks,
Lantis.
--
Posted via http://www.ruby-forum.com/.
2007 Apr 27
3
attachment_fu content_type problem
Hi all....
Admittedly I''m new to Rails and trying to find my way but I''m having
an issue with uploading documents with attachment_fu.
I have a form where I''m uploading multiple attachments (using AJAX to
add file_filed_tags). That seems to work pretty well. The problem is
I can''t seem to get the content_type to work as I would expect. For
example, if I use
2005 Dec 16
4
Validation with Aggregation
ActiveRecord supports composed_of for value objects which is
fantastic but one thing that it doesn''t seem to support (or at least
I am unable to find any documentation for) validation of the value
objects.
For example, given the following:
class Message < ActiveRecord::Base
composed_of :sender, :class_name => ''EmailAddress''
composed_of :recipient,
2010 Apr 20
13
why is ActiveRecord tying to select nonex ID column?
I''ve loaded (and updated) thousands of these MeteredUsage records. In
the middle of a run, I suddenly get:
ActiveRecord::StatementInvalid: Mysql::Error: Unknown column ''id'' in
''where clause'': UPDATE `metered_usages` SET `cost` = 12603.46 WHERE `id`
= NULL
I can''t see anything that''s different about this particular record
compared to
2011 Sep 17
3
[PATCH 1/1] hivexml: Base64-encode non-printable data
Some of the data in names and string values were being unsafely printed,
causing some types of XML processors to fail (e.g. Python's Expat).
This patch checks for printability of each character and outputs base64
with an encoding attribute for unsafe data.
---
xml/hivexml.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 64 insertions(+), 11 deletions(-)
2006 Jul 27
9
Introspecting validates_presence_of
Hello people,
I''d like to detect whether an attribute of a model has
vaildates_presence_of applied to it so I can automatically apply a
mandatory (*) to the field...it doesn''t look easy...any ideas?
Cheers,
--
Dan Webb
http://www.danwebb.net
2005 Dec 30
5
HABTM with finder_sql problem (Rails bug?)
I''m building an app that needs i18n support across the entire database
(i.e. localized attributes). In order to do this I''ve created a
special HABTM join table that can be associated with _any_ other
table:
create table language_strings (
for_table varchar(255) not null,
foreign_id int not null,
language_id varchar(5) not null,
attr_name varchar(255) not null,
value text
2006 Jun 01
1
Automatted Getter/Setter
Hey..
So I have a model that has a lot of number fields. Each of these go
through a process when read in and read out to add/remove commas
(between every three numbers) to make them more readable.
The getter I currently have is like this:
def sale_price
Listing.insert_commas(read_attribte (:sale_price))
end
and the setter is:
def sale_price=(price)
write_attribute(:saleprice,
2006 Apr 10
1
Add Column After Column in Migrations
Adding a column to a table just places the column at the end, but I
like to keep related columns together. Is there a way to specify
where the column is added in a table with migrations? For example, in
MySQL you can do:
ALTER TABLE my_table ADD COLUMN new_column INT AFTER other_column
I was hoping migrations would support something like this:
add_column :my_table, :new_column, :integer,