btw, my new action has this:

@key = TranslationKey.new
@key.translation_values.build



On May 4, 10:24 pm, oren <[email protected]> wrote:
> My models are TranslationKey, TranslationValue and KeyValue.
>
> Here is the relevant part in the log: (the last two lines are
> identical inserts!)
>
> Processing TranslationKeysController#create (for 127.0.0.1 at
> 2010-05-04 22:13:31) [POST]
>   Parameters: {"commit"=>"Create", "authenticity_token"=>"J+dt/
> qHwHkbKygh0wBPnXPLtpkb3Pb8URxGucEbpLa0=",
> "translation_key"=>{"name"=>"key1",
> "translation_values_attributes"=>{"0"=>{"text"=>"value1"}}}}
>
> INSERT INTO `translation_keys` (`name`, `created_at`, `updated_at`)
> VALUES('key1', '2010-05-04 22:13:31', '2010-05-04 22:13:31')
> INSERT INTO `translation_values` (`created_at`, `updated_at`, `text`,
> `language_id`) VALUES('2010-05-04 22:13:31', '2010-05-04 22:13:31',
> 'value1', NULL)
> INSERT INTO `key_values` (`translation_key_id`,
> `translation_value_id`, `created_at`, `updated_at`) VALUES(16, 27,
> '2010-05-04 22:13:31', '2010-05-04 22:13:31')
> INSERT INTO `key_values` (`translation_key_id`,
> `translation_value_id`, `created_at`, `updated_at`) VALUES(16, 27,
> '2010-05-04 22:13:31', '2010-05-04 22:13:31')
>
> And here is the new template:
>
> <% form_for(@key) do |f| %>
>   <% if f.error_messages.length > 0 %>
>     <div class="error-message">
>       <%= error_messages_for :translation_key, :header_message =>
> 'Error', :message => '' %>
>     </div>
>   <% end %>
>
>   <p>
>     <%= f.label :name, 'Key name' %>
>     <br />
>     <%= f.text_field :name %>
>   </p>
>
>    <p>
>     <% f.fields_for :translation_values do |value_fields| %>
>       <%= value_fields.label :text, 'Content' %>
>       <br />
>       <%= value_fields.text_area :text %>
>     <% end %>
>   </p>
>
>   <p>
>     <%= f.submit 'Create' %>
>   </p>
> <% end %>
>
> --
> 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 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
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