Newbie----what's wrong with my code

I know i’m new with ruby and i’ve been kind of confused with how rails
manages all the details. I want to store the key-values in different
columns on my database so that when I enter a eky, it gies me the
corresponding value. this is what i have:

my view:

Importing Strings

<%=error_messages_for("string_record")%> <%= start_form_tag({:action => 'save'}, :multipart => true)%>

Lenguage:
<%= select("variable", nil, @array_of_lenguages) %>

Path:
<%= file_field ("string_record", "import_strings" )%>

<%= submit_tag "Import"%>

<%= end_form_tag%>

my save method in my controller:
def save
@string_record = StringRecord.new(params[:string_record])
if @string_record.save
redirect_to(:action=>‘show’, :id =>@string_record.id)
else
render(:action=>:get)
end
end

this is my active record class:

class StringRecord < ActiveRecord::Base

def import_strings
table = { }
IO.foreach(‘Localizable.strings’) { |line|
if line =~ /^ \s* " (.?) " \s = \s* " (.*?) "/x
table[ $1 ] = $2
end

table.eabh do |key, value|
string_record.create(:key => $1, :value => $2)
end

}

end
end

Can anybody help me out by guiding me in the right direction?

Any help will be highly appreciated.

rich

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs