I’m still struggling with this simple concept! Go to
http://www.transportexecutives.com/samples/sample.html so you can SEE
what I’m trying to do. There are three screen shots:
- Lead List - Click on a lead and go to:
- Lead Details - Here, you have the details for the lead record along
- Activity List - children belonging to the lead.
Here, I want to create a new activity. I want you to know that I am
getting the job done - but I fear it is the wrong way of doing it. From
the lead controller, if I say @lead.activities.new then I get an error
saying that I don’t have the template in the lead directory. I don’t
want the template there!!! I want it in the Activity view area.
Currently, when I click on the “New Activity” button, it goes currently
into the Activity controller. I’m having to manage the parent type and
parent id - which I KNOW is wrong, but I can’t get it right doing it the
way I have seen documented.
That code is here (formatting screwed up by cut&paste:
@session[:parent_id] = @params[:id]
@session[:parent_type] = @params[:parent_type]
@activity = Activity.new
@activity = Activity.new(@params[:activity])
if @session[:parent_type] == ‘price_quote’
@activity.price_quote_id = @session[:parent_id]
if @session[:parent_type] == ‘lead’
@activity.lead_id = @session[:parent_id]
flash[:notice] = ‘Activity was successfully created.’
@session[“parent_id”] = nil
@session[“parent_type”] = nil
redirect_back(":action => ‘list’")
render :action => ‘new’
Some of you will notice that this interface looks like vTiger. I took
the vTiger look and feel and am “RORizing” it. I didn’t like the PHP
mess under the hoods. ROR is awesome. Your help is appreciated.
BTW, if you want to help with an OpenSource CRM on ROR then email me
at michael at transportexecutives dot com. What I’m doing now is a bit
proprietary but I can strip out the industry specific stuff and I would
very much like to create an open source version of it for the world to
share. This represents a little over two weeks of work - not all
functional but core pieces are in place. Rails has certainly made the
dev effort move along more quickly than alternative approaches.
Thanks for any help anyone can provide.