Hi I want my admin user to create news posts that are the viewed on the public News page. I was thinking that this could be achieved by having the admin user create "Blogs", but i only want the admin user to create these. Any ideas on how this can be achieved? -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 4 February 2012 11:38, Richard l. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hi > > I want my admin user to create news posts that are the viewed on the > public News page. I was thinking that this could be achieved by having > the admin user create "Blogs", but i only want the admin user to create > these. Any ideas on how this can be achieved?Without the slightest idea about any of your code it is impossible for us to answer this other than to suggest that you only make the page for creating blogs visible to admins and, when a request is made to create one, check that the current user is an admin. 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
hi, this is what i have now done, dont know why i didnt think if this earlier. However i now have the following issue. im my private_pages controller i have def news @post = Post.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @post } end end in my private_pages/news view i have <body id="contact"> <h1 class="news">Bafo News</h1> <font size="3" face="arial" color="white"> <table> <tr> <th>Title</th> <th>Body</th> <th></th> <th></th> <th></th> </tr> <% @posts.each do |post| %> <tr> <td><%= post.title %></td> <td><%= post.body %></td> </tr> <% end %> </table> <br /> </body> When i try and view the private_pages/news page i get this error message ActiveRecord::RecordNotFound in PrivatePagesController#news Couldn''t find Post without an ID Any ideas? -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 4 February 2012 15:55, Richard l. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> hi, this is what i have now done, dont know why i didnt think if this > earlier. However i now have the following issue. > > im my private_pages controller i have > > def news > > @post = Post.find(params[:id]) > > respond_to do |format| > format.html # show.html.erb > format.json { render json: @post } > end > end > > in my private_pages/news view i have > > <body id="contact"> > <h1 class="news">Bafo News</h1> > > <font size="3" face="arial" color="white"> > > <table> > <tr> > <th>Title</th> > <th>Body</th> > <th></th> > <th></th> > <th></th> > </tr> > > <% @posts.each do |post| %> > <tr> > <td><%= post.title %></td> > <td><%= post.body %></td> > </tr> > <% end %> > </table> > > <br /> > > > > </body> > > > When i try and view the private_pages/news page i get this error message > > ActiveRecord::RecordNotFound in PrivatePagesController#news > > Couldn''t find Post without an ID > > Any ideas?The clue is often in the error message, it says it needs an id to find a post. Assuming that the line it is complaining about is @post = Post.find(params[:id]) which you should be able to verify from the stack trace then that suggests that params[:id] is not set. Have a look in log/development.log and it will tell you what parameters are being passed in. Also have a look at the Rails Guide on Debugging and it will provide a number of techniques for debugging your code. In particular look at using ruby-debug to break into your code to inspect data and follow the flow. In this case if you cannot see the problem you could break in before the offending line and see what is in params. 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.
On Sat, Feb 4, 2012 at 7:55 AM, Richard l. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: Not related to your stated problem but --> <font size="3" face="arial" color="white">Please, in the name of all that''s holy, lose the font tags and learn to write proper markup and CSS. It *is* the 21st century, y''know. -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org http://about.me/hassanschroeder twitter: @hassan -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
apologies for the ancient font tags, but every one has to start somewhere -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sat, Feb 4, 2012 at 11:10 AM, Richard l. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> apologies for the ancient font tags, but every one has to start > somewhereUh, "start" by using markup that was deprecated 13 years ago? Why? I''m guessing you''re not using a 13-year-old version of Ruby, or the original release of Rails, and you''re almost certainly not looking at web pages in Mosaic or Netscape 1.0, so that logic escapes me... -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org http://about.me/hassanschroeder twitter: @hassan -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 4 February 2012 21:58, Hassan Schroeder <hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Sat, Feb 4, 2012 at 11:10 AM, Richard l. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> apologies for the ancient font tags, but every one has to start >> somewhere > > Uh, "start" by using markup that was deprecated 13 years ago? Why? > > I''m guessing you''re not using a 13-year-old version of Ruby, or the > original release of Rails, and you''re almost certainly not looking at > web pages in Mosaic or Netscape 1.0, so that logic escapes me...I can sympathise with Richard here, when one is getting started the easiest thing to do is start by copying examples found in books and on the web. There are very many examples of inline styling still about and if one is not familiar with css then the easiest thing to do is just to copy the example initially. If one is just experimenting with code there is no point going to the efforts of converting it to use css when it may just be thrown away anyway. 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I agree with Colin. He is starting to code now, he should focus in one or two things at a time. But Richard, CSS is *very* good and you should learn how to use it. :) This is the RailsGuides page about debugging: http://guides.rubyonrails.org/debugging_rails_applications.html Good luck! On Feb 5, 7:19 am, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 4 February 2012 21:58, Hassan Schroeder <hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > On Sat, Feb 4, 2012 at 11:10 AM, Richard l. <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > >> apologies for the ancient font tags, but every one has to start > >> somewhere > > > Uh, "start" by using markup that was deprecated 13 years ago? Why? > > > I''m guessing you''re not using a 13-year-old version of Ruby, or the > > original release of Rails, and you''re almost certainly not looking at > > web pages in Mosaic or Netscape 1.0, so that logic escapes me... > > I can sympathise with Richard here, when one is getting started the > easiest thing to do is start by copying examples found in books and on > the web. There are very many examples of inline styling still about > and if one is not familiar with css then the easiest thing to do is > just to copy the example initially. If one is just experimenting with > code there is no point going to the efforts of converting it to use > css when it may just be thrown away anyway. > > 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.