Search Results

Search found 3 results on 1 pages for 'jklina'.

Page 1/1 | 1 

  • Refinery CMS (Rails): Creating a plugin or plugins with multiple models and relationships

    - by jklina
    My goal is to create a way for an admin to create two models in the Refinery admin: Campaigns and Videos I would like to have it setup so that a Campaign has many Videos and that each Video belongs to a Campaign. Both Videos and Campaigns will have a title, description, and a preview image. I'm not certain of the best way to go about this. Is it possible to setup two plugins and form a relationship between the two? Or, should I create one plugin with both models. If someone could point me in the right direction or a good example of a solution to a similar problem, I would be grateful. Thank you for looking!

    Read the article

  • How do I add custom buttons to Formtastic?

    - by jklina
    I'm using the Formtastic Rails gem in my app and its been great, but I would really like to add a second button, other than the bundled "commit" button that redirects back. I can't seem to find any information on how to add a custom button. Any information would be greatly appreciated!

    Read the article

  • How do I make a grouped select box grouped by a column for a given model in Formtastic for Rails?

    - by jklina
    In my Rails project I'm using Formtastic to manage my forms. I have a model, Tags, with a column, "group". The group column is just a simple hardcoded way to organize my tags. I will post my Tag model class so you can see how it's organized class Tag < ActiveRecord::Base class Group BRAND = 1 SEASON = 2 OCCASION = 3 CONDITION = 4 SUBCATEGORY = 5 end has_many :taggings, :dependent => :destroy has_many :plaggs, :through => :taggings has_many :monitorings, :as => :monitorizable validates_presence_of :name, :group validates_uniqueness_of :name, :case_sensitive => false def self.brands(options = {}) self.all({ :conditions => { :group => Group::BRAND } }.merge(options)) end def self.seasons(options = {}) self.all({ :conditions => { :group => Group::SEASON } }.merge(options)) end def self.occasions(options = {}) self.all({ :conditions => { :group => Group::OCCASION } }.merge(options)) end def self.conditions(options = {}) self.all({ :conditions => { :group => Group::CONDITION } }.merge(options)) end def self.subcategories(options = {}) self.all({ :conditions => { :group => Group::SUBCATEGORY } }.merge(options)) end def self.non_brands(options = {}) self.all({ :conditions => [ "`group` != ? AND `group` != ?", Tag::Group::SUBCATEGORY, Tag::Group::BRAND] }.merge(options)) end end My goal is to use Formtastic to provide a grouped multiselect box, grouped by the column, "group" with the tags that are returned from the non_brands method. I have tried the following: = f.input :tags, :required => false, :as => :select, :input_html => { :multiple => true }, :collection => tags, :selected => sel_tags, :group_by => :group, :prompt => false But I receive the following error: (undefined method `klass' for nil:NilClass) Any ideas where I'm going wrong? Thanks for looking :]

    Read the article

1