My web app, up until this point, has been fairly straight forward. I have Users, Contacts, Appointments and a few other things to manage. All of these are easy - it's just one model per section so I just did a scaffold for each, then modified the scaffolded code to fit my need. Pretty easy...
Unfortunately I am having a problem on th...
Could someone describe what this is all about?
It's in the routing file:
match "photo", :constraints => {:subdomain => "admin"}
I can't understand it.
thanks
...
Two models (Rails 2.3.8):
User; username & disabled properties; User has_one :profile
Profile; full_name & hidden properties
I am trying to create a named_scope that eliminate the disabled=1 and hidden=1 User-Profiles. Moreover, while the User model is usually used in conjunction with the Profile model, I would like the flexibility to...
I am trying to test my update action in Rails with this:
context "on PUT to :update" do
setup do
@countdown = Factory(:countdown)
@new_countdown = Factory.stub(:countdown)
put :update, :id => @countdown.id, :name => @new_countdown.name, :end => @new_countdown.end
end
should_respond_with :redirect
should_redirect_to(...
hi,
My needs are very simple: I have a Tip table to receive comments and have comments to receive comments, too.
To retrieve each comment that is stored in the same table (comments), I created another key for the comments on comments: "inverse_comments".
I tried to use one comments table by using self-referntial association. Some r...
Hi
I'm wondering how to implement highlighting of changes to user edited articles on a wiki style rails project. Since articles may be fairly lengthy I'd ideally like strikethrough and highlighting, similar to github and wikipedia for example. Despite searching around the net I've not really come up with much, apart from instiki which i...
I write code in English but I'm currently doing a site which is fully translated to another language (validation error messages included). However, I have a problem because validation error messages always seem to include the name of the attribute the error is on at the start of the error, e.g.:
Title Prosimo izpolnite naziv fakultet...
Hi Everyone,
I am using a Gem to communicate with FreeagentCentral via their API. I have the following code to display a link to the relevant freeagent project:
<%= link_to "#{image_tag('/images/icons/Spinning Beach Ball.png')} Freeagent Project", "#{Freeagent::Base.site.to_s + Freeagent::Project.element_path(@kase.freeagent_id).gsub(...
Hi,
I have a single select_tag with categories gathered from array in controller. When the user selects a category I want the application to redirect to the selected category. I have the following code in my view which. (I've tried both using :method => :get and :post, only change is in development.log)
<%=select_tag "cat_selected", opt...
Tried doing http://davidwparker.com/2008/09/17/site-wide-announcements-in-rails-using-jquery-jgrowl/
Am really bad with JS. Think I am messing up on the last part where it says "This code goes in your application.js file (somewhere in $(function){ //here })"
Am I not suppose to do a link_to_function and create a function with this cod...
i cant understand what the difference is between a namespace and a scope in the routing of ruby-on-rails 3.
could someone please explain?
namespace "admin" do
resources :posts, :comments
end
scope :module => "admin" do
resources :posts, :comments
end
thanks
...
Is there a way to append something to the query string with no value set?
I would like to see this kind of URL being generated: http://local/things?magic.
What I'm looking for is when the user goes to http://local/other?magic then every URL in the generated page would contain magic in the end.
Following code is almost a solution but i...
In my Rails app, I am used to using syntax like the following in a number of places, including helpers/application_helper.rb:
def my_method(x,y)
return x+y
end
I am also used to calling the resulting method from basically anywhere in my app using syntax like this:
my_method(2,3)
However, I'd like to be able to use syntax like lik...
I'm trying to figure out the best way to insert content into a light box using rails UJS. I have a link that looks like this:
<%= link_to "login", login_path, :remote => true %>
Which produces html as such:
<a data-remote="true" href="/login">login</a>
So this all works great, and I've created the view file: user_sessions/new.js.er...
I have a user model which is access controlled by ACL9
in userscontroller:
ACL9 related stuff
before_filter :load_user, :only => [:show]
access_control do
allow :owner, :of => :user, :to => [:show]
end
def load_user
user = User.find(params[:id])
end
in ApplicaitonController
I have a
rescue_from 'Acl9::AccessDenied', :with => ...
I'm trying to get Rails running on a IIS 6 webserver using IronRuby, but without success. I have followed this webcast and got it running on IIS 7, but can't make it work on a IIS 6 server. I need some help to get this to work. Any ideas?
...
I'm trying to tidy up my code by using named_scopes in Rails 2.3.x but where I'm struggling with the has_many :through associations. I'm wondering if I'm putting the scopes in the wrong place...
Here's some pseudo code below. The problem is that the :accepted named scope is replicated twice... I could of course call :accepted something...
Hi,
I am unable to figure out where my cached fragments are being stored. What is the default location for fragment caching.
Cached fragment hit: views/listed_products (0.1ms)
I cannot find anything in the rails_root/public or rails_root/tmp/cache dirs
thanks,
ash
...
I have a boolean field called "saved" in my database. I want to toggle this field by clicking on a text link that changes from "Save" to "Unsave" depending on the situation, and updates my "Customer" table with 0 or 1. I imagine Javascript may be a way to go for this but I am not experienced enough (yet!) in Javascript to know how to cod...
I want to create a login page, it can easy implement using Ruby on Rails. But the login is very simple, but I want more security.
I want to stop the user keep trying the password. So, I have some ideas on that.
First, stop login feature if the user keep trying the password for 15 mins.
After the user login fail 5 times in 15 mins, th...