@Michael is right. We can help you in doing this, in case you are stuck up
somewhere, but you must really atleast make an effort.

As of point 3, you can consider the following suggestions:

   1. `current_user.roles.map {|r| r.to_s}.include?('admin')`

   Consider moving this code to User model by defining an instance function
   like 'admin?'    so that you can call 'current_user.admin?'
   2. `@info = Info.find(:first, :conditions => "article_id =
   #{@article.id}")`

   Use associations to define this so that you call `@info = @article.info`
   3. `@comments = Comment.find(:first, :conditions => "article_id =
   #{@article.id}")`

   Again use associations for this. Also, since this is returning a single
   object, the variable name should be @comment (singular).



On Fri, Feb 3, 2012 at 5:08 PM, Michael Pavling <pavl...@gmail.com> wrote:

> On 3 February 2012 11:34, Srimanta Chakraborty <li...@ruby-forum.com>
> wrote:
> >>> Michael Pavling wrote in post #1043878:
> >>>> Really? you're just pasting your homework questions directly to the
> >>>> list now without even paraphrasing them?!
> >>>
> >>> Yes
> >>
> >> Hahaha! At least you're honest :-)
> >
> > Thanks for your compliment. But please...
>
> I'm not doing your homework for you.
>
> If you get a certain way through it and get stuck, I'm happy to nudge,
> but just answering the whole question doesn't do you any favours.
>
> Pass the test on your merits by learning the material; don't have me
> pass your tests for you.
>
> --
> 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@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>


-- 
Thanks,
Prince

-- 
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@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to