I am using the jQuery UI Dialog to show a ajax form inside a dialog box.
I have two problems with the code:
after form submit, i want that the dialog is closed automatically.
If the user uses the submit from the form (e.g. pressing enter), or uses the submit button from the dialog, the effect should be the same.
For now the submit ...
I'm using Paperclip and here's what I do in the model to delete attachments:
def before_save
self.avatar = nil if @delete_avatar == 1.to_s
end
Works fine unless @delete_avatar flag is set when the user is actually uploading the image (so the model receives both params[:user][:avatar] and params[:user][:delete_avatar]. This re...
Can you suggest some working example of it? I tried Authlogic and Devise withous success.
...
Hi all,
I'm just coming back to rails coding after a long hiatus. I was using rinari previously but noticed that there's a new version of emacs-rails. Is anyone using either? Any preferences for one over the other? What are people using for their rails projects within emacs these days?
...
Hi everyone,
I'm setting up jQuery and Uploadify in my Rails app (with the uploadify-rails plugin). Its all going fine, the flash is loaded, the authenticity paramater is passed through along with the session key and so on. However, my MySQL queries on the way to handling the upload from the flash are all reporting a 'redundant UTF-8 se...
I want to take input from a textfield and turn it into an array of strings. After having submitted the post request, I want to display again the textfield, but including the values of the textfield in an array.
I have a view that would look like:
<% form_tag "/list2array" do -%>
<%= text_area_tag "mylist" %>
<div><%= submit_tag 'save...
I have a need to design a system to track users memberships to groups with varying roles (currently three).
class Group < ActiveRecord::Base
has_many :memberships
has_many :users, :through => :memberships
end
class Role < ActiveRecord::Base
has_many :memberships
has_many :users, :through => :memberships
end
class Membership < Act...
I have a gallery in my rails app that needs to only allow certain images to be shown to specific, logged in users. I am using Paperclip for image processing now, but it saves all images in a public folder available to anyone.
Note that I don't have to use Paperclip if there is a better way, and I already have the login system in plac...
I have a jruby/rails app using:
jruby 1.4.0
Rails 2.3.5
ActiveMQ 5.3.0
Mule ESB 2.2.1
Currently in our environment.rb file we start up Mule in the initializer. This becomes a big pain when we go to do normal rake tasks that don't require JMS/Mule such as db:migrate as it takes a long time to startup/shutdown Mule everytime.
The code...
Hello fellow stackoverflow users.
I am building my first Ruby on Rails app which is going to be my own little community.
I have made the User model with several fields and information.
But now i am thinking of adding avatar support for the users. And i've been researching and found that my best option would be using Paperclip. But then ...
Hopefully I can explain this well enough, but please let me know if more information is needed!
I'm building a form where a user can create an "incident". This incident has the following relationships:
belongs_to: customer (customer has_many incidents)
belongs_to: user (user has_many incidents)
has_one: incident_status (incident_stat...
Hi Everyone,
I have three models that I want to interact with each other.
Kase, Person and and Company.
I have (I think) setup the relationships correctly:
class Kase < ActiveRecord::Base
#HAS ONE COMPANY
has_one :company
#HAS MANY PERSONS
has_many :persons
class Person < ActiveRecord::Base
belongs_to :company
class Company < Act...
Hi all,
I have successfully wired up a Facebook Connect application and everything is working fine. I can sign new users up with Facebook, or I can link existing users with Facebook. No problems there.
However, now I am trying to add an Invite page, where a user can see which of their Friends have the application, and then show them ...
Hi! I am looking for method for parsing route path like this:
ActionController::Routing.new("post_path").parse
#=> {:controller => "posts", :action => "index"}
It should be opposite to url_for
Upd
I've found out:
http://stackoverflow.com/questions/2222522/what-is-the-opposite-of-url-for-in-rails-a-function-that-takes-a-path-and-gener...
I see both in examples when checking what env one is running in. What's preferred? Are they, for all intents and purposes equal?
...
Hi,
I just installed Sphinx (distro: archlinux) downloading the source. Then I installed "Thinking Sphinx" plugin for Rails.
I followed the official page setup and this Screencast from Ryan Bates, but when I try to index the models it gives me this error:
$ rake thinking_sphinx:index
(in /home/benoror/Dropbox/Proyectos/cotizahoy)
Sph...
Hello stackoverflow.
I am trying to use Paperclip with my Rails app to add an avatar to a user but it won't save my image or update the database column when creating the user.
This is what the model looks like:
class User < ActiveRecord::Base
has_attached_file :avatar
And the registerform in haml:
- form_for :user, @user, :url =>...
The escape_javascript method in ActionView escapes the apostrophe ' as backslash apostrophe \', which gives errors when parsing as JSON.
For example, the message "I'm here" is valid JSON when printed as:
{"message": "I'm here"}
But, <%= escape_javascript("I'm here") %> outputs "I\'m here", resulting in invalid JSON:
{"message": "I\'...
Is there a way to watermark an existing pdf in ruby ?
I want to add a dynamically generated text,
Thanks,
...
Hello, guys!
I have some User model, Role model and Assignment model to manage role-based user system.
Just like here .
So, here some kind of code, to include roles into users form:
<% for role in Role.all %>
<%= check_box_tag "user[role_ids][]", role.id, @user.roles.include?(role) %>
<%=h role.name %><br />
<% end %>
And all's work...