Displaying 20 results from an estimated 70000 matches similar to: "Overriding Human Name"
2009 Apr 24
4
Overriding Model Name
If I understand things correctly, by default, Rails expects both the
ActiveRecord class name and the model name (i.e., the name of the file
that contains the definition of the ActiveRecord class) to be the
singluar of the table name. How can I override this default behavior
with respect to the model name? That is, I would like to have the
file name of the file that contains the definition of the
2006 Jun 01
3
more questions: human_name
One more question:
Is there some way to set the human_name of a column? e.g.: human_name
for column address1 shouldn''t be Address1 but "Address, line 1".
If not, should I make a hash with my custom names?
Best regards,
--
----------------------------------------------------------------------
Yannick Majoros http://www.inma.ucl.ac.be/~majoros
Informaticien UCL/INMA-MEMA
2006 Mar 11
0
Ruby-GetText-Package-1.3.0
Hi,
Ruby-GetText-Package-1.3.0 is now available.
Now ActiveRecord::Column.human_name values translate automaticaly.
Changes for RoR
---------------
* Improve Local::Object
* POSIX, C convert to "en".
* Enhance supports of Ruby on Rails.
* ActionMailer localization support.
* Use GetText function(_() N_() etc) in template.
* ISO-2022-JP charset is used when language
2006 May 26
1
Overriding default type mappings of ActiveRecord
Hi:
Is there a good way to override the mappings between class variables
and database column type as determined by activerecord ?
I have a column in the database table (postgres) that is declared as
numeric(1000,0) which is an exact precision type. However, activerecord
maps the correspoding class variable to type float which will not work
for me. I''d like to map it to ruby type Bignum
2008 Apr 22
0
Overriding to_xml() - Why Does This Work?
In Chapter 5 of his book, Flexible Rails, Peter Armstrong''s leads his
readers through an exercise to override the behavior of to_xml() in
ActiveRecord objects so that :dasherize would be false by default. I
found his solution inelegant. I came up with a more elegant one, and
it seems to work.
All I did was add the following to the very end of myapp/config/
environment.rb:
class
2006 Mar 07
0
Overriding date helpers in a logical way
Short story: I need to use a different style of inputs to enter
datetimes. What I want is to be able to implement these while still
retaining the niceties of the built-in input helpers, like
ActiveRecord error handling and automatic reconstitution of a single
Date object from multiple form elements. What''s the best way to go
about this?
Long story: My form has one standard month
2006 Jan 17
0
Overriding Delete/Destroy in ActiveRecord
Anybody know how I can override delete/destroy in objects that have
has_and_belongs_to_many behavior specified?
I''m having issues overriding delete for an ActiveRecord object that
contains a has_and_belongs_to_many relationship. Delete and destroy
are properly overridden for objects that do not have
has_and_belongs_to_many relationships specified, but as soon as I add
any the overridden
2006 Dec 21
7
Overriding types?
"Service and class definitions are scoped just as variable assignments are."
But what about types?
Here''s an example:
class solserver inherits server {
remotefile { "/etc/shadow":
mode => 400, group => staff,
source => "solall/etc/shadow.server"
}
Is it possible to just override the "/etc/shadow" definition for
2005 May 14
6
HELP!! Serious memory leak in my rails app!!
I''m having a huge memory leak problem with a rails application I''m developing!
I first noticed that when running under webrick (via script/server) there was
a fast memory leak.. several users using the app for a few hours would use 2
gig of memory!!!
I searched the archives and found that some users found that it could be
avoided by saying --daemon when launching webrick..
2007 Nov 29
2
Overriding resources in a define in a module - can''t get syntax right
Maybe it works, maybe it doesn''t, but I sure as hell can''t make it work.
I get stuck with
"Could not find object(s)" whatever I do
This is my module init.pp
class ztest::setup {
notice "MAIN SETUP CLASS"
file { directfile:
path => "/etc/directfile",
owner => root, group => root, mode => 0644,
content
2006 Jun 23
0
Overriding a file_column attribute in model
I have a user model subclassed into Employees and Managers using STI. I
am using FileColumn to manage images, in this case logos. If an Employee
doesn''t have a logo of its own, I want my app to use the Manager''s logo
in views.
I did the following in models/users.rb:
-------
class User < ActiveRecord::Base
file_column :logo
end
class Employee < User
belongs_to
2007 Nov 18
0
Trouble overriding default accessor/mutator
I have a database column storing a duration value as a number of
seconds, but I''d like users to be able to see it and edit it as a time
value. I am trying to override the default accessor/mutator for the
attribute and do the conversions there, using something that looks
like:
def duration
Time.at(self[:duration].to_i).getutc
end
def duration=(value)
self[:duration] = value.to_i
2007 Jan 25
3
overriding file in a class
Hello,
i use a file type to manage sysctl.conf. For some work i override this file by doign File[''/etc/sysctl.conf''] and i
have an exec refresh only to run sysctl -p so it reread the sysctl.conf file if changed.
My issue is that at each run i got, i start in state when i see the overriden one on the server:
1st run, i have the basic sysctl.conf not the ovveriden one
2006 Feb 27
1
Undefined Method Error in View
After messing around with PHP for over a year, I took one look at Ruby
on Rails and fell in love. But it''s one of those confused "Men are from
Mars, Women are from Venus" type things...
I''ve written a method which does find_by_sql to pick a random row from a
database. When I call that method I get an "undefined method ''text'' for
..."
2008 Jun 04
2
Overriding default ActiveRecord behaviour
Hello everybody,
By default doing like this:
person = Person.new
person.name = "John"
person.save!
Will cause a new row to be inserted into database. But I don''t want it
to be saved into DB, instead when "save!" method is called I want to
connect to a particular URL and post data to it.
For instance:
POST http://my.app/people/create
"name" =>
2009 Aug 17
1
Problem with setter override on ActiveRecord
(This message was originally written on StackOverflow -- the
formatting is much prettier there --
http://stackoverflow.com/questions/1283046/problem-with-setter-override-on-activerecord)
This is not exactly a question, it''s rather a report on how I solved
an issue with write_attribute when the attribute is an object, on
Rails'' Active Record. I hope this can be useful to others
2006 Sep 29
1
newbie Q: it won't display foreign keys...
I have two tables
CREATE TABLE continents (
id int(11) NOT NULL auto_increment,
name varchar(255) NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE countries (
id int(11) NOT NULL auto_increment,
name varchar(255) NOT NULL,
continent_id int(11) NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
I generate scaffolds for country and for
2005 Dec 27
3
myObject.send(column.name) from Agile Development book
I''m studying the Agile Development with Rails book. In the chapter that
first sets up the depot application (page 68), there is this bit of code
from a view:
<% for product in @products %>
<tr>
<% for column in Product.content_columns %>
<td><%=h product.send(column.name) %></td>
<% end %>
etc...
I am trying to absorb both Ruby and
2006 Mar 14
7
Overriding new or create for a model
I have a model where I need to calculate one of the fields when I create
a new instance. It seems to me that I should do this in the model code
and that I should override the new and/or create methods.
Is this the right approach and, if so, how can I execute the existing
method but add on my calculation?
I want something like:
def create
-Do the original create first-
field =
2013 Oct 02
2
When overriding the registration controller from devise, is it possible to access the newly created
I''m trying to create a folder right after a user registers, so I override
the create action on the registration controller (devise) but I don''t know
how to access the newly created user in order to create the folder with
it''s name to upload files later.
So far I''ve got this:
class RegistrationsController < Devise::RegistrationsController
def new