[Rails] Rails as_json include two association

2015-10-18 Thread Nilay Singh
0 down vote favorite I am trying to generate json api using as_json . Here I have a feed and each feed belongs to user and there is another model called feed_like whose relation is user has many feed_likes and feed has many feed_likes . Here in my json I am getting this value : "feed": [ {

Re: [Rails] Re: Rails passing params in link_to how to make it secure

2015-08-15 Thread nilay singh
Sure for my first question I made some changes to my routes file here I use resources for my model which generated the routes and then I write this code in link : This is what I change in route : resources :feed_likes, param: :feed_id and this is my links which I am passing the params : it is

Re: [Rails] Re: Rails passing params in link_to how to make it secure

2015-08-15 Thread nilay singh
I solve the issue On Aug 16, 2015 8:56 AM, "Elizabeth McGurty" wrote: > Nilay, > > What's the status of your effort here? > > Liz > > On Monday, August 10, 2015 at 3:36:52 PM UTC-4, nilay singh wrote: >> >> I am trying to create a like and disl

[Rails] Re: Rails passing params in link_to how to make it secure

2015-08-11 Thread nilay singh
rimary" %> And paul there is one more problem . I need to fix that you can see the url of my links are passsing the params is it a right way if yes then ok but the problem is When I paste the url direclty in the browser it get updated how can I prevent this . On Tuesday, August 11, 2015

[Rails] Re: Rails passing params in link_to how to make it secure

2015-08-10 Thread nilay singh
three ajax request . And it is a very bad thing how to fix this On Tuesday, August 11, 2015 at 1:06:52 AM UTC+5:30, nilay singh wrote: > > I am trying to create a like and dislike function inside rails for that I > am using lin_to helper to pass params but there is an issue when ever > s

[Rails] Rails passing params in link_to how to make it secure

2015-08-10 Thread nilay singh
I am trying to create a like and dislike function inside rails for that I am using lin_to helper to pass params but there is an issue when ever someone tries to copy paste the links it updated the database . I am using ajax to make this function work here is the code for my method . Controlle

[Rails] Re: Rails Advance query CASE WHEN method not working

2015-07-31 Thread Nilay Singh
Fixing a schema is other thing this very straight forward question how can I generate the query which I am using in find_by_sql or is there any mechanism where I can select two tables without join and use the case and when . Or can you tell me how to right exact query where I can get the result lik

[Rails] Rails Advance query CASE WHEN method not working

2015-07-31 Thread Nilay Singh
Is there anyone who can suggest me the solution for a Find_by_sql query here when I am using mysql that work perfect . But when I converted that into active record It is not showing the exact result . First I have tried this code below using find_by_sql: @message3 = Message.find_by_sql(["SELEC

[Rails] How to update feed using ajax in Rails 4.0

2015-07-17 Thread nilay singh
I am trying to create an ajax functionality for a sample app of michael heart book . I created a feed model controller which is micropost in hear book . I am trying to use ajax like post feed method . But I am getting some error . I am attaching my code below take a look and help me . feeds_co