On Nov 26, 9:43 pm, "Greg Hauptmann" <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> When/where does Rails convert "params" used to populate a model object
> from a form, into their correct types in the model object??? (i.e.
> from "string")   What part of rails does this?
>
Well it's the call to column.typecast here:
http://github.com/rails/rails/tree/2-2-stable/activerecord/lib/active_record/attribute_methods.rb
Which is defined here:
http://github.com/rails/rails/tree/2-2-stable/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb

(but possibly overriden by individual connection adapters).

How that interacts with BaseWithoutTable I have no idea.

Fred
> I have a form upload and in my create method where I go
> :@graph_options = GraphOptions.new(params[:graph_options])" it is not
> doing the type conversion, as the attributes remain as strings.
>
> Note I am using BaseWithoutTable
>
> ------------------
> class GraphOptions < ActiveRecord::BaseWithoutTable
>   column :label_title, :string
>   column :start_date, :date
>   column :end_date,   :date
>   column :granularity, :integer
>   column :chart_type, :integer
> .
> .
> .
> ------------------
>
> thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to