Hello,
I would like to validate my users, so they can only use a-z and - in their username.
validates_format_of :username, :with => /[a-z]/
However this rule also allows spaces ._@
Username should use only letters, numbers, spaces, and .-_@ please.
Any ideas?
Best regards.
Asbjørn Morell
...
I am a big fan of Doxygen which I have used for years with various languages. In particular, I appreciate its wiki-like ability to include images and run the Graphviz dot generator to have arbitrary inline diagrams from inline DOT code or external files.
RDoc has diagramming support to generate class diagrams using Graphviz but I can't ...
I am trying to install a ruby gem. I am getting this error.
C:\>gem install racc
Building native extensions. This could take a while...
ERROR: Error installing racc:
ERROR: Failed to build gem native extension.
c:/ruby/bin/ruby.exe extconf.rb install racc
extconf.rb:3:in ``': No such file or directory - uname -p (Errno::ENOEN...
I have 2 rails apps on the same domain. i want the single sign on feature to be added to them. i would prefer to maintain separate database for each app..
Can anyone please tell me how to do this?
Thanks in advance,
Ak
...
I need to fetch HTML page with all objects on it (stylesheets, javascripts, images)
and store data in the database.
It is possible to implement this by simple fetching files listed in src attributes,
but maybe someone can suggest any helper gem for this.
Also, is there way to package all this files to one (like web archieve),
which can ...
There should be a way to map a DataMapper model against an arbitrary select (please see an example: http://www.sqlalchemy.org/docs/05/mappers.html#mapping-a-class-against-arbitrary-selects)
So far I have found a solution (or a starting point to reach it) that looks like the following:
find_by_sql(an_sql_select, :properties=>some_propert...
Hello,
I specified the default_url_options in my environments/test.rb with
config.action_mailer.default_url_options = { :host => "www.xyu.at" }
This is quite ok and in my cucumber story, where i test registration of users,
the user-activation link gets generated right
invitation_activation_url(1)
=> "www.xyu.at/signup/1231hj23jh23"
...
A user submits a url, this is put into into article.url through the scaffold create method. I can parse the url like so:
def parse_url
elements = @article.url.split("/")
if(elements[0] == "http:")
@home = elements[2] #elements[1] will be an empty string because of the // in the URL
else
@home = elements[0]
end
end
Wh...
I have tables boards, users, joins, and roles. The joins table defines the association a user has to a board, as well as the role that user has on that board. I'm trying to either get all of a user's boards at once with a way to differentiate what role a user has on each board, or make three separate calls to get boards that a user is a ...
I am looking for a good RoR table generator (or an easy solution) that can give me a decent view of my records in a table (unstylized but proper strict XHTML).
Let's say I have a User model and an Address model:
- A User can have many Addresses
- One address is also linked as the "primary_address"
Let's say I have the following in my...
I have the following code in my layout file:
<% @families = ProductFamily.find(:all, :include => :products) %>
<% @families.each do |f| %>
<h2><%=h f.name %></h2>
<ul>
<% f.products.each do |product| %>
<li><%=h product.name %></li>
<% end %>
</ul>
<% end %>
Two things: I doubt this follows standard MVC pr...
I wish to add a singleton method to a particular object. I wish that when a instance method on a object is first called, it does some work, and then creates a singleton method for said object of the same name (that contains the work). On all subsequent calls on said object, the singleton method would shadow the instance method and would ...
I'm having trouble deciding between the two. They both seem like great plugins but I'd like to know which is easier to control.
What are your guy's experiences with these plugins? Which would you recommend?
...
I'm trying to prototype a system in Rails. Essentially, its an abstract relational data model that takes in user input to create nodes of information. Each node can have meta-information associated with it, so some nodes may have CreateDate and DueDate while others may have StartDate, DueDate and PersonResponsible. In this way we're simp...
What is this language construct called?
In Python I can say:
def a(b,c): return b+c
a(*[4,5])
and get 9. Likewise in Ruby:
def a(b,c) b+c end
a(*[4,5])
What is this called, when one passes a single array to a function which otherwise requires multiple arguments?
What is the name of the * operator?
What other languages support th...
We want to implement a progress bar for file uploading in one of our Ruby application. This needs to show the exact percentage of the upload. However, despite our best efforts we could not find a way to implement a progress bar that exactly replicate the file upload process.
Can you please help us with this?
...
I've just frozen my Rails (2.3.2) application together with RedCloth (4.2.2) and deployed it to my shared hosting environment.
When running the application I get an error saying another version of RedCloth is already activated (4.2.2) when trying to load an older version.
I reckon this problem is because the hosting environment has an ...
Phone number data in various formats (I've chosen these because the data coming in is unreliable and not in expected formats):
+1 480-874-4666
404-581-4000
(805) 682-4726
978-851-7321, Ext 2606
413- 658-1100
(513) 287-7000,Toll Free (800) 733-2077
1 (813) 274-8130
212-363-3200,Media Relations: 212-668-2251.
323/221-2164
My Ruby code t...
Hi folks.
I was attempting to run the Ruby Thin demo application on Windows/XP when I got an error that Windows couldn't find "msvcr90.dll" for Ruby 1.8.7 -- I found a redistributable and put that in my path to be confronted with the information that:
"R6034 ... application has made an attempt to lead the C runtime incorrectly"
Earli...
Hello all.
Can't figure this one out.
In rails model, I want to call a method within the same model to manipulate data returned by a find method. This 'filter' method will be called from many custom find method within this model, so I want it to be separate. (and I cannot filter from the SQL it is too complicated)
Here is an example:
...