Ruby api code for Create blogs

Hi ,

I am new to ROR…

I am trying to write a ruby code for the already existing API for blogs
.

For the create action in my blogpost.rb model file

validates_presence_of :title, :category_id, :user_id
validates_length_of :title, :in => 8…140, :too_short => “is too
short”, :too_long => “is too long (max 140 chars)”

How to write a Ruby code in console for the creation of a blogpost …

Where my Blogpost table has (id,title,desc,cat_id,)

and title and desc are mandatory…

Blogpost.create(:title => “my title”, :desc => “my desc”) … is this
what you’re after for?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs