Last active
June 15, 2017 12:16
-
-
Save ArturLyapin/deee21d1f557c0b87bdc682ac8292e7a to your computer and use it in GitHub Desktop.
Mobility issue #41
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#app/models/member/first.rb | |
class Member::First < Member | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
git_source(:github) do |repo_name| | |
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") | |
"https://github.com/#{repo_name}.git" | |
end | |
gem 'rails', '~> 5.0.2' | |
gem 'pg', '~> 0.18' | |
gem 'mobility', '~> 0.1.16' | |
group :development do | |
gem 'listen', '~> 3.0.5' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#config/initializers/i18n.rb | |
Rails.application.config.i18n.available_locales = %i[en fi] | |
Rails.application.config.i18n.default_locale = 'en' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#app/models/member.rb | |
class Member < ApplicationRecord | |
include Mobility | |
translates :name, type: :string | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#config/initializers/mobility.rb | |
Mobility.configure do |config| | |
config.default_backend = :column | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Run in rails console | |
-> Member::First.all | |
NoMethodError: undefined method `[]' for nil:NilClass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActiveRecord::Schema.define(version: 20170615120021) do | |
create_table "members", force: :cascade do |t| | |
t.string "name_fi" | |
t.string "name_en" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#app/models/member/second.rb | |
class Member::Second < Member | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment