Last active
April 1, 2017 04:56
-
-
Save jacoyutorius/5368883 to your computer and use it in GitHub Desktop.
Railsで既存のテーブルをModelとして使用する ref: http://qiita.com/jacoyutorius/items/86691266b63f967f47d3
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
$rails g model hogehoge |
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
> hogeid = Hogehoge.find("hogeid") |
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
class Hogehoge < ActiveRecord::Base | |
set_table_name :hogehoge | |
set_primary_key :hogeid | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment