# Blog and comments!

**URL:** <https://www.ruby-forum.com/t/blog-and-comments/187154>\
**Category:** Rails\
**Created:** [April 18, 2010, 8:09pm UTC](https://www.ruby-forum.com/t/blog-and-comments/187154 "2010-04-18T20:09:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guru\_101011](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/85e7bf/32.png) [@Guru\_101011](https://www.ruby-forum.com/u/Guru_101011)\
**Post date:** [April 18, 2010, 8:09pm UTC](https://www.ruby-forum.com/t/blog-and-comments/187154/1 "2010-04-18T20:09:11Z")

</div>

Blog:

> **[How to Create a Blog from Scratch Using Ruby on Rails](https://www.webfx.com/blog/web-design/how-to-create-a-blog-from-scratch-using-ruby-on-rails/)**
>
> Learn how to create a blog using Ruby on Rails. By covering the design aspects it makes it easier to understand the concepts behind Rails!

I will pay for someone to solve this problem for me! post ur email or  
msn or yim!

Basically, what i got at the moment that works is the reading, ADD and  
EDIT and delete posts that people have made, i have also added a  
friendship so only friends of that person can view the post.

What i want to achieve now is that users can comment on that post!  
This is the hard thing and i dont understand how i can combine the  
commenting system with my own reading system.

Also, i have done some tests but i really need some help! in my view/  
reading i only have the add.rhtml and edit.rhtml. In the userhub page,  
i have the current code:  
######################################

app/view/user/index.rhtml  
######################################  
\<% @user.reading.each do |reading| %\>

Book: \<%= reading.name %\>  

```
<u>Description:</u> <%= reading.description %></div>
<%= link_to "Edit",
      :controller => :reading,
      :action => :edit,
      :id => reading.id %> |
<%= link_to "Delete",
      :controller => :reading,
      :action => :delete,
      :id => reading.id %>

```

\<% end %\>  
######################################

Reading File?: Controller is called “reading”

Made this myself:

######################################

reading\_controller.rb  
######################################

class ReadingController \< ApplicationController

before\_filter :protect

def add  
@title = “Add a New Reading Material”

```
if request.post?
  @reading = Reading.new(params[:reading])
  @reading.user_id = User.logged_in(session).id
  if @reading.save
    flash[:notice] = "Reading #{@reading.name} added!"
    redirect_to :controller => :user, :action => :index
  end
end

```

end

def edit  
@title = “Edit a Reading material”  
@reading = Reading.find(params[:id])  
if request.post?  
if @reading.update\_attributes(params[:reading])  
flash[:notice] = “Reading #{@reading.name} updated!”  
redirect\_to :controller =\> :user, :action =\> :index  
end  
end  
end

def delete  
@reading = Reading.find(params[:id])  
flash[:notice] = “Reading #{@reading.name} deleted!”  
@reading.destroy  
redirect\_to :controller =\> :user, :action =\> :index  
end

private

# Protect a page against not logged users

def protect  
unless User.logged\_in?(session)  
flash[:notice] = “Please login first”  
redirect\_to :controller =\> :user, :action =\> :login  
return false  
end  
end  
end  
######################################

---

<div class="post-metadata">

**Author:** ![Guru\_101011](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/85e7bf/32.png) [@Guru\_101011](https://www.ruby-forum.com/u/Guru_101011)\
**Post date:** [April 18, 2010, 10:51pm UTC](https://www.ruby-forum.com/t/blog-and-comments/187154/2 "2010-04-18T22:51:54Z")

</div>

Anyone? Please help!

---

<div class="post-metadata">

**Author:** ![Guru\_101011](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/85e7bf/32.png) [@Guru\_101011](https://www.ruby-forum.com/u/Guru_101011)\
**Post date:** [April 18, 2010, 11:07pm UTC](https://www.ruby-forum.com/t/blog-and-comments/187154/3 "2010-04-18T23:07:42Z")

</div>

On 18 April 2010 21:50, Guru\_101011 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Anyone? Please help!

You may have to wait more than a couple of hours for a reply. What  
you must remember is that at any particular moment one third of the  
world is asleep, another third is working. 99% of the rest have never  
heard of Ruby on Rails, and 99% of those that have are not monitoring  
this list. It seems that just leaves you and me at the moment, and I  
am retired and not interested in paid work.

Sorry

Colin

---

<div class="post-metadata">

**Author:** ![Guru\_101011](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/85e7bf/32.png) [@Guru\_101011](https://www.ruby-forum.com/u/Guru_101011)\
**Post date:** [April 18, 2010, 11:24pm UTC](https://www.ruby-forum.com/t/blog-and-comments/187154/4 "2010-04-18T23:24:41Z")

</div>

On 18 April 2010 22:14, Colin L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Actually my maths is way off, that would still leave about a quarter  
> of a million people monitoring the list at the moment, I wonder why  
> no-one else replied.

LOL! You have too much free time! 🙂

---

<div class="post-metadata">

**Author:** ![Guru\_101011](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/85e7bf/32.png) [@Guru\_101011](https://www.ruby-forum.com/u/Guru_101011)\
**Post date:** [April 18, 2010, 11:16pm UTC](https://www.ruby-forum.com/t/blog-and-comments/187154/5 "2010-04-18T23:16:30Z")

</div>

On 18 April 2010 22:05, Colin L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On 18 April 2010 21:50, Guru\_101011 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Anyone? Please help!
> 
> You may have to wait more than a couple of hours for a reply. What  
> you must remember is that at any particular moment one third of the  
> world is asleep, another third is working. 99% of the rest have never  
> heard of Ruby on Rails, and 99% of those that have are not monitoring  
> this list. It seems that just leaves you and me at the moment, and I  
> am retired and not interested in paid work.

Actually my maths is way off, that would still leave about a quarter  
of a million people monitoring the list at the moment, I wonder why  
no-one else replied.

Colin

---

<div class="post-metadata">

**Author:** ![Guru\_101011](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/85e7bf/32.png) [@Guru\_101011](https://www.ruby-forum.com/u/Guru_101011)\
**Post date:** [April 19, 2010, 10:38am UTC](https://www.ruby-forum.com/t/blog-and-comments/187154/6 "2010-04-19T10:38:22Z")

</div>

The “15 minute blog” screencast will show you how to set up a basic  
blog:  
[http://media.rubyonrails.org/video/rails\_blog\_2.mov](http://media.rubyonrails.org/video/rails_blog_2.mov)

If your goal is to learn Ruby on Rails, then paying somebody to write  
the code for you isn’t going to be a very effecitve way to learn.
