Super website with a great sharing and amazing stories is ur web.. please keep doing what u do now.. thanks to you, It's a great sharing and really informative.. will keep following ur web. thanks to you and ur great website.
My question is though, now that I'm accessing the nested tags resource under posts, should I be hitting the Tags controller still? Or should I setup some other controller to handle the nested nature of tags at this point? Otherwise I have to build additional logic into the Tags controller. This can be done of course, but is this the common way of handling nested routes and resources? The code I have in the index action for the Tags controller is as follows:
def index
if params[:post_id] && @post = Post.find_by_id(params[:post_id])
@tags = Post.find_by_id(params[:post_id]).tags
else
@tags = Tag.order(:name)
end
respond_to do |format|
format.html
format.json {render json: @tags.tokens(params[:q]) }
end
end
The documentation says that the :find keywords “may include the :conditions, :joins, :include, :offset, :limit, and :readonly options”. Note that this does not mean that only those options are supported. :sort also works like it should, for example.
Perfect for my preference. I love being super emotional and over dramatic and in this situation, I sprung to my keyboard and started to type in and got right to adding to my property.
find_by will return only one row, while find_all_by (not find_by_all) returns all of found records.
But now find_all_by is deprecated and you need to use where. Example:
Ruby
Example.find_all_by_published(true)
# should be replaced with Example.where(published:true)
Thanks have been given the opportunity to comment. Hopefully what you provided is useful for all those who need them. Visit my website if you want to know more about:
Lets say I have News and Blog Posts and I have feed for both of these. Do you recommend it from SEO perspective. Should I try to provide a single feed or separate feed depending on the controller. As shown in this railscast. Or have a separate FeedController and have one feed?
Solved...Thanks Very...:D
Super website with a great sharing and amazing stories is ur web.. please keep doing what u do now.. thanks to you, It's a great sharing and really informative.. will keep following ur web. thanks to you and ur great website.
Thanks
Hello, thanks for this article
It's very useful and interesting. Thanks
My question is though, now that I'm accessing the nested tags resource under posts, should I be hitting the Tags controller still? Or should I setup some other controller to handle the nested nature of tags at this point? Otherwise I have to build additional logic into the Tags controller. This can be done of course, but is this the common way of handling nested routes and resources? The code I have in the index action for the Tags controller is as follows:
def index
if params[:post_id] && @post = Post.find_by_id(params[:post_id])
@tags = Post.find_by_id(params[:post_id]).tags
else
@tags = Tag.order(:name)
end
respond_to do |format|
format.html
format.json {render json: @tags.tokens(params[:q]) }
end
end
Routes for the users resource in routes.rb. also defined as
{Rails.application.routes.draw do
resources :users, only: [:index, :show, :update]
end}
The documentation says that the :find keywords “may include the :conditions, :joins, :include, :offset, :limit, and :readonly options”. Note that this does not mean that only those options are supported. :sort also works like it should, for example.
Building on your response, I replaced Ryan's
with_last_state
with thisMAX(id)
solution:Thank you so much, great advice !
Perfect for my preference. I love being super emotional and over dramatic and in this situation, I sprung to my keyboard and started to type in and got right to adding to my property.
Thank you for the information! very good article!
thanks - +1
sdfgdgdfg
Hi Luke,
I was wondering, would I replace the word column with my div's class if I was to use div's instead of tables?
Cool content !very pleased with the author
find_by
will return only one row, whilefind_all_by
(notfind_by_all
) returns all of found records.But now
find_all_by
is deprecated and you need to usewhere
. Example:Thanks, that's reaaly useful. Will apply.
Thanks have been given the opportunity to comment. Hopefully what you provided is useful for all those who need them. Visit my website if you want to know more about:
thanks for sharing
so cool john
referring to yours
hidden object
i agree
great for newbie
Thanks so much
Thank you for sharing videos about rails. Good job!
I enjoy the subject you are talking about. It very interesting! Thanks for sharing!
This is really interesting information for me. Thanks for sharing!
Great feature I will use it! thanks
I had a very similar problem. Thank you for posting a solution, this does not happen often on the internet :)
Thank you very Steady info
Great post & Best website
ok i know
Lets say I have News and Blog Posts and I have feed for both of these. Do you recommend it from SEO perspective. Should I try to provide a single feed or separate feed depending on the controller. As shown in this railscast. Or have a separate FeedController and have one feed?
thanks
how did u put this?
very nice every thing is good
Thanks a lot, it has clear a lots of thing.
Perfect website, thanks for sharing.
Thanks for sharing information, good advise.
I really wanted to send a small word to say thanks to you for the fantastic points you are writing on this site.
Thanks for the tips and guide. It is very useful tips.
Love your site, thanks.
Interesting post. I Have Been wondering about this issue, so thanks for posting.
was looking for this information, thanks to the author of the post, I am glad to join your community!
Agree with your opinion, thanks
This is the type of information I’ve long been trying to find. Thank you for writing this information.
Thanks for sharing information, good advise.
Thanks for the tips and guide. It is very useful tips.