Forum: Ruby 12 Days Ago |
| Replies: 3 Views: 374 Your text example doesn't really show how the script you provide works. Here's what you are probably after though - this could be a bit more robust but in this state it's clear:
... |
Forum: Ruby Jun 5th, 2009 |
| Replies: 3 Views: 1,816 In ruby if you don't know what class an object is you can use it's class method and the docs to find out.
% irb --simple-prompt
>> a = :something
=> :something
>> a.class
=> Symbol |
Forum: Ruby Jan 8th, 2009 |
| Replies: 2 Views: 1,791 In your controller do you have
@user = User.find(:first)
or something similar? Could you post your controller code? |
Forum: Ruby Apr 24th, 2008 |
| Replies: 5 Solved: Hi Views: 3,130 No problem, its not the most obvious solution |
Forum: Ruby Apr 15th, 2008 |
| Replies: 5 Solved: Hi Views: 3,130 Did your source file definitely have a .rb extension? Did anything at all appear in the output window? |
Forum: Ruby Apr 15th, 2008 |
| Replies: 1 Views: 2,289 Installed rails? I know its not the be-all and end-all of ruby web development but it is decently documented and probably the easiest way of getting an up and running ruby-based webapp. |
Forum: Ruby Jan 21st, 2008 |
| Replies: 5 Views: 7,458 Try starting it and navigating to http://localhost:3000 |
Forum: Ruby Jan 2nd, 2008 |
| Replies: 5 Views: 3,492 |
Forum: Ruby Jan 1st, 2008 |
| Replies: 3 Views: 3,139 Looking at your code I can't see whats wrong.
What happens if in your view you do
<% for st in @stocks -%>
<%= h(st.inspect) %><br />
<% end %> |
Forum: Ruby Dec 29th, 2007 |
| Replies: 5 Views: 3,492 Although your solution is fine it can be a little more readable (and re-usable) in rails.
In the controller:
def banner(text)
span = String.new
text.split(//).each_with_index do |c, i| ... |
Forum: Ruby Dec 5th, 2007 |
| Replies: 1 Views: 2,954 From my experience using STI isn't too bad so long as too many models are involved; it can get messy using the rails method with the 'type' column.
Of course you could try with CTI but its... |
Forum: Ruby Nov 9th, 2007 |
| Replies: 4 Views: 6,123 You can add as many :has_many and :belongs_to statements to each model as you like.
Then you can access the associated like this:
#in controller
def view
@actor = Actor.find(1)
end |
Forum: Ruby Oct 18th, 2007 |
| Replies: 4 Views: 3,441 Glad you're so enthusiastic about it - another invaluable resource when you're starting out is IRC; lots of knowledgable people in both #ruby-lang and #rubyonrails on freenode if you get stuck and if... |
Forum: Ruby Sep 2nd, 2007 |
| Replies: 3 Views: 3,908 linkage (http://www.ruby-doc.org/docs/ProgrammingRuby/html/rdtool.html) |
Forum: Ruby Jul 11th, 2007 |
| Replies: 2 Views: 3,292 Depends on the plugin but generally it should be a case of adding the repository url:
script/plugin source url
Then installing it..
script/plugin install ferret (or whatever you wanna... |
Forum: Ruby Jun 19th, 2007 |
| Replies: 2 Views: 3,541 Google 'tag cloud rails' (http://www.google.co.uk/search?hl=en&q=rails+tag+cloud&btnG=Search&meta=). Top 5 results should give you a pretty good indication.
To be honest though its not exactly... |
Forum: Ruby Jun 12th, 2007 |
| Replies: 2 Views: 3,148 You should find the method described here (http://www.kanthak.net/opensource/file_column/) suitable. It works for any file type. |
Forum: Ruby May 28th, 2007 |
| Replies: 2 Views: 5,228 Rails wiki on plugins (http://wiki.rubyonrails.org/rails/pages/Plugins) |
Forum: Ruby May 21st, 2007 |
| Replies: 8 Views: 6,401 The params are in a hash (eg {"action"=>"list", "filter"=>"closed", "controller"=>"issue"}. If you want to iterate through them for example use:
params.each do |key, value|
#do something... |
Forum: Ruby May 20th, 2007 |
| Replies: 8 Views: 6,401 params[:param_name]
So say for example you're using pagination and you want the page_number param list?page_number=1:
params[:page_number] |
Forum: Ruby May 14th, 2007 |
| Replies: 4 Views: 5,188 Yeah; you would need to use AJAX to make the form dynamic.
Here (http://www.onlamp.com/pub/a/onlamp/2005/06/09/rails_ajax.html) is a tutorial to get you started |
Forum: Ruby May 10th, 2007 |
| Replies: 13 Views: 8,803 I'm sorry but I disagree, Ruby is very versatile and used an awful lot in non-web applications.
It is Rails that has made Ruby popular as a Web development language
As for moving the Ruby... |
Forum: Ruby Apr 23rd, 2007 |
| Replies: 5 Views: 5,816 "w+" is a mode string; it truncates the file (or creates a new one if it doesn't exist)
|f| is a block. Basically it means that in the following code f refers to the file.
A quick example of a... |
Forum: Ruby Apr 22nd, 2007 |
| Replies: 5 Views: 5,816 For some reason the rubycentral site seems to be down so the original (http://www.rubycentral.com/book/ospace.html) article I'd link to isn't available, however it's in the google cache... |
Forum: Ruby Apr 16th, 2007 |
| Replies: 29 Views: 10,322 The rails framework is based on Basecamp |
Forum: Ruby Apr 14th, 2007 |
| Replies: 3 Views: 13,189 Ah - I see what you mean now.
Try something like this (for this i'm assuming a person has many jobs):
<%= collection_select
:person,
:job_ids,
Job.find(:all),
:id, |
Forum: Ruby Apr 12th, 2007 |
| Replies: 3 Views: 13,189 You need to give more information. What do you want to be selected and when?
If you want a default value put
t.column :favourite_colour_id, :integer, :default => 1
in your migration.
If you... |
Forum: Ruby Apr 12th, 2007 |
| Replies: 2 Views: 2,955 ie.form(:index, 1).images.count
Can't test it don't have a Windows machine handy |
Forum: Ruby Apr 8th, 2007 |
| Replies: 13 Views: 6,829 Yes. In fact most Rails folks use MySQL |
Forum: Ruby Mar 28th, 2007 |
| Replies: 1 Views: 2,857 You need to be using the observe field (http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html#M000535) function. If you google it along with tutorial am sure something suitable... |
Forum: Ruby Mar 24th, 2007 |
| Replies: 13 Views: 6,829 There is a 1-click-installer available at:
http://rubyinstaller.rubyforge.org/
It should get you started. There are lots of tutorials around too; google will provide lots. |
Forum: Ruby Mar 19th, 2007 |
| Replies: 5 Views: 6,666 Afraid I never tried to run Scite from a flash drive. Have you tried Notepad++? When I was at uni I ran that from my flash cos the text editor installed on the Windows workstations was annoying (so... |
Forum: Ruby Mar 16th, 2007 |
| Replies: 13 Views: 6,829 You cant just put ruby on rails in, it needs to be in quotes so you don't get gems and train related stuff back.
http://www.google.com/trends?q=ruby+on+rails%2C+python
Good example, look at... |
Forum: Ruby Mar 14th, 2007 |
| Replies: 1 Views: 6,396 I think narray will do what you need.
http://narray.rubyforge.org/index.html.en |
Forum: Ruby Mar 8th, 2007 |
| Replies: 2 Views: 5,408 quick example using action_mailer.
If you don't have it already gem install 'action_mailer'
require 'action_mailer'
ActionMailer::Base.server_settings = {
:address =>... |
Forum: Ruby Mar 5th, 2007 |
| Replies: 4 Views: 4,277 If I were you I'd get to grips with ruby alone first, then apply what you know to rails
A really good in-browser introduction to ruby:
http://tryruby.hobix.com/
These are a little longer and... |
Forum: Ruby Feb 23rd, 2007 |
| Replies: 13 Views: 6,829 Its not that well spread yet; still most popular in the UK, Ireland, New Zealand, Australia and South Africa. |
Forum: Ruby Feb 8th, 2007 |
| Replies: 5 Views: 3,477 Also :
Try ruby in your browser! (http://tryruby.hobix.com/)
Why's Poignant Guide (http://poignantguide.net/ruby/) (a lighthearted and fun introduction to the language |
Forum: Ruby Feb 7th, 2007 |
| Replies: 1 Views: 3,523 This (http://wiki.rubyonrails.org/rails/pages/HowtoUploadFiles) tutorial explains how (I presume you're using rails and not radicore or something else)
If I were you I'd only store the location of... |
Forum: Ruby Jan 6th, 2007 |
| Replies: 6 Views: 3,746 I am a rails developer and as jtwenting said earilier in this thread, it is important to have a decent grasp of ruby before trying to get your head around rails.
I did a fair amount of python at... |