hi, all,
I used declarative_authorization for my app and had problem with creating new user.
my User model code:
class User < ActiveRecord::Base
ROLE_TYPES = ["admin", "user", "guest"]
validates_inclusion_of :roles, :in => ROLE_TYPES
def role_symbols
@role_symbols ||= (roles || []).map{|r| r.to_sym}
end...
We've got an Excel spreadsheet floating around right now (globally) at my company to capture various pieces of information about each countries technology usage. The problem is that it goes out, gets changes, but they're never obvious, and often conflicting - and then we have to smash them together. To me, the workbook is no more than a ...
Hello all,
I am using the ruby gem AWS::S3 to generate expiring urls for my assets on S3, some of them are quicktime movies of size. I would prefer them not repeatedly downloaded each time requested to the client's browser. Since they are protected and whose access is done in authenticated urls, I set the expiration usually in 3 months,...
I've been using mysql forever. never really needed anything fancier. But I'm using heroku a lot and while I'm working, I like free search, so I'm using the acts_as_tsearch plugin. If you go to the git repository, it tells you:
---begin paste---
* Preparing your PostgreSQL database
Add a text search configuration 'default':
CREATE ...
Hi,
I'm currently using activerecord STI and trying to cast an object type from A to B (same parent). Is there a standard way of achieving that?
...
Hi
I have a login that after saving the new user is supposed to send an email. This works fine locally but on the production server I keep getting this error in my log files:
ArgumentError (wrong number of arguments (8 for 6)):
app/models/user_observer.rb:3:in after_save'
/usr/lib64/ruby/1.8/observer.rb:185:innotify_observers'
/u...
I need to test, with Selenium or a similar automated testing tool, how my webapp behaves on iPhone's Mobile Safari and on Android browser. How can I do that?
I usually test my app by hand setting Safari 5 with User Agent = "Mobile Safari", I used iPhoney as well but it's too buggy IMO.
...
I'm in the process of refactoring some logic built into a Rails application into middleware, and one annoyance I've run into is a seeming lack of convention for where to put them.
Currently I've settled on app/middleware but I could just as easily move it to vendor/middleware or maybe vendor/plugins/middleware...
The biggest problem is...
I'm using the jQuery plugin jQuery-Tokenizing-Autocomplete in a rails application with a has_many association.
I need to save the values to the database, but to do that I need it to be a string, not an array. So the result should equal "1","2","3". Hope this clarifies.
The javascript used to generate this array:
$.TokenList.ParseValue...
I am quite new to rails...
I am having an issue with displaying of flash messages...
Am displaying it in views as well as application.html.erb (layout file)
in the view i just have
flash[:notice]
and in the application.html.erb I have
flash.each do |name, msg|
content_tag :div, msg, :id => "flash_#{name}"
end
I want to display...
Hey,
Considering models in Rails:
class Organization < ActiveRecord::Base
belongs_to :OrgType
end
Does it bother you that models in Rails don't include the fields that made the entity?
I know this is done for DRY's sake but you have to check the data base tables schema every time you want to check model's fields.
...
Hello everyone, I am developing my Rails 3 application that uses Twitter OAuth and I am getting troubles because apparently I can't get the access_token, after clicking 'Allow' and Twitter redirecting me back to my application url, when I go to twitter.com/settings/connections I can't see my app there as authorized. I guess there is som...
What's the rails way to subtract a query result from another? A database specific SQL example would be:
SELECT Date FROM Store_Information
MINUS
SELECT Date FROM Internet_Sales
...
I've moved my Rails app to a new server and now I'm having problems with Jammit. I deploy with Capistrano and have tried a few different routines to get Jammit to run when I deploy (which works), but everytime the Passenger app restarts it seems to want to re-reun Jammit, which I don't need it to do, it only needs to run when I deploy......
I am attempting to integrate an s3 backup for my images directory into a gem. I am having some difficulty getting the thing moved over into my bucket.
def backup_directory
backup_file = Tempfile.new("dump")
cmd = "#{RAILS_ROOT}/public/system/"
cmd += " | gzip > #{backup_file.path}"
run(cmd)
backup_file
end
...
I have to know whether user is online or not, not current authenticated user, but any other. Does restful_authentication has some methods to determine it?
...
It's weird I can build a model from scratch and get my model to work using two search fields body and title but then when I rebuild with a more custom model it doesnot work.
When I do a .script/console i have this for the working model
Post.search 'foobar'
=> [#]
but whenI use my custom model with .script/server I ge...
I know HTML&Css, Little Javascript & Little PHP.
I really want to get in the world of programming languages and I think Ruby looks way better then PHP. But I might be wrong.
Should I stick learning PHP?
Or should I go along with Ruby On Rails?
...
I would like to debug and possibly contribute to some open source gems but am fairly new to Ruby and Rails. What is the best way to go in and start setting breakpoints, etc?
Right now I just use ruby-debug for my own code and inspect variables mostly.
...
Is there any way I could get info such as how long did it take to connect to a remote server, time taken to receive the first byte of response, and the time taken to download the whole file?
I'm trying to create something like what Pingdom does.
...