Hi guys, i am trying to display all the residents on a pdf and their dependents, but the dependents doesn't have a stand they are identified by the foreign key user_id of the resident. e.g resident1.id = 5 --- dependent3.user_id = 5 mean dependent3 belongs to resident1, and therefore if i want to display the dependent stand what should i...
http://weblog.rubyonrails.org/2009/1/26/nested-model-forms
This post helped in learning how to handle multiple models in a rails form. It works as long as the models are nested. what if they are not? lets say, I have a form, where the user fills personal details, address details and a bunch of checkboxes specifying her interests. Ther...
roles = Role.find_all_by_simulation_id(session[:sim_id])
forum_posts = Post.find(:all, :conditions => ["role_id = ? AND created_at > ?", roles.map(&:id), session[:last_login]])
Error:
SQLite3::SQLException: near ",": syntax error: SELECT * FROM "posts" WHERE (role_id = 1,2,3,4 AND created_at > '2009-05-21 11:54:52')
...
How do I change my textfields so they look more like the Twitter login textfields or even the Title textfield for Stackoverflow when you post a new question.
I currently just use:
<%= text_field_tag 'name', @name, :size => 30 %>
...
I have a separate DB for one model in my application and in development
mode the connection is working properly, in production however it isn't.
production:
adapter: mysql
host: myhost
username: root
password:
database: production_db
users_production:
adapter: mysql
host: myhost
username: root
password:
database: ot...
I have these two lines in my model, written for PostgreSQL:
named_scope :by_month, lambda { |month| { :conditions => ["EXTRACT(MONTH FROM recorded_on) = ?", month] }}
named_scope :by_year, lambda { |year| { :conditions => ["EXTRACT(YEAR FROM recorded_on) = ?", year] }}
I'm running PostgreSQL in production, but I'm developing with SQLi...
The business logic is this: Users are in a Boat through a join table, I guess let's call that model a Ticket. But when a User instance wants to check who else is on the boat, there's a condition that asks if that user has permission see everyone on the Boat, or just certain people on the Boat. If a User can see everyone, the normal dea...
Possible Duplicate:
What are the "Must Have" Ruby Gems
There are a load of great Rubygems out there that do some amazing things. In fact, I sometimes wonder what I'd do without Rubygems - they certainly give a load of appeal to Ruby and Rails.
What are you favorites, and what would you recommend to install?
...
Note:
Posting this as a separate question as per Brian's comment (from http://stackoverflow.com/questions/892624/how-to-handle-multiple-models-in-a-rails-form)
I'm trying to learn the best way to handle multiple models in a single rails form, when the models are both nested and non-nested. For the nested ones, I found these two tutoria...
So I have sort of a weird situation going on. I am using the Facebooker plugin for rails where I want users to be able to login and logout with their facebook profiles. However, once users logout, if I refresh the page, it logs them back in. This is only when users log in with facebook connect.
I think the problem is that a rogue coo...
Hello, I have a simple form that looks like so
<% remote_form_for post, :url => post_path(post), :method => :put do |f| -%>
<%= f.submit "Approve" %>
<%= f.submit "Deny" %>
<% end -%>
Which renders
<input type="submit" value="Approve" name="commit"/>
<input type="submit" value="Deny" name="commit"/>
In my controller I have the ...
Okay, before you guys go nuts -- this is just a small site, temporary setup. Right now I'm having some internal folks remote into the server and use the site through webrick via the dev command: ruby script/server. Not exactly ideal.
I'm just starting Rails dev and I want to know a better way to handle hosting on a Windows Pro box. A...
I'm sorry if this sounds like a stupid question, because it seems to be one of those "no duh" things, but can someone explain to me why Rails needs its own server (Mongrel, WEBrick, mod_rails, etc) and can't simply use mod_ruby?
...
I have several actions that are protected by filters that check for logged_in? and admin? and spit out 401 or 403 errors respectively if the tests fail. What's a good way of getting around these filters in development mode only so I can test out my app?
I can't go through the actual login procedure because it relies on infrastructure I...
An open source project called Beast implemented a forum in about 500 lines of Ruby on Rails code. The project seems to have fallen silent (http://beast.caboo.se/). Is there an open source project that replaces beast and is compatible with the database schema defined for Beast? I have used Beast to sponsor a forum and would like to upgrad...
I'm happened to write create one file in lib folder and I want to use TextHelper in that file. How can I make Texthelper available?
Suggestions appreciated,
Thanks,
...
I have only just started to investigate... but thought I would throw this to the community as well.
I am building an app using Authlogic for authentication. The auth part is basically straight off the authlogic tutorials...
My logoff button works in dev, destroying the session and giving the flash on the root_url. However, on productio...
Possible Duplicate:
Multiline strings in Javascript
In Ruby you can do something like this
temp = <<-SQLCODE
select * from users
SQLCODE
This way you have very long string literals in your code without have to escape lots of characters. Is there something similar in JavaScript?
Currently I have javascript code like this, an...
We have a web app which serves typical social content(blogs/forums/streams etc).
All the content is optionally marked with a city. I.e. if a blog post is specific to New York, it will be marked so.
The task is to show only city specific information(all over the site) if user has set city view preference and show everything to all oth...
This one has me stumped.
I have a view with a cached fragment:
- cache :key=>"news" do
%h2 News
- etc
I have a sweeper that uses:
def expire_home_cache
puts "expire_home_cache"
expire_fragment(:key => "news")
end
The sweeper is called as I can see "expire_home_cache" in the console output.
But the fragment is not...