RailsCasts Pro episodes are now free!

Learn more or hide this

Raj's Profile

GitHub User: StarWar

Comments by Raj

Avatar

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?

Avatar

I have a readonly api hosted on heroku. I also built an android client for this api.

What I want is that only my android app should be able to consume this api.

What is the best possible solution I can apply. Do I need ssl certificate?

Thanks in advance!!

Avatar

I'm using draper and in my controller's index action, i have following code

PostsController
@posts = PostDecorator.approved.order('created_at DESC').includes(:user, :category).page(params[:page]).per(5)

and in my view

index.html.erb
<ul>
    <%= render @posts %>
</ul>
<%= paginate @posts %>

and I have a partial, _post.html.erb
I want to access methods defined in PostDecorator and UserDecorator in my partial
like post.post_title

What should i need to do to pass @posts variable into my _post partial and access decorator methods

I tried following but failed
<%= render @posts, locals: { post: @posts} %>
and
<%= render @posts, object: @posts %>

Please help me
Thanks :)

Avatar

I am using devise with omniauth-facebook, it works fine and I can login and logout.
I encountered two errors

  • 1. when it logs in it append #= to window url
  • 2. When I use javascript sdk, as described in this screencast, it shows following error

Could not authenticate you from Facebook because "Csrf detected".

for the first error, a solution on StackOverflow suggest
<script type="text/javascript">if (window.location.hash == '#_=_')window.location.hash = '';</script>

is this right approach to handle this bug and how do I resolve csrf detected error when using javascript sdk.