
Security News
Researcher Exposes Zero-Day Clickjacking Vulnerabilities in Major Password Managers
Hacker Demonstrates How Easy It Is To Steal Data From Popular Password Managers
alchemy-custom-model
Advanced tools
Short description and motivation.
How to use my plugin.
Add this line to your application's Gemfile:
gem 'alchemy-custom-model'
And then execute:
$ bundle
Or install it yourself as:
$ gem install alchemy-custom-model
Then run the installer
bin/rails alchemy_custom_model:install
Generate your model
t.integer :language_id
include the model decorator
include Alchemy::Custom::Model::ModelDecoration
# For attachments, the foreign_key is the key defined in the model, can be omitted if it's standard Rails naming
belongs_to :file, class_name: "Alchemy::Attachment", optional: true, foreign_key: :file_id
global_id_setter :file
# For Pictures
belongs_to :picture, class_name: 'Alchemy::Picture', optional: true, touch: true
global_id_setter :picture
bin/rails g controller Admin::Posts
class PostAbility
include CanCan::Ability
def initialize(user)
if user.present? && (user.is_admin? or user.has_role?("editor"))
can :manage, Post #model
can :manage, :admin_posts #routes to the posts withouth _path
end
end
end
Alchemy::Modules.register_module({
name: 'Posts', # custom name
order: 2,
navigation: {
name: 'modules.posts',
controller: '/admin/posts', #controller path
action: 'index', #action
icon: "question" # custom icon
}
})
Alchemy.register_ability(PostAbility)
<%= base_form_container do %>
<div class="form_in_page">
<%= simple_form_for [:admin,@obj] do |f| %>
<fieldset>
<%= f.input :name %>
<%= rich_text_editor(f, :description) %>
<%= single_image_input(f, :picture) %>
<%= single_attachment_input(f, :file) %>
...
belongs_to :picture, class_name: 'Alchemy::Picture', touch: true
belongs_to :alchemy_file_instance, class_name: 'Alchemy::Picture', foreign_key: :picture_id #relazione generica per i files utilizzata nel volume di elfinder
- name: layout_name_list
elements: [element_for_list]
custom_model: "CustomModelClass"
custom_model_action: "index"
cache: false
- name: layout_name_show
elements: [element_for_show]
custom_model: "CustomModelClass"
custom_model_action: "show"
cache: false
git clone --recursive git@github.com:ArchimediaZerogroup/alchemy-custom-model.git
docker build -t alchemy_custom_image .
docker run -it -p3000:3000 --rm -v "$(pwd)":/app alchemy_custom_image bin/rails s -b 0.0.0.0
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that alchemy-custom-model demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
Hacker Demonstrates How Easy It Is To Steal Data From Popular Password Managers
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.