# Transform the model name into a more humane format, using I18n. By default,
# it will underscore then humanize the class name
#
# BlogPost.model_name.human # => "Blog post"
#
# Specify +options+ with additional translating options.
I found the above while digging through Rails trying to discover what exactly are the options for tra...
my step definition
Transform /^user "([^"]*)"$/ do | email |
Person.find_by_email(email)
end
Given /^login as (user "([^"]*)")$/ do | user |
login_as email
end
my feature
login as user "[email protected]"
I am getting this error
And user "[email protected]" has security role "contact" # features/step_definitions/security_role_...
Hello,
I'm developing a website for my University and I got a problem.
There is a page where I have the list of all students of the university. The admin can select some students that will be able to go to a selective process and then he have to see them in other separate page.
How can I do that using Ruby On Rails?
Thanks,
Hugo Hen...
I need to develop a dynamic web page retrieve data from a stored procedure on a SQL Server.
Considering the licensing issue, development resources, security and maintainability, can someone suggest a suitable platform for this project?
I have a Ubuntu server running Drupal and also a Windows Server 2003 running SQL Server 2000 and IIS ...
How would I go about removing all empty elements (empty list items) from a nested Hash or YAML file?
Thanks for any advice.
...
I'm using the instructions in this github readme file (at the bottom) to make ajax calls for autocompleting a list of tags, sort of like what this website does, actually!
It works pretty well, but it seems like it might be a little inefficient, since the list of tags almost never changes. Does anyone have recommendations on how to ma...
Passwords are one-way encrypted and will remain so, but is there a way I can easily export these crypted passwords and use in a different app?
...
Say, we have an HTML, in which, all ...
<div class="replace-me">
</div>
... must be replaced with
<video src='my_video.mov'></video>
The code is following:
doc.css("div.replace-me").each do |div|
div.replace "<video src='my_video.mov'></video>"
end
It's simple, but, unfortunately, it does't work for me. Nokogiri crashes with f...
I have an action called new:
def new
@bookmark = Bookmark.new
respond_to do |format|
format.html # new.html.erb
format.mobile
format.xml { render :xml => @bookmark }
end
end
Now, when the param[:widget] == "true", I want to use a lay-out other than application.html.haml, and I want to show another v...
link text
I tried all of the answers from the above stack overflow post but none of them worked
When I replace the #!/usr/bin/env ruby with the #!/path/to/my/script/runner and try to run
Rails returns:
/var/www/cmgmail/production/releases/20100810151610/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/conne...
Can someone tell me how to configure rails to get an smtp log.
thanks,
ash
...
I have a rails view with this html:
<body onload='<%= visual_effect(:appear, :main_counter, :duration=>3.0) %>'>
<div class="counter" id="main_counter">some content</div>
</body>
and a stylesheet:
.counter{
opacity:0;
}
The effect works as expected but when its done the div's text disappears, I am guessing the opacity is goi...
I'd like to count (increment) each time a user visits my site. I'm using authlogic and none of the "magic" fields take care of this.
By visit I mean:
It counts only once when a user visits the site. So it should count when they login, but ALSO count for users who have the "remember me" set to true.
login_count table field only counts w...
Is there any better way to write this condition?
if (self.expense.nil? && self.income.nil?) || (!self.expense.nil? && !self.income.nil?)
puts "test"
end
...
I have a rails 3 template handler and would like to configure it not to use the layout. In rails2 we would do a
::ActionController::Base.exempt_from_layout :extension_name
But this method does not exist in Rails 3 any more. I did not find a place within the code where there is an option for a template engine not to run through...
Why doesn't this work?
I have an array of Objects, one of the attributes is the db id. I can make the array like so.
qc_parts.map!{|a| a.id}
However when I want to just make it a string. With
qc_parts.map!{|a| a.id}.join(",")
I only get an array out. I've also tried .to_s & .to_a
Any idea why this would be happening?
...
I'm trying to validate an attribute in one model when I destroy another model. It's a complicated validation so I wrote a custom validation method. The problem is how do I call that validation method when I destroy the other model?
I'd like to be able to do something like this:
validates_associated :part, :on => :destroy
Though appare...
If post.published?
.post
/ Post stuff
Otherwise
.post.gray
/ Post stuff
I've implemented this with rails helper and it seems ugly.
= content_tag :div, :class => "post" + (" gray" unless post.published?).to_s do
/ Post stuff
Second variant:
= content_tag :div, :class => "post" + (post.published? ? "" : " gray") do
/ Post...
Hey. I'm trying to execute an extremely simple RJS feature and having a lot of trouble—it's defaulting to html refresh. This is my code, any help would be greatly appreciated:
<div id="main">
<% remote_form_for(@question) do |f| %>
<%= f.error_messages %> <%= f.text_field :target %>.
<%= f.text_area :message %>
<%= f.text_...
Not sure what this means and why... I got the undefined method error when I try to go to http://localhost:3000/forums, and after I generate my first forum.
ActionView::TemplateError (undefined method `topics_path' for #<ActionView::Base:0x10319f2e0>) on line #25 of app/views/forums/index.html.erb:
The area of code the error refers to...