ruby 1.8.7
gem 1.3.7
rails 3.0.0, 3.0.0.rc
when i write rails -v
error message come
Could not find gem 'mysql2 <>=0, runtime>' in any of the gem sources.
Try running 'bundle install'.
when I run bundle install then also it cann't install mysql2
please help me.
...
The problem seems trivial, but I can't find any resonable solution. I have list of countries with translations stored in Globalize3 translation tables. How can I fetch the list of countries sorted by name?
Country name isn't stored directly in the model, but in separate table. Is there any resonable way to sort the result other than ma...
validates_presence_of :match,
:message => "for your name and password could not be found. Did you #{link_to "forget your password", help_person_path}?"
That's what I want to do. I can interpolate variables that are set in the model, but using simple Rails code like "link_to" doesn't seem to work. Which is a bummer.
...
I have a big, flat table:
id
product_id
attribute1
attribute2
attribute3
attribute4
Here is how I want users to get to products:
See a list of unique values for attribute1.
Clicking one of those gets you a list of unique values for attribute2.
Clicking one of those gets you a list of unique values for attribute3.
Clicking one of those...
I had a working code for Rails 2 to handle file uploads that no longer works with Rails 3.
The code is:
# Handling file uploads
def file=(file_data)
unless file_data.blank?
@file_data = file_data
self.filename = file_data.original_filename
self.size_before = file_data.size
end
end
Now Rails 3 doesn't like that, complai...
Hello guys!
I have the same problem, as in this question. Did anybody find any solutions for this?
So I can't do like this:
flash[:notice] = "Successfully created #{@template.link_to('product', @product)}.
or like this:
@template.title("Page title is here.")
It worked perfectly in Rails 2.3. The main idea is to find out, how to u...
I'm trying to upgrade my rails application to Rails3.
When I run functional tests, I get a lot of NameError: uninitialized constant Test::Unit::AssertionFailedError errors. But unit tests and website itself seems to work fine.
Trace looks like this:
NameError: uninitialized constant Test::Unit::AssertionFailedError
/Users/mantas/.rvm/...
In a plugin helper, I have:
include Rails.application.routes.url_helpers
url_for(:only_path => true, :controller => 'people', :action => 'new')
Note that uses the new include syntax, that part works ok. But I get an error:
undefined local variable or method `controller' for #<ActionView::Helpers::InstanceTag:0x311ddf4>
Is there a ...
Rails 3 newbie here.... I'm looking to build an application that limits a user's viewable data to their company, which is based on their email's domain. Very much like Yammer or basecamp. I'm currently using devise for auth...
I'd like a User's table and then a UserInstance Table... The UserInstance table would look like:
ID | domain ...
My users_controller.rb
# GET /users/1/edit
def edit
@user = current_user
#@user = User.find(params[:id])
end
my sweet looking users_controller_spec.rb ( notice all my commented out attempts )
describe "Authenticated examples" do
before(:each) do
activate_authlogic
UserSession.create Factory.build(:valid_user)
end
des...
Hey guys, I'm playing around with the new Rails 3 API and I have a question regarding the new method run_callbacks(kind, *args, &block)
In the following code:
class User < ActiveRecord::Base
before_save :say_hi
after_save :say_bye
private
def say_hi; puts "hi"; end
def say_bye; puts "bye"; end
end
I can explicit cal...
Hello, Rails 3 newbie here... I'm working to create a devise auth system that like (yammer) has instances where users belong. I have two tables
Users (email, password...)
belongs_to :instance
Instance (domain name, active....)
has_many :users
I added the belongs_to and has_many to the models but the schema hasn't been updated to a...
In Rails 3,
I created a table with a migration, then added a column with a migration which creates a has_many, belongs_to relationship....
I then ran rake db:migrate
I'd like to now add an Index because I forgot to add it before I can migrate. can I add that to one of the existing migration files (the create table one) or do I need to...
Hello,
I have two tables
Users (name, email, password, instance_id, etc...)
example: james bond, [email protected], 1
Instance (id, domain)
example: 1, abc.com
Through out the application I want to make sure James Bond only sees data that is assigned to his instance = 1
So if I have a books table with (name, desc, instance_id), he only ...
Grettings!
In an app that was working flawlessly in Rails 2.3.8 i have the following class method:
def self.encode(*attr_names)
encoder = Encoder.new(attr_names)
before_save encoder
after_save encoder
after_find encoder
define_method(:after_find) { } # defining here, since there's only alias in the Encoder class i...
Hello, I am using Rails 3 and found that if I add
:remote => :true, there will be added to the tag the data-remote = true attribute. But I can't find a way to add custom data- attributes to the urlhelper. The followings won't work:
<%= link_to projects_path, :history => "new"%>
<%= link_to projects_path, :data-history => "new"%> ...
Seems like periodically_call_remote is deprecated in Rails 3, any ideas how to achieve the same functionality?
...
Could you tell me how to add internationalization for select tags in formtastic?
# view
....
f.input :hair_colour, :as => :select, :collection => HAIR_COLOURS
....
# user.rb
class User << AR
validates_inclusion_of :hair_colour, :in => [0..8]
end
# de.yml
de:
profile:
hair_colour:
0: "Blond"
1: "Dunkelblond"
...
How can i use numbers in my yml files to show translations?
f.e.:
# de.yml
profile:
hair_colour:
0: "Blond"
1: "Dunkelblond"
2: "Braun"
3: "Brünett"
4: "Rot"
5: "Schwarz"
6: "Grau/meliert"
7: "Glatze"
8: "Andere"
Its not working... Why? How can i fix this?
...
I have two tables:
books (id, name, desc, instance_id)
instances (id, domain)
A user should ONLY be able to see data that is assigned to their instance_id in records...
For the books, model, to accomplish this, I'm thinking about using a default scope.. Something like:
class Books < ActiveRecord::Base
attr_accessible :name, :des...