*require "rubygems" require "twitter" def login Twitter.configure do |config| config.consumer_key = '''' config.consumer_secret = '''' config.oauth_token = '''' config.oauth_token_secret = '''' end @client = Twitter::Client.new end* In my *tweet.html.erb* *<% @client.**home_timeline**.each do |tweet| %> <%= tweet.user[:screen_name] %> <br/> <%= tweet.text %><br/> <% end %> * Here i got the* undefined method `home_timeline'' for nil:NilClass,* Why cannot access that *@client* in view from controller?* * Thankyou vishnu* * -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/V9EPNc9lZxcJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 6 April 2012 07:45, amvis <vgrkrishnan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> require "rubygems" > require "twitter" > > def login > > Twitter.configure do |config| > config.consumer_key = '''' > config.consumer_secret = '''' > config.oauth_token = '''' > config.oauth_token_secret = '''' > end > > @client = Twitter::Client.new > end > > In my tweet.html.erb > > <% @client.home_timeline.each do |tweet| %> > > <%= tweet.user[:screen_name] %> <br/> > <%= tweet.text %><br/> > > <% end %> > > > Here i got the undefined method `home_timeline'' for nil:NilClass, Why cannot > access that @client in view from controller?You can access it ok, it is just that it is nil. Is the login method being called in the action where you are seeing the problem? Debug into your action to check if necessary. Have a look at the Rails Guide on Debugging to find how to do this. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I have done like that <%= form_tag( { :controller => ''users'', :action => ''login'' }) do %> <% end %> I am trying this for two days, i didn''t get any solution..? On Friday, 6 April 2012 04:08:53 UTC-4, Colin Law wrote:> > On 6 April 2012 07:45, amvis <vgrkrishnan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > require "rubygems" > > require "twitter" > > > > def login > > > > Twitter.configure do |config| > > config.consumer_key = '''' > > config.consumer_secret = '''' > > config.oauth_token = '''' > > config.oauth_token_secret = '''' > > end > > > > @client = Twitter::Client.new > > end > > > > In my tweet.html.erb > > > > <% @client.home_timeline.each do |tweet| %> > > > > <%= tweet.user[:screen_name] %> <br/> > > <%= tweet.text %><br/> > > > > <% end %> > > > > > > Here i got the undefined method `home_timeline'' for nil:NilClass, Why > cannot > > access that @client in view from controller? > > You can access it ok, it is just that it is nil. Is the login method > being called in the action where you are seeing the problem? Debug > into your action to check if necessary. Have a look at the Rails > Guide on Debugging to find how to do this. > > Colin > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/bR_T09UcB-cJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 6 April 2012 10:02, amvis <vgrkrishnan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > I have done like that > <%= form_tag( { :controller => ''users'', :action => ''login'' }) do %> > <% end %> > > I am trying this for two days, i didn''t get any solution..?Please don''t top post, it makes it difficult to follow the thread, and also means that you do not look at each point in the previous mail and answer the questions. Insert you replies inline in previous message. Thanks. So because you have not top posted you have not answered my question: Is the login method being called in the action where you are seeing the problem? And if you think it is have you taken note of my other suggestion to: Debug into your action to check if necessary. Have a look at the Rails Guide on Debugging to find how to do this. If you reply make sure you address these points. Colin> > > > On Friday, 6 April 2012 04:08:53 UTC-4, Colin Law wrote: >> >> On 6 April 2012 07:45, amvis <vgrkrishnan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> > require "rubygems" >> > require "twitter" >> > >> > def login >> > >> > Twitter.configure do |config| >> > config.consumer_key = '''' >> > config.consumer_secret = '''' >> > config.oauth_token = '''' >> > config.oauth_token_secret = '''' >> > end >> > >> > @client = Twitter::Client.new >> > end >> > >> > In my tweet.html.erb >> > >> > <% @client.home_timeline.each do |tweet| %> >> > >> > <%= tweet.user[:screen_name] %> <br/> >> > <%= tweet.text %><br/> >> > >> > <% end %> >> > >> > >> > Here i got the undefined method `home_timeline'' for nil:NilClass, Why >> > cannot >> > access that @client in view from controller? >> >> You can access it ok, it is just that it is nil. Is the login method >> being called in the action where you are seeing the problem? Debug >> into your action to check if necessary. Have a look at the Rails >> Guide on Debugging to find how to do this. >> >> Colin > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/bR_T09UcB-cJ. > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.