Hi, I have the next models:
create_table :categories do |t|
t.integer :category_id
t.integer :language_id
t.timestamps
end
create_table :category_localizated_categories, :force => true do |t|
t.column :category_id, :integer
t.column :localizated_category_id, :integer
end
class Category < ActiveRecord::Base
has_many :catego...
I need to use link_to_remote, but instead of using something like link_to_remote "a small name" I need to set a partial as a name. How can I do that?
...
I have a legacy Rails project (2.4) that used to work in Netbeans. But I just tried running it and got the message
"could not connect to the web server http://localhost:3000"
How do I get a more detailed explanation from Netbeans?
I don't see any other error information.
...
Hi Guys
I've found this strange issue
When I invoke marked_for_destruction? on rails 2.3.5 it works properly and returns true or false but in rails version > 2.3.5 it returns nil
Any thoughts?
Thanks
Andrea
...
Hi,
I got the below code which I would like to convert to a string in a specific format. But I can't get it working.
Date.today + warning.notify_time_close.seconds
What I want to do is somethin like this but it doesn't work :)
(Date.today + warning.notify_time_close.seconds).strftime "%d-%m-%Y %H:%M:%S"
I know its simple but just ...
I expect found a bug in rails v2.3.8, but I'm asking here in case I'm just doing something stupid.
I have a 3-deep nested model that describes a shipment (i.e. shipment -> boxes -> line-items in boxes). The shipment and boxes are created at the same time, but the line-items already exist, from when the order was placed, so line-items j...
I need to format float like price for two decimal places and thousands spaces, like this:
"1 082 233.00"
...
I'm using the form tag, and I want the result to be nomething like this:
<form action="controller/action" id="myID">
I currently have this
<% form_tag :action => '', :id=>"relative_date_filter" do |f| %>
which generates this:
<form action="/controller/relative_date_filter" method="post">
EDIT:
I currently get this error:
compi...
Hi,
I'm using Rails 3.0 and I have the following in my routes.rb files:
scope "/:location" do
resources :agents
end
So I can do this:
agents = Agent.where("location = ?", params[:location])
(There might be a better way to do this..? Mostly I want URLs like: myurl.com/london/agents)
Anyway, my problem is with the tests (which I...
Unlike Webrick, can Mongrel be used in production? I'm looking for a small web server for Ruby on Rails that can be used locally in case of an emergency and all lines to the main webserver on the Internet are down. I thought I could start it with a batch file like ruby script/server and webrick does.
Thank you for any help.
...
I need to test with Cucumber/Webrat the presence of this button:
<%=submit_tag 'Get it'%>
But when I use this custom step:
And I should see a button with a value of "Get it"
that is:
Then /^I should see a button with a value of "([^\"]*)"$/ do |value|
response.should have_selector("form input[value=#{value}]")
end
I get:
...
I'm using Rails 2.3.8 and ruby 1.9 and have actionMailer set up as follows
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:enable_starttls_auto => true,
:address => "smtp.gmail.com",
:port => 587,
:domain => "domain.com",
:authentication => :plain,
:user_name => "[email protected]",
:password ...
Hi there,
I've noticed that in my new Rails 3.0 application all German i18n strings are converted to lowercase (except for the first letter).
When having a string like this:
de:
email: "E-Mail"
the output is always like "E-mail". Same story with all the other strings - uppercase letters within a sentence are auto-converted to lowe...
My Rails application has a number of forms. When Joe uses my app, I want each form to provide him with immediate visual feedback as to the validity of his input for each field. One field checks the format of his email address - pretty simple. But another allows him to associate the current resource with a number of other resources, and c...
I have two models below. They can be explained as follows:
A report has a report_detail (which determines start/end months). Many reports can have the same report detail, but no two report details can be the same.
class Report < ActiveRecord::Base
# attr: name :: String
# attr: report_detail_id :: Integer
belongs_to :report_de...
I am getting a beautiful error :
failed with NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[] - 3 failed attempts
My Controller:
CardSignup.all.each do |user|
Delayed::Job.enqueue MassEmail.new(user, params[:subject]...
Hi all. I'm trying to override the string used to describe the 'login' attribute of my User model to be "User name" instead. I thought that this was set in vendor/rails/activerecord/lib/active_record/locale/en.yml. I've tried changing it here and in my config/locales/en.yml file, and in neither case does it work (i restart the server ...
Stupid question?
<img alt="Phone_large" src="/system/photos/1/small/phone_large.jpg?1238845838" />
Why ist "?1238845838" added to the image path?
How can I get my path/url without it?
...
I want to ignore IPad as a mobile device in my application
I'm currently using this expression to detect mobile devices:
request.user_agent =~ /Mobile|webOS/
Standard stuff. The iPad agent string looks something like:
Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mob...
I have a users table and a gifts table. Users can pick gifts for their friends. I am thinking of creating a table to store user id and gift id to track which user picked which gift for whom. How to model this relation? I think users and gifts have a HABTM relation. Is that right?
...