search for: find_by_key

Displaying 5 results from an estimated 5 matches for "find_by_key".

2006 Jul 06
4
Need advice on code-like columns
Hello! I''m trying to move to rails from traditional web app. As Rails has some conventions about table schema, I met some obstacles. Questions. 1. This is a sort of general question. Do you make a code table for things like the following? Activity Status Codes 01001: Open 01002: Pending 01003: Delayed 01004: Cancelled 01005: Closed (The first 2 digits are code category.) Would you
2006 Aug 13
2
Arbitrary "Columns" for ActiveRecord
...del''s properties somewhat like: Model.property_key = value # where property_key is dynamic/magic OR Model.get_property(key, value) The problem here is, that with this set up, the way I have it set up, I have Model#get_property set to this: def get_property(key) if key = PropertyKey.find_by_key(key) self.properties.find(:first, :condition => ["property_key_id = ?", key.id]).value else false end end and Model#set_property def set_property(key, value) if row = properties.find(:first, :conditions => ["properties.key = ?", key], :include => :prop...
2006 Jan 26
2
Easy way to add properties to a model?
Hi, I have a model (let''s say User) and I would like to add any number of user-defined-settings to this Model. I created a UserSetting Model with user_id, key and value. I connected them with has_many. I know how to access these properties from a user but I would like some methods like user.hasProperty? / user.getProperty ... I think I know how to write these methods/finders myself but
2009 Jun 20
0
problem with simlpe captcha
Hi simple captcha works fine on my app. recently I changed my hosting provider and moved the app to new server. Here its not working and throwing error ActionView::TemplateError (undefined method `find_by_key'' for SimpleCaptchaData():Class) on line #246 of home/register.rhtml: 243: </td> 244: <td align=left> 245: <br/> 246: <%=show_simple_captcha (:object=>"user", :label...
2010 Sep 12
11
Rails 3: finding a record by name in multilingual app
Hello, I upgraded my application from Rails 2 to Rails 3 and ran into a problem. In rails 2 I could use the english name of the record to find it like: Page.find_by_name("Welcome") even though the user chose German as the language (which of course showed the German welcome page. Eversince I switched to Rails 3 (default_locale still :en) I can''t find anything by giving the