I have an intranet application with several modules, I want them to separate when routing. For example:
http://intranet/calendar/...
http://intranet/site_admin/...
http://intranet/tasks/...
Each of module can have many or single controller. How to write such routes?
...
I've wanted to learn Ruby for some time and even started to learn a little bit. I then got distracted and for some reason went with Python. I have now however decided that even though my current project is in Python, I will also be learning Ruby and Ruby on Rails.
If somebody were to ask me what version of Python to start with I'd sugge...
I believe I have put the question quite clearly and in a concise manner. Why do I ask?
I am to explain Ruby on Rails framework to students and this requires me to make some analogies to the Java world (as the course is quite Java-centric). I have no hands-on experience with Ruby on Rails but I sense the Gem/Jar analogy is a valid one.
...
Hi All,
I have a loop that looks like this
def slow_loop(array)
array.each_with_index do |item, i|
next_item = array[i+1]
if next_item && item.attribute == next_item.attribute
do_something_with(next_item)
end
end
end
aside from changing the way do_something_with is called, how can i make this perform better?
thx,
-C...
My feeling is that the differences between Camping and Sinatra are not very significant and that you could safely choose either one and be ok. But I want to ask the Ruby experts if this is true. Are there in fact any important differences between the Sinatra and Camping microframeworks? And how would you go about deciding which one to us...
Hi,
Im facing some problems, I looked around in the forum and didnt find
any solutions discussed. Im sorry if these have been resolved earlier.
Is there someway I can make the VIM line break after 80 characters. I
dont want the text to wrap around but create a new line. And I wish it would
break off the complete last word. So instead ...
Hi,
I am a ruby on rails newbie. In my app i created using scaffold, breakpointer is not there under scripts directory. When i copied breakpointer from somewhere and put under scripts directory, it was giving an error. Any pointers on this will be great..
Thanks,
Ayyappa
...
Using ActiveRecord, I have an object, Client, that zero or more Users (i.e. via a has_many association). Client also has a 'primary_contact' attribute that can be manually set, but always has to point to one of the associated users. I.e. primary_contact can only be blank if there are no associated users.
What's the best way to impleme...
Usage of Time.now or Time.now.to_s or Time.now.to_datetime is throwing error.
Usage of Date.today doesn't help as it stores the date with time as 12.00 AM and not the current time stamp.
Please help me in resolving this issue.
...
Is there a way to tell cucumber not to skip other tests in a scenario when a test fail?
...
That is pretty easy with a plain hash like
{:a => "a", :b => "b"}
which would translate into
"a=a&b=b"
but what do you do with something more complex like
{:a => "a", :b => ["c", "d", "e"]}
which should translate in
"a=a&b[0]=c&b[1]=d&b[2]=e"
or even worse, with something like:
{:a => "a", :b => [{:c => "c", :d => "d"},...
I'm handling file attachments in my Rails app with Attachment_fu, which provides a public_filename method to retrieve a file's URL.
I'm using it on a model called Cover, so if I want to call the URL of an uploaded cover image, in a view I would do:
<%= image_tag(@cover.public_filename) %>
This works just fine when the user has the app...
Since Rails is already an effective Rich Internet Application framework because of the way it makes Ajax so easy, what is the argument for combining Rails with Flex and using Flex as the front end instead of HTML? A programmer friend of mine said he uses this combination because Flex is great for RIAs. My argument is that Rails is alread...
Trying to get along with Sphinx/Thinking Sphinx for the first time.
I've got my models defined as follows (simplified):
class Branch < ActiveRecord::Base
has_many :salesmen, :class_name => "User"
has_many :leads, :through => :salesmen
end
class User < ActiveRecord::Base
belongs_to :branch
has_many :leads, :foreign_key => "ow...
Hey,
I am trying to build a very simple game using Ruby that will be on the web. I am am trying to:
user goes to page and a string appears for X amount of seconds and then after X amount hide it and ask for the user input then check to see how far the person got (how many they guessed right)
I would have strings for:
timeout in secon...
I am having issues getting a workling daemon working correctly. When I run:
ruby script/workling_client run
the daemon starts to load rails, but hangs indefintely. When I kill the process, the stack trace is always the same:
/Library/Ruby/Gems/1.8/gems/activesupport-2.1.2/lib/active_support/core_ext/load_error.rb:32:in `new': Interr...
What does that mean?
In the instructions for a project, it said to "freeze the Rails gems". Is that different from freezing the Rails version?
What's freezing about?
...
Hi. I'm building a website for my Web Dev class, and I'm stuck on rendering HTML. I want to be able to use a simple form (Pretty much all I have right now is a scaffold for this controller, and I attempted sticking a content_type into my controller, but no progress.) to submit text and have it rendered as HTML. The idea is that, since th...
I have an older Rails app that I need to run. But I have the latest version of Rails.
When I try to run this older app it says:
Missing the Rails 1.99.0 gem. Please
gem install -v=1.99.0 rails
But when I run the command: gem install -v=1.99.0 rails
ERROR: could not find gem rails
locally or in a repository
Not sure what...
I am using Time.parse to create a Time object from a string.
For some reason
Time.parse("05-14-2009 19:00")
causes an argument our of range error, whereas
Time.parse("05-07-2009 19:00")
does not
Any ideas?
...