Yellowen / Faalis

A RubyOnRails platform for rapid web application development. Containing a rich and flexible dashboard interface
GNU General Public License v2.0
54 stars 15 forks source link

Faalis should use `to` attribute of a field to guess the model name #12

Closed edelwies closed 9 years ago

edelwies commented 10 years ago

Faalis should use to attribute of a relation field to guess the model name. for example:

    {
        "name": "sections",
        "type": "has_many",
        "to": "work_steps"
    }

will generate this code in controller file:

  def create
    # Section should be replaced by WorkStep ---------------
    sections = Section.where({:id => params[:order][:sections]})
    # ---------------------------------------------------------------------------
    @order.sections = sections
    if @order.save
      respond_with(@order)
    else
      respond_to do |format|
        format.json { render :json => {:fields => @order.errors}, :status => :unprocessable_entity }
      end
    end
  end
lxsameer commented 9 years ago

We no longer need to define our resources via an external resource file. This feature removed from our previous versions too.