Ruby on Rails Wednesday, September 1, 2010

that tutorial is based on Rails 2.1, which could be the cause of your issue. I would recommend railstutorial.org, to get you up and running with Rails 3
 
Jason

On Wed, Sep 1, 2010 at 12:03 PM, Samuel Jackson <lists@ruby-forum.com> wrote:
Hi People,

Ultra noob here. I recently installed Ruby 1.9.2 and Rails 3.0 on
Ubuntu10.04. I have mysql server version 5.1 installed. I also have the
mysql2 database connector

*** LOCAL GEMS ***

abstract (1.0.0)
actionmailer (3.0.0)
actionpack (3.0.0)
activemodel (3.0.0)
activerecord (3.0.0)
activeresource (3.0.0)
activesupport (3.0.0)
arel (1.0.1)
builder (2.1.2)
bundler (1.0.0)
erubis (2.6.6)
i18n (0.4.1)
mail (2.2.5)
mime-types (1.16)
mysql (2.8.1)
mysql2 (0.2.3)
polyglot (0.3.1)
rack (1.2.1)
rack-mount (0.6.12)
rack-test (0.5.4)
rails (3.0.0)
railties (3.0.0)
rake (0.8.7)
sqlite3-ruby (1.3.1)
thor (0.14.0)
treetop (1.4.8)
tzinfo (0.3.23)


I have been following some tutorial to learn some basics

http://www.tutorialspoint.com/ruby-on-rails/rails-views.htm

So far I have been able to do everything until I start the Webrick
server(this is fine and can be seen running in the terminal)

Then when I enter http://localhost/book/list instead of seeing the error
listed in the tutorial about a missing template (you're supposed to go
onto create list.rhtml etc)

I get a different error

Routing Error

No route matches "/book/list"

I have no idea what this is on about. From google searches I understand
there is a routes.rb file which I have opened. But I am not sure what I
need to change in here or even if this is the real cause of the issue.

Any help much appreciated. I am very excited to be learning Ruby and
would really like to be able to complete this tutorial so I can begin my
own web apps.
--
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@googlegroups.com.
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.


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

Ruby on Rails

Hi People,

Ultra noob here. I recently installed Ruby 1.9.2 and Rails 3.0 on
Ubuntu10.04. I have mysql server version 5.1 installed. I also have the
mysql2 database connector

*** LOCAL GEMS ***

abstract (1.0.0)
actionmailer (3.0.0)
actionpack (3.0.0)
activemodel (3.0.0)
activerecord (3.0.0)
activeresource (3.0.0)
activesupport (3.0.0)
arel (1.0.1)
builder (2.1.2)
bundler (1.0.0)
erubis (2.6.6)
i18n (0.4.1)
mail (2.2.5)
mime-types (1.16)
mysql (2.8.1)
mysql2 (0.2.3)
polyglot (0.3.1)
rack (1.2.1)
rack-mount (0.6.12)
rack-test (0.5.4)
rails (3.0.0)
railties (3.0.0)
rake (0.8.7)
sqlite3-ruby (1.3.1)
thor (0.14.0)
treetop (1.4.8)
tzinfo (0.3.23)


I have been following some tutorial to learn some basics

http://www.tutorialspoint.com/ruby-on-rails/rails-views.htm

So far I have been able to do everything until I start the Webrick
server(this is fine and can be seen running in the terminal)

Then when I enter http://localhost/book/list instead of seeing the error
listed in the tutorial about a missing template (you're supposed to go
onto create list.rhtml etc)

I get a different error

Routing Error

No route matches "/book/list"

I have no idea what this is on about. From google searches I understand
there is a routes.rb file which I have opened. But I am not sure what I
need to change in here or even if this is the real cause of the issue.

Any help much appreciated. I am very excited to be learning Ruby and
would really like to be able to complete this tutorial so I can begin my
own web apps.
--
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@googlegroups.com.
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.

Ruby on Rails

Hi all -

Ruby 1.8.7 / Rails 2.3.5

Schedule model: course_id, starts_at, ends_at, capacity
has_many :requests

Request model: user_id, schedule_id, state_id
belongs_to :schedule

request.state_id indicates whether the request has been approved.
(state_id = 2 = pending my approval, state_id = 3 = approved)

I want to list all requests pending my approval, along with the
remaining seats available.

def listPendingRequest
@allRequests = Request.find(:all, :conditions => ["state_id = ?",
2]).each{
|request|
@schedule = Schedule.find(:first, :conditions => ["id =
?",request.schedule_id])
@num = Request.find(:all, :conditions => ["state_id = ? AND schedule_id
= ?", '3', @schedule.id]).nitems
@remaining = @schedule.capacity - @num
}
@request = Array.new
@allRequests.each do |r|
if (r.state_id == 2 and r.approver_id == current_user.id)
@request << r
end
end
if @request.empty?
flash.now[:alert] = "You have no pending requests to approve."
end
end


I currently have this method in my request controller, but I think it
belongs in a model. I don't know which model, though.

Also, this method shows the remaining seats for the first schedule on
all of the requests, regardless of which schedule is being requested.
When I do a @schedule = Schedule.find(:all...), I get an error:
"undefined method 'capacity' for Array".

What am I doing wrong? And where should I put the method?

Thanks in advance for your help!!
--
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@googlegroups.com.
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.