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.
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.
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.