We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In my settings model I have a scope:
scope :socials do field :instagram, default: "https://www.instagram.com/yaro_the_slav", type: :string field :twitter, default: "https://twitter.com/yarotheslav", type: :string field :tiktok, default: "", type: :string, help_text: "https://www.tiktok.com/@yaro_the_slav" field :linkedin, default: "", type: :string, help_text: "https://www.linkedin.com/in/yarotheslav" field :youtube, default: "", type: :string, help_text: "https://www.youtube.com/@yaro_the_slav" field :facebook, default: "", type: :string, help_text: "https://www.facebook.com/yarotheslav" field :pinterest, default: "", type: :string, help_text: "https://www.pinterest.com/yarotheslav" field :twitch, default: "", type: :string, help_text: "https://www.twitch.tv/yarotheslav" field :discord, default: "", type: :string, help_text: "https://discord.gg/yarotheslav" field :telegram, default: "", type: :string, help_text: "https://t.me/yarotheslav" field :whatsapp, default: "", type: :string, help_text: "https://wa.me/yarotheslav" end
In a view I want to iterate through all fields in this scope.
I don't see a way to get all fields in a scope.
This works for me:
def self.get_scope(scope_name) defined_fields .select { |field| field[:scope] == scope_name } .each_with_object({}) { |field, hash| hash[field[:key]] = send(field[:key]) } end
Would you consider merging this method?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
In my settings model I have a scope:
In a view I want to iterate through all fields in this scope.
I don't see a way to get all fields in a scope.
This works for me:
Would you consider merging this method?
The text was updated successfully, but these errors were encountered: