Displaying 20 results from an estimated 500 matches similar to: "Keeping DRY - I like a simple life!"
2006 Mar 16
4
calling an actionview method from inside a model
Hi,
I would like my model instance to produce it''s own list of options for
a form select. This is from a product model that has_many variations
def alts_for_select(current_id)
the_map = variations.map{|v| [v.name, v.id]}
options_for_select(the_map, current_id)
end
the model cannot see the options_for_select method
I tried to use
2006 Feb 14
10
acts_as_versioned and getting authors
Hey guys and gals,
I have the following object that has acts_as_versioned:
class Note < ActiveRecord::Base
acts_as_versioned
belongs_to :user
end
The schema for my notes table is as follows:
create_table :notes, :force => true do |t|
t.column :id, :integer
t.column :noteshare_id, :integer
t.column :user_id, :integer
t.column :title, :string
2006 May 15
8
set_table_name and self.table_name
I have some legacy tables that I used set_table_name on, I''m attempting
to write a method that will get key value from a sequence table and then
update it and return a value. I''m hoping to put this in the base
ActiveRecord method so I would like to reference the table name with
self.table_name or something...
class Contacts < ActiveRecord::Base
set_table_name
2007 May 27
3
Stripping out textile markup
Hi,
I have several hundred pages of text, all carefully marked up with
textile, which I use redcloth to convert to html for display. Now I
find I need all these pages to alternatively output plain text - ie.
A-Za-z0-9 and simple punctuation only. Any suggestions on the best
way to do this? My only thought is to let redcloth do its stuff, and
then strip out the html tags - but it feels wrong.
2006 Aug 13
3
+ migrations in camping
Camping apps are supposed to be little independent apps, often contained in a
single file, which create the database tables and manage them without hassle.
These days it''s common to see in a Camping app:
module Tepee::Models
def self.schema(&block)
@@schema = block if block_given?
@@schema
end
end
Tepee::Models.schema do
create_table :tepee_pages,
2006 Aug 10
1
acts_as_textiled
It''s nothing revolutionary. Just a plugin which lets you forget about
the whole Textile to HTML render process. Once you tell your model
which fields should acts_as_textiled (and as long as you''re using
form_for for your text entry) it Just Works. No DB changes or
whatnot.
Here''s the skivvy: http://errtheblog.com/post/14
Tips and tricks in that post and README.
2007 Jan 16
4
question about sessions and code re-use
hey there,
i have a simple model called key_words.rb
the purpose of this is to hold system config data.
it also holds the parameters that our system uses to judge the
condition of the stuff we monitor.
anyway, one of the methods is this
def self.get_in_wet_list(status)
wet_list = find(:first,
:conditions => "name = ''wet_list'' ")
2004 Apr 14
2
Problem creating new domain in unstable
Hi,
I just had a try using the xeno-unstable. When I used the xc_dom_create.py to create a new domain I got the followings:
==============================================
Traceback (most recent call last):
File "/usr/bin/xc_dom_create.py", line 332, in ?
(current_id, current_port) = make_domain()
File "/usr/bin/xc_dom_create.py", line 238, in make_domain
2007 Feb 26
2
undefined method ... from `alias_method'
0 wicked var/www % ./script/console
Loading development environment.
>> r = Recipe.find :first
NameError: undefined method `recipe_type='' for class `Recipe''
from ./script/../config/../config/../app/models/recipe.rb:
101:in `alias_method''
In recipes_controller:
alias_method :orig_recipe_type=, :recipe_type=
def recipe_type=(t)
if t.nil?
2004 May 20
1
xc_dom_create.py cpu flag
I pulled unstable yesterday and noticed xc_dom_create.py does not have
a default value for cpu, so python complains
Traceback (most recent call last):
File "/usr/bin/xc_dom_create.py", line 408, in ?
(current_id, current_port) = make_domain()
File "/usr/bin/xc_dom_create.py", line 234, in make_domain
id = xc.domain_create( mem_kb=mem_size*1024,
2006 Aug 15
1
Camping with Dr. Nic
Campers. Dr. Nic.
The new migrations in Camping''s trunk are very nice. They also open
the door (just an inch) to using Dr. Nic''s Magic Models with Camping.
Here''s my stab at ''er:
http://require.errtheblog.com/camping/blog.rb
Run that against Camping trunk. Don''t forget to `sudo gem install
dr_nic_magic_models`.
The hackery is in
2006 Jul 21
1
RedirectHandler? mongrel_rewrite?
Hey guys.
I''ve been playing with RedirectHandler and it''s pretty neat, but I
question its usefulness.
At work we do the trendy "/javascripts/spy.1152734636.js"-style asset
includes rather than the default Rails style of "/javascripts/spy.js?
1152734636". This is no problem with mod_rewrite as we run the basic
Apache => Pen => Mongrel setup.
2006 Aug 10
6
Multiple sites using one data source
Hi,
Just wondering if anyone has any suggestions as to the best way to
provide access to the same data source for the (possible) creation of
multiple web sites. I figure my options are:
- Direct database access over tcp
- ActionWebService
- Wait for ActionResource
I''ve done up some work with ActionWebService already, but I don''t think
it''s going to work because it
2000 Jul 19
1
Followup to Rok Papez's tests
I first downloaded Vorbis about a month ago, around the time Rok Papez posted
comparisons of Ogg and Lame [*]. Here's my much rougher test on a single file.
CPU: AMD K6-233
MP3: LAME 3.70, mp3blaster 2.0b6
Ogg: Vorbize 0.6 (Xiphophorus libVorbis I 20000718), ogg123-0.1
Data set: Ministry, "The Fall" (51,955,724 byte WAV)
* * *
Ogg Vorbis command line:
time vorbize -v -w
2023 Feb 15
1
Evaluation of the Samba-tools rename functionality
HI,
Just an update on this samba-tool (V4.17.4) ..rename functionality, against a 2008SP2 level AD.
(also in case anyone else is mad enough to want to attempt this.)
The rename tool, seems to do a fairly good job,
However there are a couple of other fields that could do with being flushed/fixed during the rename.
This one which breaks MS tools(with continuous looping & modal
2006 Aug 13
1
establish_connection method
I''m digging into rails source code.
But I''ve got a problem in undestading actionrecord::base source code
which is connection_specification.rb.
In the body of establish_connection method,
def self.establish_connection(spec = nil)
case spec
when nil
raise AdapterNotSpecified unless defined? RAILS_ENV
establish_connection(RAILS_ENV)
2006 Jul 01
3
Captchas in Rails
Hello Everyone,
I was wondering what people on this list were using to generate captchas
within forms on sites they are developing? I know there is a ruby gem named
captcha, but I have seen some others floating around as well.
Thanks,
Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2007 Jan 16
1
Can't pass parameters to Ziya controller using url_for
Hi All,
I''m stuck yet again. I have an action on a controller that produces a
Ziya graph, which I call using the gen_chart() helper. However, I can''t
seem to pass more than one parameter through to the action.
<%= gen_chart( "overview_graph",
url_for( :controller => ''graph'', :action => ''graph'', :graph_id =>
2009 Jan 15
4
time sync issue
I am running a Samba domain controller with LDAP integration. I have at
least some workstations which do not seem to be syncing the time with the DC
at all. My first instinct is to simply set the time with a logon script, but
of course that runs as the user, whom does not have permission to set the
system time. I would prefer to get it working right, to where the system
syncs its time with the
2024 Oct 23
1
Security of ssh across a LAN, public key versus password
On 21.10.24 20:26, Chris Green wrote:
> I have a small LAN at home with nine or ten systems on it running
> various varieties of Linux. I 'do things' on the LAN either from my
> dekstop machine or from my laptop, both run Xubuntu 24.04 at the
> moment.
>
> There's a couple of headless systems on the LAN where login security
> is important to me and I've been