Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* [#202] Fixed an issue with adding to the lexeme form when assigned to multiple dictionaries
* [#169] Short lists now only show the most acceptable headwords
* [#234] Fixed an issue with listing additional loci for potential constructions
* [#180] Fixed an issue that forced a restart to use newly-added languages

## Since 0.4.1
* [#89] Lexeme form now arranges etymology horizontally instead of by nesting
Expand Down
13 changes: 13 additions & 0 deletions app/controllers/languages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ def create

respond_to do |format|
if @language.save
update_accessors

flash[:notice] = t('languages.new.success')
format.html { redirect_to(@language) }
format.xml { render :xml => @language, :status => :created, :location => @language }
Expand All @@ -64,6 +66,8 @@ def update

respond_to do |format|
if @language.update_attributes(params[:language])
update_accessors

flash[:notice] = t('languages.edit.success')
format.html { redirect_to(@language) }
format.xml { head :ok }
Expand Down Expand Up @@ -94,4 +98,13 @@ def matching
format.js { render :partial => "autocomplete" }
end
end

private

# Update accessors for models that have accessors defined
def update_accessors
ActiveRecord::Base.descendants.each do |c|
c.globalize_accessors(locales: Language.defined_language_codes) if c.respond_to?(:globalize_locales)
end
end
end
2 changes: 1 addition & 1 deletion app/models/language.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def language

# Return an array of the language codes defined in the system.
def self.defined_language_codes
@defined_language_codes ||= all.collect(&:iso_639_code)
all.collect(&:iso_639_code)
end

# Given a string +query+,
Expand Down
2 changes: 1 addition & 1 deletion app/views/languages/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<%= form_for @language, { method: :post, action: 'create', html: {:class => "yform"}} do |f| %>
<%= # @action = "Create"
render(:partial => "longform", :for_url => "/#{I18n.locale}/languages", locals: {language_form: f} })
render(:partial => "longform", :for_url => "/#{I18n.locale}/languages", locals: {language_form: f})
%>


Expand Down