
Security News
Oxlint Introduces Type-Aware Linting Preview
Oxlint’s new preview brings type-aware linting powered by typescript-go, combining advanced TypeScript rules with native-speed performance.
acts_as_file
makes your field act as a file.
The content of the field is stored into a file on calling #save
method,
and is loaded from the file on calling its accessor method.
Add the following to your Gemfile
:
gem 'acts_as_file'
And then execute:
$ bundle
ActiveRecord is not required, but let me write an example for it.
class Post < ActiveRecord::Base
include ActsAsFile
def filename
"posts/#{self.id}_body.txt"
end
acts_as_file :body => self.instance_method(:filename)
end
# store
post = Post.new
post.body = 'content'
post.save # save the content into the file of `#filename`
# create the directory if not exist
# load
post = Post.first
puts post.body # load the content from the file of `#filename`
post.destroy # remove the file
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that acts_as_file demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oxlint’s new preview brings type-aware linting powered by typescript-go, combining advanced TypeScript rules with native-speed performance.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.