Displaying 20 results from an estimated 4000 matches similar to: "ActiveRecord subclassing best practises"
2006 Apr 06
4
Lighthttpd not working as default (configuration?)
Hi,
On the api doc it is written that if lighttpd is installed, rails will use it as its web server instead of WebBrick.
I have installed lighthttpd and verified it works (for example on the default port 80) but when lauching script/server, it still uses WebBrick.
I wondering if I need to edit /etc/lighttpd/lighthttpd.conf myself or configure something else.
Any idea?
Thanks
Oscar
2005 May 04
1
Conditional validations
I''ve been working with the problem that Joe Hosteny has been talking
about on this list and on the tickets he''s posted
(http://dev.rubyonrails.com/ticket/1196) and have come up with a
tentative solution that I''d like to bring up here.
What if we use a "conditional" parameter in the validates_* methods?
Here''s how it would look like in practice:
2006 Apr 04
2
Default logger inside arbitrary classes
Hi,
What''s the best way to get the default logger (the one used during the tests) from inside a class that doesn''t inherit any rails class?
Thanks
Oscar
---------------------------------
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1¢/min.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2006 Jan 30
1
Either/Or Validation
How would I use validations to ensure I either received a blank value or
a ten digit number?
If I set validates_length_of :field, :in => 0..10 then that would allow
any value in-between. The allow_nil => true option does not seem to
work.
I''ve also tried using this with some combination of
validates_numericality_of but cannot get it to work.
Any help would be greatly
2007 Oct 13
4
Chapter 9
Hello,
I''m currently stunk on this issue for few days and I do not know how
to get it fixed.
The system always raises this error message :
order is closed
and here is my order.rb:
class Order < ActiveRecord::Base
include ActiveMerchant::Billing
before_validation :set_status
attr_protected :id, :customer_ip, :status, :error_message, :updated_at, :created_at
attr_accessor
2007 Mar 28
4
Disabling ActiveRecord "type" column subclassing
Hi! I have a legacy table that has a column named "type" and need to
remove this automatic subclassing by ActiveRecord. The api pages are
vague about this, and I tried
self.inheritance_column = "xtype"
which seemed to get me half-way. In the validate_on_create method, the
value of self.type was my model Class name.
How would you disable this feature?
--
Posted via
2006 Feb 21
8
Validations continued
I simply can''t figure this out. I have been reading and re-reading Agile
book and wiki.rubyonrails.org - all sorts of validation methods and
still, it doesn''t work.
Controller code
def create
@client = Client.new(params[:client])
if @client.save!
flash[:notice] = ''Client was successfully created.''
redirect_to :action =>
2012 Dec 06
2
[LLVMdev] subclassing MCELFStreamer
Hi Jim, Daniel,
The last time the topic of subclassing MCELFStreamer came up, you both were
helpful in identifying ways to handle the use case without requiring
subclassing. Can you please take a look at the context below and let me know
if you have any suggestions?
For reference, this was posted to the list yesterday under the subject
"sub-classing MCObjectStreamer?":
> Okay,
2006 Jul 17
19
updating model
hello,
i am writing a simple user login system.
when registering a user account, i have two field:
password
password_confirmation
which are validated using
validates_presence_of
validates_confirmation_of
and these are then used to generate a password hash which is stored in
my database
when i want to update the record (without changing the password and
entering new values for password and
2012 Dec 06
0
[LLVMdev] subclassing MCELFStreamer
Hi Mario,
On Thu, Dec 6, 2012 at 4:08 PM, Mario Guerra <mariog at codeaurora.org> wrote:
> The last time the topic of subclassing MCELFStreamer came up, you both were
> helpful in identifying ways to handle the use case without requiring
> subclassing. Can you please take a look at the context below and let me know
> if you have any suggestions?
Subclassing MCELFStreamer is
2012 Dec 06
1
[LLVMdev] subclassing MCELFStreamer
> Subclassing MCELFStreamer is probably also necessary to implement mapping
> symbols on ARM ELF targets (see the current thread at
> http://comments.gmane.org/gmane.comp.compilers.llvm.cvs/124737).
>
> Your refactoring patch on phabricator appears to be a functional subset of
the one
> I've posted (though obviously not textually identical). As a smaller
patch, it may be
2010 Nov 11
5
ActiveRecord query
I have these sql code in postgresql
"SELECT * from convenios where id NOT IN
(SELECT convenio_id from solicituds where usuario_id=?"
but don''t find a way of used it in rails
except
find_by_sql.
There is a another way??
class Usuario < ActiveRecord::Base
belongs_to :persona
has_many :solicituds, :dependent => :destroy
has_many :convenios, :through =>
2011 Nov 15
0
[LLVMdev] MCELFStreamer subclassing
On Nov 15, 2011, at 10:36 AM, Carter, Jack wrote:
> Jim,
>
> Ok, you are where I am in the understanding. This is exactly what I do for relocations applied to code. Now I want to apply fixup information to relocations applied to data.
>
> The issue I was having was the difficulty of subclassing MCELFStreamer. Or are you saying that I should be messing with the base MCELFStreamer
2007 Feb 13
4
Best Practises => Keep Pool Below 80%?
In the ZFS Best Practises Guide here:
http://www.solarisinternals.com/wiki/index.php/ZFS_Best_Practices_Guide
It says:
``Currently, pool performance can degrade when a pool is very full
and file systems are updated frequently, such as on a busy mail
server. Under these circumstances, keep pool space under 80%
utilization to maintain pool performance.''''
2007 May 27
12
Checking for Range
how would you check for a range using rspec?
person.password.range.should == Range.new(5..40) <- this doesn''t work
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070527/4d8cb007/attachment-0001.html
2007 Mar 29
4
validates_length_of not working with :if ?
Hello,
I''m trying to cut down the errors if the guy already getting the empty
nickname, so he doesn''t get anything about the nickname is short.
validates_presence_of :nickname
This below is not working ?
validates_length_of :nickname, :within => 4..40, :if => Proc.new {
|user| user.nickname.length > 1 }
nor this one below?
validates_length_of :nickname, :within
2005 Sep 25
2
Problem issue with belongs_tohas_one and error_message_on
Hello
I have a problem with relationship with belongs_to - has_one and with
error_message_on
I have splitted one huge table users into two tables user and profile.
In users I''m keeping main fields like id,email,password and in profile there are
the rest of fields.
Table users:
id,email,password
Table profiles:
id,user_id,publicname, and more ...
My models are:
- user.rb
has_one
2011 Jan 17
1
[PATCH] Fix subclassing of LibVirtXMLSource
LibVirtXMLSource was subclassing an invalid class, and consequently didn't have
copy_storage defined.
Fixes RHBZ#670175
---
lib/Sys/VirtV2V/Connection/LibVirtXMLSource.pm | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/Sys/VirtV2V/Connection/LibVirtXMLSource.pm b/lib/Sys/VirtV2V/Connection/LibVirtXMLSource.pm
index e62d996..ffb9309 100644
---
2009 Dec 01
3
best practises for avoiding to write passwords in shell scripts (example sqlplus from Oracle)
Hi folks
I have here a CentOS box where i need to setup cronjob (with session
to remote Oracle instance). On the remote DB i have no access, expect
limited user.
How to avoid putting passwords in shell scripts?
The solution doesn't need to be perfect, only better than plain text
passwords in scripts.
Mostly remote host only support password authentication (no
certificates and so on).
2012 Aug 14
3
validates_format_of :message not working, validates_length_of :message is working
I''m using validates_format_of and the validation I want to do works, but I
can''t get an error message to be displayed if the data is invalid:
validates_format_of :mobile, :with => /\A[\+0-9]+\Z/, :message => " - Wrong"
I have another validation some where else that does display the error
message: " - Name is too long"
validates_length_of :name,