I'd like to be able to generate the following markup:
<label for="field">Something <span class="hint">Field hint</span></label>
from the following code:
form_for ... do |f|
f.label :field, :hint => "Field hint"
end
So far I've created an initializer to store the custom functionality which re-opens ActionView::Helpers::FormBuild...
A sample application I was looking at has this in environment.rb:
config.gem 'rails'
Is this redundant code or is there likely to be a reason the programmer did this?
...
I've set config.time_zone = 'UTC' in environment.rb, and yet still I get some weird behavior with Rails' built-in datetime fields:
>> Time.now
=> Sun Jun 21 17:05:59 -0700 2009
>> Feedback.create(:body => "testing")
=> #<Feedback id: 23, body: "testing", email_address: nil, name: nil, created_at: "2009-06-22 00:06:09", updated_at: "2009...
I'm trying to get a basic example app running that processes email. Nothing fancy, just the barest of functionality at this point. I've installed Fetcher, configured the YAML, updated the :receiver, and created an IncomingMailHandler class.
When I go to start the FetcherDaemon, I get the following error.
/Library/Ruby/Gems/1.8/gems/act...
Say I have a basic Rails app with a basic one-to-many relationship where each comment belongs to an article:
$ rails blog
$ cd blog
$ script/generate model article name:string
$ script/generate model comment article:belongs_to body:text
Now I add in the code to create the associations, but I also want to be sure that when I create a c...
PHP runs in a shared-nothing environment, which in this context means that every web request is run in a clean environment. You can not access another request's data except through a separate persistence layer (filesystem, database, etc.).
What about Ruby on Rails? I just read a blog post stating that separate requests might access ...
I am planning to write some new UI code and many people suggested to use RoR. But from what I have read about RoR so far, it seems to be almost mandatory to have a database to store the backend data. In my case, I do not have access to a database and all my data objects are available through web services (some REST and SOAP services).
I...
I am trying to write specs for a controller without using fixtures (instead employing mock models). This controller requires a user to be logged in, for which I'm employing AuthLogic, following the author's recommendations.
describe UsersController do
def mock_user(stubs={})
@mock_user ||= mock_model(User, stubs)
end
context...
When using the tag
<% title "New user" %>
in my Rails 2.3.2 views I get an undefined method 'title' error. Can anyone shed some light?
...
Hello, I was wondering how I can let a logged in user download his and only his files on the server. For example, no one else but only I can download my Google Docs' documents when I have logged in. Is there a concept page you have link to handy I can read up on? Is there a book like a recipe book that might get into more detail and spec...
Does Rails have an equivalent of the Server.MapPath method from ASP.NET? I've tried looking for one, but couldn't find anything.
Edit: I need this to generate a PDF with some images stored on the server. I know the relative path (URL) of the images, but I need an absolute path on disk to load them. I use FPDF for this and even though it...
When I call the index action of my assets controller, the corresponding index template uses the assets layout which includes this line:
<%= javascript_include_tag 'prototype' %>
The error I get is:
No route matches "/javascripts/prototype.js" with {:method=>:get}
This is my routes file:
ActionController::Routing::Routes.draw do |...
How would I quickly debug helper methods in script\console. I'm talking about making changes and then debugging, over and over again.
This is a lot easier with Model methods, since all I have to do is use
reload!
to test the updated code, whereas to test a helper method, I have to do something like this
foo = ActionView::Base.new
foo.e...
Hi guys,
I'm having the following many to many relationship in Rails (ActiveResource, of course):
class User < ...
has_many :channel_assignments
has_many :channels, :through => :channel_assignments
end
class Channel < ...
has_many :channel_assignments
has_many :users :through => :channel_assignments
end
class ChannelAssignme...
For example, http://foo.myapp.com/bar/23 would render FooController#bar.
...
I recently became drunk on the Rails koolaid and am trying to create the following:
User model (this is fine)
id
Link model (associated with two Users)
id
user_id1
user_id2
Is this an instance in which I would want to use the has_and_belongs_to_many association type on the Link model? How should I do this?
Ultimately, I would like...
Hey guys,
I am trying to call a java soap webservice within my ruby on rails app. Therefor I use the following code:
email = "[email protected]"
pw = "legendary"
XSD::Charset.encoding = 'UTF8'
wsdlfile = "http://134.60.60.40:8080/FuturecanteenWebservice/DatabaseWSService?wsdl"
driver = SOAP::WSDLDriverFactory.new(wsdlfile).cr...
I have developed contingent country-state select dropdowns, and I'd like to factor out this behavior to an Address model so that I don't have to copy the dynamic behavior (more or less split between view and controller) each and every time I want the user to be able to enter a full address.
Basically I'm trying to dip my toes a little d...
Hello,
I realized that I'm writing a lot of code similar to this one:
<% unless @messages.blank? %>
<% @messages.each do |message| %>
<%# code or partial to display the message %>
<% end %>
<% else %>
You have no messages.
<% end %>
Is there any construct in Ruby and/or Rails that would let me skip that
first condition? So...
i am working on a project that requires Rails 1.2.6. I am setting up my first test environment, but i get a "rake aborted! Don't know how to build task 'db:test:load'"
when i try "rake db:test:load." is this command only for Rails 2.x? do i need to use a deprecated command?
...