Displaying 7 results from an estimated 7 matches for "before_type_cast".
Did you mean:
_before_type_cast
2006 Jun 14
0
Custom Primary Key, Using Primary Key in Form gives "before_type_cast" error?
...''user'', ''user_password'', :MAXLENGTH =>"20" %>
<%= submit_tag "Login" %>
<%= end_form_tag %>
I get an error
NoMethodError in Login#login
Showing app/views/login/login.rhtml where line #11 raised:
undefined method `user_id_before_type_cast'' for #<User:0x3cb61e8>
Extracted source (around line #11):
8: </tr>
9: <tr>
10: <td>Username</td>
11: <td><%= text_field ''user'', ''user_id'', :MAXLENGTH =>"10" %></td>
12: </t...
2006 Jun 13
2
Custom Primary Key, Using Primary Key in Form "gives before_type_cast" error?
...''user'', ''user_password'', :MAXLENGTH =>"20" %>
<%= submit_tag "Login" %>
<%= end_form_tag %>
I get an error
NoMethodError in Login#login
Showing app/views/login/login.rhtml where line #11 raised:
undefined method `user_id_before_type_cast'' for #<User:0x3cb61e8>
Extracted source (around line #11):
8: </tr>
9: <tr>
10: <td>Username</td>
11: <td><%= text_field ''user'', ''user_id'', :MAXLENGTH =>"10" %></td>
12: </tr>...
2006 Jul 03
4
text_field doesn''t call overridden ActiveRecord getters
All,
In a template, I have
<%= text_field :target_list, :DateReceived,
{ :title => ''uploaded_at'',
:class =>
''target_list_info'',
:disabled => ''true'' } %>
Here is the DateReceived method on my
2006 Mar 17
3
Timestamps casted to nil?
..."=>nil, "lastlogin"=>"13.03.2006 16:04:58",
"password"=>"cbd8f7984c654c25512e3d9241ae569f", "login"=>"PS12345",
"email"=>"jan.foeh@parship.de"}>
>> puts me.valid_from
nil
=> nil
Using before_type_cast, I can see the content is still there, albeit as
string:
>> puts me.valid_from_before_type_cast
01.03.1999 14:09:21 CET
=> nil
Saving a modified object sets all timestamps to nil:
>> me.valid=0
=> 0
>> me.save
ActiveRecord::StatementInvalid: PGError: ERROR: null value i...
2006 Aug 14
1
What fields_for really for?
...n edit.rhtml for SuburbController I need to specify region_id.
There is no region_id in suburb model so first I added these lines to
it:
...
class Suburb < ActiveRecord::Base
belongs_to :district
attr_writer :region_id
def region_id
district.region_id if district
end
def region_id_before_type_cast
region_id
end
validates_numericality_of :region_id, :only_integer => true
end
...
Its all working now but it looks messy! And I need this functionality in
another few places. Obviously I dont want to put this rubbish into other
models!
I recently come across fields_for helper. So I c...
2006 Jul 02
7
How can I intercept attribute calls?
Hi.
I have two types of fields in my database, e.g. "name" and "name_ru".
First one is a user''s name in english and the second one is in russian.
I want to intercept calls like "c.name" and add "_ru" to it if current
language is russian (I have my own Locale class like n Globalize).
So I want such thing:
--
Locale.set("en-US")
c.name
2006 May 09
11
model filter?
Hi All,
Is there a way to filter / modify the output of a model class before
it''s returned to controller/view that''s calling it?
Example: I have a field phone_number which I always want to preformat
using the number_to_phone() helper....
Any help is appriciated.
Thanks!
--
Posted via http://www.ruby-forum.com/.