I would like to specify a default sort order in my model.
So that when I preform a find(:all, ...) without an :order parameter it defaults to the order specified in the model, but specifying an :order will override the default.
...
I'm currently using acts_as_taggable_on_steroids on Rails 2.3.8. After configuring the plugin, when i try to destroy a post with a tag, it gives me this error:
undefined method `destroy_unused' for Tag(id: integer, name: string):Class
Do i have to redefin a destroy method in my Posts controller?
I'm stumped, any help would be apprecia...
This is a C# code:
byte[] pb = System.Text.Encoding.UTF8.GetBytes(policy.ToString());
// Encode those UTF-8 bytes using Base64
string policyB = Convert.ToBase64String(pb);
// Sign the policy with your Secret Key using HMAC SHA-1.
System.Security.Cryptography.HMACSHA1 hmac = new System.Security.Cryptography.HMACSHA1();
hmac.Key = Syste...
When I open up a page that's using my CSS it will work once, but won't work again until you open up the CSS and re-save it. Every other time I try to directly access my CSS, it works fine. But the other times, it doesn't work and I receive this server output:
[2010-08-01 12:49:37] ERROR NoMethodError: private method `gsub!' called for #...
i have ruby 1.8.6 installed on my machine when i tried gem -v i got gem version 0.9.2
now i do install rails i tried gem install rails
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
getaddrinfo: no address associated with hostname.(SocketError)
why is it so and after installtion where rails is stored. and one th...
Background - I have a model, say Door, that has a state of open or closed. I encapsulate the behaviour of opening the door in a method #open on each instance (And I also have a #close equivalent).
But what's the best way to expose this in a RESTful way? What should my route be?
It is an UPDATE to Door instance, but what should I UPDATE...
The content in the view is not being displayed. Only the attachment is being sent. Help would be appreciated!
def send
@subject = "Status of PIS App"
@recipients = "[email protected]"
@from = APP_CONFIG[:email]
@sent_on = Time.now
#@content_type = "text/html"
content_type = "multipart/alternative"
attachment :filename => "Report.ht...
Some plugin works well in mysql gem but doesn't works so well in ruby-mysql
in rubygems, mysql gem has 453,540 total downloads, and ruby-mysql only has 12,137
total downloads.
I wanna know what's the difference between them.
Thanks.
...
I am surprised I couldn't find it on google, what's the best way to add a "tweet" this link to post a url and a description to the user's twitter account?
...
I'm using RoR and I want to do concurrency safe update queries. For example when I have
var user = User.find(user_id)
user.visits += 1
I get the following SQL code:
SELECT * FROM Users WHERE ID=1 -- find user's visits (1)
UPDATE Users SET Visits=2 WHERE ID=1 -- 1+1=2
But if there are several queries taking place at the same time, ...
I have a model:
class Scr < ActiveRecord::Base
def self.find_scrs
find(:all, :order => "id")
end
end
View (form):
<div class="scr-form">
<fieldset>
<% form_for :scr, :url => { :action => :save_scr } do |form| %>
<p>
<label for="scr_id">Id:</label>
<%= form.text_field :id, :size => 40 %>
</p>
<p>
...
hi
iam doing live search function,
for this iam using observer_field, but on pageload i get error
jquery('#name').delayedObserver is not a function
I dont know what is the problem..
...
which is the best gem for creating a login system?
...
I'm building a Rails 3 application on CouchDB (using SimplyStored gem) and I'd like to use some existing gem/plugin for authentication, instead of building it from scratch.
Problem is, I can't find anything that works smoothly for CouchDB, everything assumes that you're running on ActiveRecord. Do you have any tips?
...
hey
I have a problem,
I have a Country model. where the entry in the DB is: {:name => 'United Kingdom'}
The data I have is UK instead of United Kingdom. in the other models where i search for it i have done:
country_name = "United Kingdom" if country.name == "UK"
but i have to do this all over the application and that is just bad.
S...
Hi,
I am trying to do a find which orders results by their house name and then by the customer's last name.
Customer.find(:all,
:conditions =>['customers.id IN (?)', intersection],
:joins => 'JOIN histories ON histories.customer_id = customers.id
JOIN houses ON histories.house_id = houses.id',
:order => "houses.name ...
I have rails Rails 2.3.8 and Devise 1.0.8. I have followed the installation instructions, but when trying to access /users/sign_in for the first time after modified routes.rb, I get
Internal Server Error
undefined method `[]' for :users:Symbol
When I reload, I get
Routing Error
No route matches "/users/sign_up" with {:method=>:get}
...
Hi Everyone,
I am using Prawn PDF to create PDF files on the fly in my Rails application.
I recently came across the rails cell.blank? function, which has proved to be really handy, I can hide any <li> rows I want if there is nothing to display - something I have been wondering about for a while!
Is it possible to do the same in Praw...
Hi All ,
Is there any ruby or Java Web based Virtual Class Room Components like
1.Whiteboard
2.Instant Messaging
3.Hand Raising Tool
4.Marker
Thanks
...
Is there a widget or a gem which implements this feature?
It works only in Chrome and Firefox but it is very cool and no plugins are needed
http://gmailblog.blogspot.com/2010/04/drag-and-drop-attachments-onto-messages.html
Or which would be the best practises to implement it?
...