Model ..
def self.upload_client_document(params)
client_document = self.new :uploaded_data => params[:Filedata],:client_id => params[:client_id],:document_name => self.default_document_name,:document_description => self.default_description_name
client_document.rename_document_name
client_document.save!
# RAILS_ROOT + client_docu...
I have a Rails 3 application that has Categories. A category can be administered by somebody with the Category Owner role. But the Category Owner should only be able to access Categories that he owns, not others. I can lock down the admin functions using CanCan, but I need to restrict the specific categories themselves.
...
I upgraded my ruby to 1.9.2 and now when I try to start up a Rails 2.3.5 app with script/server I get this error:
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- script/../config/boot (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from script/server:2:in `<main>'
...
Hi all-
I am currently using the Acts_as_recommendable plugin available here. It is using the pearson correlation coefficient to find recommendations, which is pretty much exactly what I want. The problem however is scale. With more than 2000 or so items, the plugin slows considerably (with 5000 items, I see load times of about a min...
Right now i am storing files in public folder.
After that i want to upload those file from public folder to another application which providing services for document management.
To upload document to another application.
They provided link, username and password .
Like
http://demo.testltd.com/V12345/search.aspx?username=test1&pa...
my routes.rb looks like this
map.resources :bookmarks
map.connect ':controller/:id/:action'
map.connect ':controller/:action'
so i can use urls like this
http://localhost:3000/bookmarks/Ruby/show
but when i try to link from this site to the index site of the project (bookmarks
controller and index action) like this
link_to "Star...
I have a Rails 3 project with Product.
:product has_many :product_properties
:product has_many :properties, :through => :product_properties
:product_property belongs_to :product
:product_property belongs_to :property
:property has_many :product_properties
:property belongs_to :property_type
There is a attribute "sequence" on :proper...
About 6 months ago I switched from TextMate to MacVim for all of my development work, which primarily consists of coding in Ruby, Ruby on Rails and JavaScript.
With TextMate, whenever I needed to run a spec or a test, I could just command+R on the test or spec file and another window would open and the results would be displayed with t...
I am responding to a POST from a server that I don't control, and all the params[] come in as Tempfiles - which I can work around. (I am running on thin here at my desktop mac).
The whole method works, but at the last line I have:
render :nothing => true
As there is nothing to render. It is in this render :nothing => true call that rai...
I'm using the rails3-jquery-autocomplete gem found here: http://github.com/crowdint/rails3-jquery-autocomplete
The instructions are clear for how to query a single attribute of a model and I am able to make that work without a problem.
My Person model has two attributes that I would like to combine and query, however. They are first_n...
Hello,
I am troubleshooting why my ApplicationController's methods don't seem to work in my namespaced admin area and it seems like when I'm in a namespace I cannot access my ApplicationController's private methods, is this right?
If it is like that, what's the best practise to reuse something like Authlogic's example ApplicationContro...
Has anyone comes across a SQL templating engine which allows one to mix SQL with a dynamic language like Ruby or Python?
I'm looking for something similar to Ruby erb templates. For example, in Ruby on Rails you can have various templates for a view:
customers.html.erb (html + ruby)
customers.js.erb (javascript + ruby)
Though I want s...
I have a widget for currencies which I use throughout my application. Ie. the user changes the currency from EUR -> USD, or about 13 other currencies. I have a few other use-cases such as dates but this one is the easiest to explain. Currency basically just updates a session variable by calling the currency controller and then uses so...
I have this
@project.posts.count
=> 11
@project.articles.count
=> 5
>> a = @project.articles.map(&:signup_id)
=> [6, 8, 10, 12, 14]
I want to only display the project posts that dont have an id of the following [6, 8, 10, 12, 14]. So i want display the posts that dont have an article.signup_id
@project.posts #so reject if id is ...
Hi!
I'm writing helper to render html table header
def display_standard_table(columns)
content_tag :table do
content_tag :thead do
content_tag :tr do
concat columns.collect { |column| content_tag(:th, 'Header'.html_safe) }
end
end
end
end
The html output is escaped:
<table><thead><tr><th>Header&...
I am using Rails 3.
The main model is Product
:product has_many :images
:product has_many :related_products (self-referential)
:product has_many :descriptions
:product has_many :specifications
:product has_many :upc_codes
:product has_many :prices
You get the idea. I'm trying to determine if I can shoehorn this into a properties mod...
>> a
=> [6, 8, 10, 12, 14]
>> @project.posts(:all, :conditions => [ "id not in (?)", a ])
=> [#<Post id: 6,........
Why is this not filtering the POst with id of 6
...
can I rename the columns with attachment_fu ?
I am using oracle as my database and size is keyword in oracle. so i don't want to create a column with size name. So is it ok to create a column with filesize instead of size while using attachment_fu ??
...
Hello,
Im using ruby on rails with a mysql db in the back. I realized, that the characters are limited up to about 277 per column entry...
How can I increase this?
Thanks,
Markus
...
I really like the Rails authorization gem CanCan. However, I find myself having multiple conditions on certain privileges, and I'd like to be able to give different error messages to the user, depending on why he or she has been denied access.
Does CanCan have a mechanism for such behavior? I'm having trouble finding it. Would I have to...