Ruby on Rails Tuesday, January 31, 2017

Hi,

i am working on rails 4 application,i am trying to integrate linked-in in my application.i am followed below link steps,but i can't fetch user feeds(updates & shares),i can fetch only user profile informations.how can i get all informations.please help me

Reference :  https://github.com/emorikawa/linkedin-oauth2

this is my scope in omniauth.rb

OmniAuth.config.logger = Rails.logger
Rails.application.config.middleware.use OmniAuth::Builder do
    provider :linkedin, SOCIAL_CONFIG['linkedin_client_id'], SOCIAL_CONFIG['linkedin_client_secret'],  scope: ['r_fullprofile', 'r_emailaddress','r_network','w_share'], fields: ['id', 'first-name', 'last-name', 'location', 'picture-url', 'public-profile-url']
end

Ruby on Rails

ok, I solved of my problems.  My git commit / push didn't work.  Thats working now.


the other thing is...

 ActionView::Template::Error (PG::UndefinedColumn: ERROR:  column "startdate" does not exist
2017-02-01T03:51:33.326023+00:00 app[web.1]: LINE 1: SELECT  "products".* FROM "products"  ORDER BY Startdate ASC...
2017-02-01T03:51:33.326023+00:00 app[web.1]:                                                        ^
2017-02-01T03:51:33.326024+00:00 app[web.1]: HINT:  Perhaps you meant to reference the column "products.Startdate".

Startdate is a column in my database table, I don't know where it coming up with 'startdate' does not exist?  I don't have that in any of my references.

Thanks,
Joe

On Tuesday, January 31, 2017 at 10:24:13 PM UTC-5, Joe Guerra wrote:
This is driving me crazy.  I have my web app working great in development, then I commit and push it to Github and heroku automatically deploys my app.

Unfortunately, it doesn't quite work out the same as the development.  

Pages aren't being found on production, but they are there in development and they are on my github repo.  

Heroku logs are not very useful either.  :(

Any suggestions?

Thanks,
Joe

--
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/a99a74c0-76b7-4b5c-a67d-9005a77d852d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Thanks, that worked !

On Tuesday, January 31, 2017 at 1:49:20 AM UTC-5, Bill Felton wrote:
Is it a boolean column?
We wind up setting @user = current_user, and then checking 
if @user.admin  
#current_user.admin should work just as well if you don't need to hang on to the actual signed in user.
end
Otherwise, 
@user.<column_name> == "admin"   #(or whatever you use)

cheers,
Bill

On Jan 30, 2017, at 4:48 PM, Joe Guerra <jgu...@jginfosys.com> wrote:

I know there is a current_user method for devise, but how do you check if the user is admin?  (I've got a user flagged as admin).

I have a admin menu that I'd like to enable / disable when admin is logged in.

Thanks,
Joe  



--
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-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/e4ec59a4-4bb5-4e0f-9490-d659d6350a47%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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/a07b6d98-5dd9-4b88-9aea-9557eff28667%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

This is driving me crazy.  I have my web app working great in development, then I commit and push it to Github and heroku automatically deploys my app.

Unfortunately, it doesn't quite work out the same as the development.  

Pages aren't being found on production, but they are there in development and they are on my github repo.  

Heroku logs are not very useful either.  :(

Any suggestions?

Thanks,
Joe

--
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/87fd3a2c-bf97-474a-a7e7-dcb647fe39a9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

This is the Print Menu in RM:

https://www.dropbox.com/s/vcnk2xpq7yvjdlw/Screenshot%202017-01-31%2019.21.20.png?dl=0

and it opens this Dialog:

https://www.dropbox.com/s/sh2xsc0mc4zy1le/Screenshot%202017-01-31%2019.19.53.png?dl=0

On Mon, Jan 30, 2017 at 3:31 PM Joe Guerra <jguerra@jginfosys.com> wrote:
Does any know if there is a quick method to doing this? 

I'd like to print out my project on paper, and make some notes.

Thanks,
Joe

--
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/1267007e-4c13-449b-b369-b7d094f5c84d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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/CAHUC_t8jY2oue1tSBsAzZbdJ%2BJVPckh6mLD5APSHik5cikMO1g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Thanks bro for sharing this.
I will check and implement it

On Jan 31, 2017 9:28 PM, "Carlos Ramirez" <carlos@cetrasoft.com> wrote:
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!

On Saturday, January 28, 2017 at 9:27:03 AM UTC-5, Tushar Garg wrote:
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

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/cc1af4a4-3a54-46f6-8a51-7845e192facc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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/CAK6MfSd_gOWQ1Gwb3MZZEF7EQAtnYFVUizCBWuFHw%2B9dK5mJjQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

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!

On Saturday, January 28, 2017 at 9:27:03 AM UTC-5, Tushar Garg wrote:
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

--
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/cc1af4a4-3a54-46f6-8a51-7845e192facc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails Monday, January 30, 2017

Yes, lol.  That easy.  I'll try it.

On Monday, January 30, 2017 at 4:48:21 PM UTC-5, Joe Guerra wrote:
I know there is a current_user method for devise, but how do you check if the user is admin?  (I've got a user flagged as admin).

I have a admin menu that I'd like to enable / disable when admin is logged in.

Thanks,
Joe  


--
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/863a92ed-a4b7-4644-89e3-e8ef077d37b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Is it a boolean column?

We wind up setting @user = current_user, and then checking 
if @user.admin  
#current_user.admin should work just as well if you don't need to hang on to the actual signed in user.
end
Otherwise, 
@user.<column_name> == "admin"   #(or whatever you use)

cheers,
Bill

On Jan 30, 2017, at 4:48 PM, Joe Guerra <jguerra@jginfosys.com> wrote:

I know there is a current_user method for devise, but how do you check if the user is admin?  (I've got a user flagged as admin).

I have a admin menu that I'd like to enable / disable when admin is logged in.

Thanks,
Joe  



--
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/e4ec59a4-4bb5-4e0f-9490-d659d6350a47%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

On 30 January 2017 at 21:48, Joe Guerra <jguerra@jginfosys.com> wrote:
> I know there is a current_user method for devise, but how do you check if
> the user is admin? (I've got a user flagged as admin).

Do you mean that you have a column in users table named admin which is
true or false? if so then just test current_user.admin

Colin

--
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/CAL%3D0gLtOR51yPy8BjfdNQsxPJUkwww%3DhWRTDjN1O2axeS020Aw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

I know there is a current_user method for devise, but how do you check if the user is admin?  (I've got a user flagged as admin).

I have a admin menu that I'd like to enable / disable when admin is logged in.

Thanks,
Joe  


--
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/e4ec59a4-4bb5-4e0f-9490-d659d6350a47%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

I'm not aware of one.  Do you want all the code or just the file names and hierarchies?

In either case, I suspect the terminal is your friend, possibly a ruby script in the IRB console.
Or for just a listing of the files that you can print and write notes on, SnagIt would let you get a screen shot.

cheers,
Bill
On Jan 30, 2017, at 4:31 PM, Joe Guerra <jguerra@jginfosys.com> wrote:

Does any know if there is a quick method to doing this? 

I'd like to print out my project on paper, and make some notes.

Thanks,
Joe

--
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/1267007e-4c13-449b-b369-b7d094f5c84d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Does any know if there is a quick method to doing this? 

I'd like to print out my project on paper, and make some notes.

Thanks,
Joe

--
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/1267007e-4c13-449b-b369-b7d094f5c84d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Thanks.   I got it combined.   I'll try using the scope in the product model.


On Sunday, January 29, 2017 at 10:01:49 PM UTC-5, j...@room118solutions.com wrote:
ActiveRecord will handle converting a Time into something your database understands, so you don't need to worry about that.  You can also write the where clause manually like you did, or you can use arel, which would be my preference.  You can also chain .where()'s, since they just return ActiveRecord::Relations and don't actually execute until they need to.  Here's how you could rewrite your code:

@products = category.products.where( 'draft' => false, 'active' => true, 'funded' => false).where(Product.arel_table[:enddate].gt(Time.now))

I would personally define that as a scope on the Product model:

scope :not_expired, -> { arel_table[:enddate].gt(Time.now) }

And then your code could become:

@products = category.products.not_expired.where( 'draft' => false, 'active' => true, 'funded' => false)

I would also probably create scopes for all of those other conditions, or maybe wrap them into a single scope if you can produce a term that accurately describes products that are in that exact state.

On Sunday, January 29, 2017 at 1:29:03 PM UTC-5, Joe Guerra wrote:
I'm trying to figure out how to compare my enddate > Time.now in my where clause.

enddate is a date field, I'm just trying to only display products that haven't expired (by the date field).


I've tried...

require 'time'

products.where(['enddate > ?', Time.now]) 

--
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/8320c7d2-c004-4d87-803a-e40dc8f5bcfc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails Sunday, January 29, 2017

ActiveRecord will handle converting a Time into something your database understands, so you don't need to worry about that.  You can also write the where clause manually like you did, or you can use arel, which would be my preference.  You can also chain .where()'s, since they just return ActiveRecord::Relations and don't actually execute until they need to.  Here's how you could rewrite your code:

@products = category.products.where( 'draft' => false, 'active' => true, 'funded' => false).where(Product.arel_table[:enddate].gt(Time.now))

I would personally define that as a scope on the Product model:

scope :not_expired, -> { arel_table[:enddate].gt(Time.now) }

And then your code could become:

@products = category.products.not_expired.where( 'draft' => false, 'active' => true, 'funded' => false)

I would also probably create scopes for all of those other conditions, or maybe wrap them into a single scope if you can produce a term that accurately describes products that are in that exact state.

On Sunday, January 29, 2017 at 1:29:03 PM UTC-5, Joe Guerra wrote:
I'm trying to figure out how to compare my enddate > Time.now in my where clause.

enddate is a date field, I'm just trying to only display products that haven't expired (by the date field).


I've tried...

require 'time'

products.where(['enddate > ?', Time.now]) 

--
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/3b66a09b-e6b6-479b-9598-9811e2eab43f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails



On Sunday, January 29, 2017 at 1:29:03 PM UTC-5, Joe Guerra wrote:
I'm trying to figure out how to compare my enddate > Time.now in my where clause.

enddate is a date field, I'm just trying to only display products that haven't expired (by the date field).


I've tried...

require 'time'

products.where(['enddate > ?', Time.now]) 


ok, I've kind of figured it out.  but I need to combine my where clause now...



require 'time'

todaydate = Time.new
# set 'todaydate' equal to the current date/time.

todaydate = todaydate.year.to_s + "-" + todaydate.month.to_s + "-" + todaydate.day.to_s


@title = @category.name
@products = @category.products.where( 'draft' => false, 'active' => true, 'funded' => false)

    @products = @category.products.where('enddate > ?', todaydate ) 



--
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/58c17ab3-a88e-49ee-8c90-687e6c53ec4e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

I'm trying to figure out how to compare my enddate > Time.now in my where clause.

enddate is a date field, I'm just trying to only display products that haven't expired (by the date field).


I've tried...

require 'time'

products.where(['enddate > ?', Time.now]) 

--
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/85bbf24d-693d-46c2-a9c8-a4a0ba81f5cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

On Sat, Jan 28, 2017 at 11:44 PM, Tushar Garg
<tushar.garg@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 :-)

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

--
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/CACmC4yBe_REmbWF_BUsF5uXStKgLu7_3b-wite52hN1p1njY-A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails Saturday, January 28, 2017

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:
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

--
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/0354952b-6526-4c05-92d3-78af0d77790d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails



On Saturday, January 28, 2017 at 7:57:03 PM UTC+5:30, Tushar Garg wrote:
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

--
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/3a03e560-a980-4020-b79f-f3a5fe3af70d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

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/

On Saturday, January 28, 2017 at 9:43:14 PM UTC+5:30, Hassan Schroeder wrote:
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

--
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/033dc1b9-c2f3-4310-b223-11bf62563ab0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

On Sat, Jan 28, 2017 at 5:11 AM, Tushar Garg <tushar.garg@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.schroeder@gmail.com
twitter: @hassan
Consulting Availability : Silicon Valley or remote

--
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/CACmC4yAP%2BaAsA%2Bd5SJRM8mSAW846FXNx343bWpPrhvCZLbF6kg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Can you provide the error logs?

On Sat, Jan 28, 2017 at 9:11 PM, Tushar Garg <tushar.garg@daffodilsw.com> wrote:
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

--
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.

--
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/CAPmpWece77h9wGFVjqAiOep%2BuROhNvXtdzySw0ZxrPdN%2BRYm8A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

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

--
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.

Ruby on Rails

On 27 January 2017 at 23:44, fugee ohu <fugee279@gmail.com> wrote:
> there's posts on a users page and they're commentable, when a user adds a
> comment for a post on the page, i should redraw the page or modify the dom
> using js

It is up to you. There is no best way, it depends on the how you want
the site to behave.

Colin

--
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/CAL%3D0gLt2derhyV7gEg77jkwnen57MdB13eWthB0DDxEx295r3A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails Friday, January 27, 2017

What do you think about adding update_each and update_each! to ActiveRecord?

Basically it would make it easier to switch from update_all but triggering the callbacks (and could be later optimized, where `each { |m| m.update(...) }` is very difficult to optimize from the Rails-side.

A simple implementation could be:

```
class ActiveRecord::Base
  def self.update_each(updates)
    find_each { |model| model.update(updates) }
  end

  def self.update_each!(updates)
    find_each { |model| model.update!(updates) }
  end
end
```

-
Dorian
Programmer

--
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/ace56579-2521-450e-b685-70e9fad10366%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

there's posts on a users page and they're commentable, when a user adds a comment for a post on the page, i should redraw the page or modify the dom using js

--
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/900d8dab-fc0d-469e-901b-882220bdeeff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Use Docker.  Go to my web site Ruby on Racetracks at http://www.rubyonracetracks.com/, click on Installation, and click on "Getting Started".  You can have Ruby on Rails ready to roll in minutes, not hours.  You can also reset the Docker container to its original conditions in just a few seconds.

I make sure that my rbenv-general Docker images include the latest versions of Ruby and Rails and the versions currently used in Rails Tutorial.

In my opinion, the main reason for having Ruby on Rails directly in the host OS is to be on the same page as teammates who rely on this setup.  Because it takes hours of babysitting processes to set this up and because you can't reset this development environment willy-nilly (as you can under the Docker way), I will NOT rely on Ruby on Rails in the host OS as my primary setup.

--
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/6d6c2341-45c0-40f3-b458-e1afa748f77b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Check out Version 2 of my gem GenericApp https://github.com/jhsu802701/generic_app) for creating a new Rails app. No other Rails template app is this comprehensive.


I created the template app used as the basis for GenericApp with my Rails From Scratch protocol athttps://github.com/jhsu802701/rails_from_scratch_rails5 . Rails From Scratch was inspired by Rails Tutorial but has much shorter chapters, uses the Devise gem to provide authentication, uses Capybara for integration tests, and provides scripts for automating many routine tasks.  Rails From Scratch also doubles as a cheat sheet for possible features to add to legacy projects and for many routine tasks.

--
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/8380aa64-ea84-4eb4-bd5a-8c400deeb538%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails Thursday, January 26, 2017

Hi Mike,

Thanks a lot. It works.


Regards,
Seeni Rafiyullah Khan A,
In Every moment, thank God.

P Please consider the environment before printing this email


On Thu, Jan 26, 2017 at 5:03 PM, Mike <mike.simkins@gmail.com> wrote:
Don't use default_locale

In ApplcationController do something like

before_filter :set_user_locale

def set_user_locale
  I18n.locale = params[:locale] if params[:locale]
end

--
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/97ba7e3c-6b93-45bc-9161-13262e1233fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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/CA%2BfXU%2B2HRZuBnPE0KV1XmNhU0X52Ogp%3DueNQ3cqPhG5_AOVoqg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Don't use default_locale

In ApplcationController do something like

before_filter :set_user_locale

def set_user_locale
I18n.locale = params[:locale] if params[:locale]
end

--
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/97ba7e3c-6b93-45bc-9161-13262e1233fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails Wednesday, January 25, 2017

Yes it was the issue of text. file is reading the doc as text not binary. Thanks for your help

Paramnoor Singh

On Wednesday, January 25, 2017 at 5:30:55 PM UTC+5:30, Paramnoor Singh wrote:

Problem: I have use the net/http code for uploading the '.doc', '.docx', '.pdf' and images files on dropbox. But I getting the issues like:

1.invalid byte sequence in UTF 8
2. Now while the file is uploading but it not uploading the content and even it uploading as a corrupt file.

Below I writing my code to upload the file on dropbox. Please help me.

Code:

uri = URI.parse("https://content.dropboxapi.com/2/files/upload")
          request = Net::HTTP::Post.new(uri)
          request.content_type = "application/octet-stream"
          request["Authorization"] = "Bearer #{$acess_token}"
          request["Dropbox-Api-Arg"] = "{\"path\":\"/Sass-for-Web-Designers.pdf\"}"
          request.body = ""
          request.body << File.open("app/assets/images/categoryImages/Sass-for-Web-Designers.pdf").read
            #request.body << file.content
            #file.close
         

Ruby on Rails

> On Jan 25, 2017, at 7:00 AM, Paramnoor Singh <paramnoor.intersoft@gmail.com> wrote:
>
>
> Problem: I have use the net/http code for uploading the '.doc', '.docx', '.pdf' and images files on dropbox. But I getting the issues like:
>
> 1.invalid byte sequence in UTF 8
> 2. Now while the file is uploading but it not uploading the content and even it uploading as a corrupt file.
>
> Below I writing my code to upload the file on dropbox. Please help me.
>
> Code:
>
> uri = URI.parse("https://content.dropboxapi.com/2/files/upload")
> request = Net::HTTP::Post.new(uri)
> request.content_type = "application/octet-stream"
> request["Authorization"] = "Bearer #{$acess_token}"
> request["Dropbox-Api-Arg"] = "{\"path\":\"/Sass-for-Web-Designers.pdf\"}"
> request.body = ""
> request.body << File.open("app/assets/images/categoryImages/Sass-for-Web-Designers.pdf").read

This line is opening the file as a UTF-8 string, which it most likely is not. Read up on File.open, particularly the various flags you can pass to it to ensure that the file is being opened as a binary, not a text file.

Walter

> #request.body << file.content
> #file.close
>

Ruby on Rails


Problem: I have use the net/http code for uploading the '.doc', '.docx', '.pdf' and images files on dropbox. But I getting the issues like:

1.invalid byte sequence in UTF 8
2. Now while the file is uploading but it not uploading the content and even it uploading as a corrupt file.

Below I writing my code to upload the file on dropbox. Please help me.

Code:

uri = URI.parse("https://content.dropboxapi.com/2/files/upload")
          request = Net::HTTP::Post.new(uri)
          request.content_type = "application/octet-stream"
          request["Authorization"] = "Bearer #{$acess_token}"
          request["Dropbox-Api-Arg"] = "{\"path\":\"/Sass-for-Web-Designers.pdf\"}"
          request.body = ""
          request.body << File.open("app/assets/images/categoryImages/Sass-for-Web-Designers.pdf").read
            #request.body << file.content
            #file.close
         

Ruby on Rails Tuesday, January 24, 2017

Bom dia galera!
Paz e bem!

Eu sou novo no framework Ruby on Rails e consegui alguns projetos.
Estou com um projeto de criação de um jornal online de uma comunidade. 

Como eu trabalhava em outras empresas anteriormente, nunca a oportunidade de "cobrar" por um projeto.
Queria pedir ajuda no valor a ser cobrado por este projeto que envolve:
-Planejamento do projeto com o cliente
-Engenharia de Software
-Design de imagem;
-Banco de Dados;
-Hospedagem;
-Manutenção;

Alguém poderia me ajudar em como proceder nessa "cobrança"?

--
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/86c0a75c-a5ff-409a-9e2f-5c6e2fbfacf7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Hi All,

In order to support internalization in our application, we are giving an option to the user to select the language. But the problem here is, when one user select one language for example 'Chinese', all other users browser's language also changing to Chinese.

We want something like changing language at client level instead of server level. Is it possible in rails?

Below is the code I am using for setting locale.

    if params[:lang]
      I18n.default_locale = params[:lang]
    end
    I18n.locale = I18n.default_locale

Please let me know if any suggestion on this.

Regards,
Seeni Rafiyullah Khan A,
In Every moment, thank God.

P Please consider the environment before printing this email

--
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/CA%2BfXU%2B0_CoQ5UA3Hk%2BUaPr24OJd%2BRSUiz43KO-sWiF29N6PMLQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.