Displaying 20 results from an estimated 28 matches for "default_value".
2006 Jun 06
1
Default value plugin
...n your
schema, I guess, but then it''s awkward if you need that on a
serialized field or need your default values calculated somehow.
So you can do something like this: (repeated from an earlier post and
the README)
class Mixture < ActiveRecord::Base
serialize :color
default_value :color, [255, 0, 0]
end
m = Mixture.new
m.color # => [255,0,0]
Here''s the README:
http://mdaines.com/svn/plugins/default_value/trunk/README
To install: (as usual)
script/plugin install http://mdaines.com/svn/plugins/default_value/
trunk
Thoughts, comments?
--
Mi...
2005 Dec 19
3
Is there a list of html_options for the FormOptionsHelper?
I''m looking for a way to select a default value from a select box, like
this:
select("user", "role_id", Role.find_all.collect {|r| [ r.name, r.id ] },
{ :default_value => ''5'' }
(of course, there is no ":default_value")
If the form is being used on a ''create'' page, it should display a
default in the select box. If the form is on the ''edit'' page, it should
display the current value.
Thanks,
cor...
2006 May 03
4
default values
Hello,
I''m working with a postgresql table
CREATE TABLE elements (
id serial primary key,
c1 text default f1(),
...
cN text default fN()
);
But if I use de lines
@element = Element.new
@element.save
the values that element take are the nextval in the id field and nules in
all the other fields.
How can I get the defaults?
(but without rewriting the
2010 Jan 19
0
best way to set default for an optional local in a partial?
What''s the best way to set the default value of an optional local
variable in a partial template?
In the past I''ve used
<% foo = default_value unless (defined? foo) %>
But http://api.rubyonrails.org/classes/ActionView/Base.html says *not*
to use (defined? foo) and instead use (local_assigns.has_key? :foo) thus
<% foo = default_value unless (local_assigns.has_key? :foo) %>
Some have suggested
<% foo ||= default_value %&...
2020 Jan 28
0
dict passdb: redis nil values
...lookup and the disabled lookup is done in the same passdb. I
was hoping that this configuration would work:
passdb {
name = redis
driver = dict
args = /etc/dovecot/dovecot-redis.conf.ext
}
---
uri = redis:host=127.0.0.1
key disabled {
key = users/%u/disabled/%s
format = value
default_value =
}
key user {
key = users/%u
format = json
}
passdb_objects = user
passdb_fields {
fail = %{dict:disabled}
}
Unfortunately, this will always set the fail passdb_field regardless of
whether the disabled key returns its empty default_value. Removing the
default_value setting will caus...
2006 Apr 13
5
Changing class data in environmrnt.rb
Greetings,
I have a class that should allow you define some default values. It
seems to make the most sense to do this environment.rb since its the
default app configuration. It currently looks like this:
Settings::DEFAULT_VALUES.merge!({
:setting_one => ''foo'',
:settings_two => ''bar''
})
The problem is in development mode, the values are only there for the
first request after launching webrick. After the first request the
entries have dissapeared form the class. In devel...
2013 Dec 02
1
Class parameter flexibility with ENC, hiera or both
...the only data binding.
But let''s say that within mymodule there is a define mymodule::mydefine
that uses variable values from mymodule, let''s say mymodule::parameter1.
I need to include mymodule to be able to use it, right? This is the example:
class mymodule (param1 = ''default_value'') {
}
define mymodule::mydefine () {
include mymodule ## just to make sure it was parsed before
case (mymodule::param1) {blabla}
}
If you only use Hiera as a data backend, you''re good: if you need to
override parameter1, you do it in the hierarchy, and the include does
n...
2005 Mar 03
12
bug in postgresql ''now'' time handling??
...53:54.290717
2005-03-03 09:53:54.290717
(4 rows)
it looks like (from only reading the code) that table_structure will map the
default values of each field in
column_defaults.collect do |row|
field = row[0]
type = type_as_string(row[3], row[2])
default = default_value(row[1])
length = row[2]
[field, type, default, length]
end
so, each time default_value sees ''now'' it will call Time::now.to_s - and this
will be different each time. it may not be obvious right away since, if the
code runs quickly and you are storing onl...
2019 May 16
0
File-dictionary based quotas and SETQUOTA
...use
the key is never found.
Here is my configuration :
----
userdb {
driver = dict
args = /etc/dovecot/dovecot-dict-quota.conf.ext
}
----
and my dovecot-dict-quota.conf.ext file :
----
uri = file:%h/Maildir/dovecot-quota
iterate_disable = yes
key quota {
key = priv/quota/limit/storage
default_value = 100
}
userdb_fields {
quota_rule = *:storage=%{dict:quota}
}
----
If I try to fetch the quota for that user :
# doveadm quota get -u ganael.laplanche at centralesupelec.fr
Quota name Type Value Limit...
2006 Jan 11
0
Limit attributes written out by to_yaml
...ll the field names and values which are stored in the
attributes hash. The output looks something like this:
- !ruby/object:Item
attributes:
image_height: ''''
maximum_value: ''''
minimum_value: ''''
item_id: 153
default_value: ''''
... many more fields
However I don''t want all these fields. How can I limit the YAML output
to just include the fields that I want?
I know that I can override to_yaml_properties to specify the fields that
i want from a class. But that really only lets me c...
2006 Aug 01
5
how do set default value for ActiveRecord fields?
Everytime a new record object is created i.e. Record.new, i want certain
fields to be the same.
Any idea how to do this?
Thanks
Chris
--
Posted via http://www.ruby-forum.com/.
2011 Mar 09
3
Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
Hi,
I am processing tick data and my code has stopped working as I have
increased the size of data being processed. Now I am receiving error for
basic tasks in RConsole:
> a = c(1:1000)
Error: evaluation nested too deeply: infinite recursion /
options(expressions=)?
My R code worked fine with 50 stocks and 500,000 rows per stock, but when I
increased this to 50 stocks and 5,000,000 rows per
2017 May 05
3
A few suggestions and perspectives from a PhD student
...t.
7) Default values for S4 methods
It would seem that it is not possible to set up default parameters for an S4 method in a usual way of definiton = function (x, y=5). I resorted to making class unions with ?missing? for signatures on the call, with the call starting with if(missing(param)) param=DEFAULT_VALUE, but it certainly does not improve readability or ease of coding.
Thank you for your time if you have finished reading thus far. :) Looking forward to any answer.
Yours Sincerely,
Antonin Klima
2007 Mar 27
0
[921] branches/wxruby2/wxwidgets_282/swig/Functions.i: Enable Wx::get_number_from_user to fix exception in samples/dialogs
...s = wxDefaultPosition);
</ins><span class="cx">
</span><span class="cx"> wxString wxGetTextFromUser(const wxString& message, const wxString& caption = wxT("Input text"),
</span><span class="cx"> const wxString& default_value = wxT(""), wxWindow *parent = NULL);
</span></span></pre>
</div>
</div>
</body>
</html>
2005 Apr 23
2
[Tip] Introspection to determine if a column may be null
I still want to get this into Rails for all connection adaptors, but
for now I''ve hacked my own addition on for just PostgreSQL.
The following code extends every Column object returned by
MyModel.columns to support a new #required? method, which indicates if
the column may or may not be null.
The following is a huge hack - suggestions on a cleaner way to add this
functionality
2017 Jun 08
1
Heal operation detail of EC volumes
...ature is available on 3.11.
> I did not see this in 3.11 release notes, what parameter name I should
> look for?
>
disperse.self-heal-window-size
+ { .key = {"self-heal-window-size"},
+ .type = GF_OPTION_TYPE_INT,
+ .min = 1,
+ .max = 1024,
+ .default_value = "1",
+ .description = "Maximum number blocks(128KB) per file for which "
+ "self-heal process would be applied simultaneously."
+ },
This is the patch: https://review.gluster.org/17098
+Sunil,
Could you add this to release notes...
2018 Feb 12
3
FreeBSD Core dump: PAM authentication with Kerberos credentials (GSSAPI_MIT)
...(str=0x0) at /usr/src/lib/libc/string/strlen.c:100
#1 0x0000000012130022 in strdup (str=0x0) at
/usr/src/lib/libc/string/strdup.c:46
#2 0x0000000011b65e9d in krb5_appdefault_string (context=0x10777000,
appname=0x106f0018 "imap", realm=0x0, option=0x13b1f403 "ticket_lifetime",
default_value=0x0, ret_value=0x7fffffffe088)
at appdefault.c:165
#3 0x0000000013af4a80 in krb5_appdefault_time (context=0x0,
appname=0xffffffffaaca6003 <error: Cannot access memory at address
0xffffffffaaca6003>,
realm=0x50 <error: Cannot access memory at address 0x50>, option=0x0,
def_val=0...
2017 May 05
0
A few suggestions and perspectives from a PhD student
...) Default values for S4 methods
> It would seem that it is not possible to set up default parameters for an S4 method in a usual way of definiton = function (x, y=5). I resorted to making class unions with ?missing? for signatures on the call, with the call starting with if(missing(param)) param=DEFAULT_VALUE, but it certainly does not improve readability or ease of coding.
>
>
> Thank you for your time if you have finished reading thus far. :) Looking forward to any answer.
>
> Yours Sincerely,
> Antonin Klima
>
> ______________________________________________
> R-devel at r-...
2017 May 08
3
A few suggestions and perspectives from a PhD student
...fault values for S4 methods
>> It would seem that it is not possible to set up default parameters for an S4 method in a usual way of definiton = function (x, y=5). I resorted to making class unions with ?missing? for signatures on the call, with the call starting with if(missing(param)) param=DEFAULT_VALUE, but it certainly does not improve readability or ease of coding.
>>
>>
>> Thank you for your time if you have finished reading thus far. :) Looking forward to any answer.
>>
>> Yours Sincerely,
>> Antonin Klima
>>
>> _____________________________...
2007 Jul 25
5
set_default_values rocket science - continuing after_initialize/after_find misfeature
Just starting a new thread so that it''s easy to follow.
I just submitted a patch at trac to add a new class method called
"set_default_values" ( not a great name I think ), which lets you do
all kinds of crazy stuff with setting default values.
This ticket is at http://dev.rubyonrails.org/ticket/9093 and example
pastie is at http://pastie.caboo.se/81925
It also lets you make use of other attributes ( set by supplying
attributes t...