# (WILL PAY) Blog combined with reading

**URL:** <https://www.ruby-forum.com/t/will-pay-blog-combined-with-reading/187153>\
**Category:** Ruby\
**Created:** [April 18, 2010, 8:05pm UTC](https://www.ruby-forum.com/t/will-pay-blog-combined-with-reading/187153 "2010-04-18T20:05:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![guru\_101](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/77aa72/32.png) [@guru\_101](https://www.ruby-forum.com/u/guru_101)\
**Post date:** [April 18, 2010, 8:05pm UTC](https://www.ruby-forum.com/t/will-pay-blog-combined-with-reading/187153/1 "2010-04-18T20:05:01Z")

</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\_101](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/77aa72/32.png) [@guru\_101](https://www.ruby-forum.com/u/guru_101)\
**Post date:** [April 18, 2010, 11:35pm UTC](https://www.ruby-forum.com/t/will-pay-blog-combined-with-reading/187153/2 "2010-04-18T23:35:51Z")

</div>

Anyone???

---

<div class="post-metadata">

**Author:** ![guru\_101](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/77aa72/32.png) [@guru\_101](https://www.ruby-forum.com/u/guru_101)\
**Post date:** [April 19, 2010, 2:21am UTC](https://www.ruby-forum.com/t/will-pay-blog-combined-with-reading/187153/3 "2010-04-19T02:21:27Z")

</div>

On Apr 18, 2010, at 14:35 , Tiger Big one wrote:

> Anyone???

You didn’t get your answer within 2.5 hours… maybe you should be more  
patient. But I’d also suggest you email/post on a ruby on rails  
list/forum, not one dedicated to ruby.

---

<div class="post-metadata">

**Author:** ![guru\_101](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/77aa72/32.png) [@guru\_101](https://www.ruby-forum.com/u/guru_101)\
**Post date:** [April 19, 2010, 5:20am UTC](https://www.ruby-forum.com/t/will-pay-blog-combined-with-reading/187153/4 "2010-04-19T05:20:32Z")

</div>

On Apr 18, 8:20 pm, Ryan D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On Apr 18, 2010, at 14:35 , Tiger Big one wrote:
> 
> > Anyone???
> 
> You didn’t get your answer within 2.5 hours… maybe you should be more patient. But I’d also suggest you email/post on a ruby on rails list/forum, not one dedicated to ruby.

Take a look at Hobo too. It just went 1.0.

> **[Venostech.com](https://www.venostech.com/)**
>
> Venostech.com
