Welcome to Working With Rails

 

Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
issue generation based on RFP in redmine plugin
1 Post
issue generation based on RFP in redmine plugin

0 down vote favorite

i have been creating RFP plugin in redmine ,in this plug in contains a form which will filled by user .The form fields contains client requirement when user fill &submmited it the issues must generate in respective project.All form fields on form must become the issues my question is how each fiels i map with the redmine issue table and generate the respective issue

def new
    @rfp = Rfp.new   
    respond_to do |format|
    format.html # new.html.erb
        end
end


def create
   params[:rfp].delete(:project_id)
   @rfp = Rfp.new(params[:rfp])
   issue = Issue.new
   issue.subject = params[:rfp]
   issue.tracker = Tracker.find_by_name("Feature")
   issue.project = Project.find_by_name(params[:project])
   issue.start_date = Time.now.localtime.strftime("%Y-%m-%d")
   issue.priority = IssuePriority.find_by_name("Normal")
   issue.author = User.find_by_mail("XXX@gmail.com")
   issue.status = IssueStatus.find_by_name("New")
   issue.save
   respond_to do |format|
   if @rfp.save
      format.html { redirect_to :action => "show", :id => @rfp }

   else
   format.html { render "new" }

    end
  end
  end

my Issue_patch contails

module IssuePatch def self.included(base)

base.send(:include, InstanceMethods)

end

module InstanceMethods

def create 
    issue = Issue.new
issue.subject = "dsd"

issue.tracker = Tracker.find_by_name("Feature")

issue.project = Project.find_by_name(params[:project])
issue.start_date = Time.now.localtime.strftime("%Y-%m-%d")
issue.priority = IssuePriority.find_by_name("Normal")
issue.author = User.find_by_mail("tyt@gmail.com")
issue.status = IssueStatus.find_by_name("New")
issue.save

end end
end

any help

1 Post
Login to add your message