Nice use for option_groups_from_collection_for_select (!!)

eliminated 2 db calls by using option_groups_from_collection_for_select in view (new/edit) for percentage statistics.
Full tag:

<%= option_groups_from_collection_for_select(@browsers, :browser_versions, :browser_name, "id", :version_name, @percentage_statistic.browser_version_id) %>

Again I am glad I don't call all name columns just 'name' in my tables. It's too confusing when doing tags like this!
Also added dependent => destroy for user => user_level relationship (user model).

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s