Need help for writing Api in Rails 5

29 views
Skip to first unread message

Tushar Garg

unread,
Jan 28, 2017, 9:27:03 AM1/28/17
to Ruby on Rails: Talk
Hi All,

I am new to rails.
I want to write restful api's in rails. I start following the "API on Rails" book.
By following that book, I come to know that there are lot of things are depreciated in rspec, I am getting bulk of error and all things are blown.
Please anyone provide me step by step tutorial for writing Rest APi in rails 5

Thanks
Tushar Garg

Edsil Basadre

unread,
Jan 28, 2017, 10:40:56 AM1/28/17
to rubyonra...@googlegroups.com
Can you provide the error logs?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b984b043-63eb-4524-bd75-122292f4da9f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hassan Schroeder

unread,
Jan 28, 2017, 11:13:14 AM1/28/17
to rubyonrails-talk
On Sat, Jan 28, 2017 at 5:11 AM, Tushar Garg <tusha...@daffodilsw.com> wrote:

> I am new to rails.
> I want to write restful api's in rails. I start following the "API on Rails"
> book.
> By following that book, I come to know that there are lot of things are
> depreciated in rspec,

I would hope this book tells you what versions of gems it was using!
If so you can specify those in your Gemfile and things should work.

However, if the Rails version in question is no longer supported, then
you're better off finding a current tutorial, API-specific or not.

--
Hassan Schroeder ------------------------ hassan.s...@gmail.com
twitter: @hassan
Consulting Availability : Silicon Valley or remote

Tushar Garg

unread,
Jan 29, 2017, 2:44:04 AM1/29/17
to Ruby on Rails: Talk
Hi Hassan,

Those errors were related testing. Becoz lot of things in Rspec are depriciated, when I remove Rspec and testing part from it, then its working fine. I follow the given tutorial and the concept of Api is clear and I am able to write api in rails5.
https://www.simplify.ba/articles/2016/06/18/creating-rails5-api-only-application-following-jsonapi-specification/

Tushar Garg

unread,
Jan 29, 2017, 2:47:25 AM1/29/17
to Ruby on Rails: Talk

Tushar Garg

unread,
Jan 29, 2017, 2:47:33 AM1/29/17
to Ruby on Rails: Talk
Hi Edsil Basadre,

Those errors were related testing. Becoz lot of things in Rspec are depriciated, when I remove Rspec and testing part from it, then its working fine. I follow the given tutorial and the concept of Api is clear and I am able to write api in rails5.
https://www.simplify.ba/articles/2016/06/18/creating-rails5-api-only-application-following-jsonapi-specification/

On Saturday, January 28, 2017 at 9:43:14 PM UTC+5:30, Hassan Schroeder wrote:

Hassan Schroeder

unread,
Jan 29, 2017, 10:35:01 AM1/29/17
to rubyonrails-talk
On Sat, Jan 28, 2017 at 11:44 PM, Tushar Garg
<tusha...@daffodilsw.com> wrote:

> Those errors were related testing. Becoz lot of things in Rspec are
> depriciated, when I remove Rspec and testing part from it, then its working
> fine.

But "removing testing" to make it "work" is an extremely bad habit
to get into.

If some methods shown in the old tutorial are deprecated, write
your tests to use current ones. You will never regret knowing how
to write good tests :-)

Carlos Ramirez

unread,
Jan 31, 2017, 10:58:31 AM1/31/17
to Ruby on Rails: Talk
Hey Tushar,

There are a lot of great resources online for creating APIs in Rails 5 (with its new API-only mode).

One of my favorites is called Building the Perfect Rails 5 API Only App by Kam Low (which I wrote about).

Another that just caught my eye was this one called Best Practices for Designing a Pragmatic RESTful API by Vinay Sahni. It isn't specific to Rails 5, but talks about API best practices and recommendations in general. Very comprehensive. 

Hope those help!

Tushar Garg

unread,
Jan 31, 2017, 11:14:11 AM1/31/17
to rubyonra...@googlegroups.com
Thanks bro for sharing this.
I will check and implement it

--
You received this message because you are subscribed to a topic in the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rubyonrails-talk/XHDZ0IzzWyA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.

To post to this group, send email to rubyonrails-talk@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages