Let's say I have models that look like this:
class Foo < ActiveRecord::Base
has_many :bars, :through => :cakes
has_many :cakes
end
class Bar < ActiveRecord::Base
has_many :foos, :through => :cakes
has_many :cakes
end
class Cake < ActiveRecord::Base
belongs_to :foo
belongs_to :bar
end
How would I get all foo...
I'm trying to build a RESTful app to actually manage many kind of configurable objects, so there are a large amount of "resource" types, and hence a lot of controllers. I'm still at the POC phase, so it will be nice if I can show all controllers in a first navigation page, so any easy way (programmable) to do that?
...
Say I have a site like this (generic Q&A site) in Rails and I wanted this "ask" page w/ a text box to be the first page a user sees, even if he's not logged in. He enters a question, and on the 'new' method I check that he's not logged in, and bounced him to /session/new, where he can either log in or create a new account. Question is,...
Hi all.
Could you show me live code examples of integration authlogic-openid and recaptcha? I want to prevent users from registering using they own openid-servers to create multiple accounts and use it for spam.
Also could you help me plz to understand - how to check confirmed? field on creation UserSession for openid registered users?...
Hi friends,
I need to know what is the difference between <%= expression %> and <%= expression -%> on rails, please help me to make good foundation on Ruby On Rails
...
i am trying to create a simple login test, but cannot get past the follow_redirect. it says:
TypeError: can't convert Symbol into String when it meets the 'follow_redirect'. Does it have anything to do with the fact that we are using https for the login process? i simply want to assert that the user is able to log in, and gets redirecte...
I have uploaded the video into my rails application by using thoughtbot-paperclip then the video is converted into "flv" format by using ffmpeg. For your reference here I specified some of my model sample code:
model.rb:
has_attached_file :source,:styles => {:thumb => "137x85>" }
If i specified :url or :path option it doesn't worke...
I'm using rails and the Nokogiri parser. My xml is as below and I'm trying to get the 'Biology: 08:00' text into my view.
<rss version="2.0">
<channel>
<item>
<title>Biology: 08:00</title>
<description>Start time of Biology</description>
<pubDate>Tue, 13 Oct 2009 UT</pubDate>
</item>
...
I started using comatose to handle content on my site but am having problems using it with my existing authentication using a generic Authlogic config.
In the readme he sites an example for configuring it with Restful Authentication and I'm wondering how I would do the same within a general Authlogic setup?
#environment.rb
Com...
Hello, I have inside a .erb file an HTML table which rows' classes are alternated using
<tr class="<%= cycle('even_line', 'odd_line') %>">
This gives me a good visual style, but it is not enough. I want to change the row class on event mouseover. Is there any rails helper that gives me this functionality?
I'm searching through the AP...
Is there anyway I can make content in my Rails views editable by end-users? Such that they can make simple text changes on pages I permit them to without having me edit the HAML files myself?
Thoughts?
CLARIFICATION:
I know about CMS systems, and I don't think that's entirely what I want. I want to maintain programatic control over my...
I have an images table with a nsfw flag.
What's the best way to add nsfw and sfw to the URL?
For example,
if I have an image with an id=1 and nsfw flag is true, I want the URL to be /images/nsfw/1
if I have an image with an id=2 and nsfw flag is false, I want the URL to be /images/sfw/2
...
EDIT Looks like I figured it out - I had to call paginate after the call to all from Searchlogic.
I'm trying to use both of these tools to enable users to search contacts and return a paginated list (or the entire paginated list if they don't enter any search criteria). However I'm unsure of the proper way to chain them together, and w...
This may seem a bit subjective but I am also looking for specifics on implementation if possible. The existing popular how-to's on creating plugins seem to assume you want to get into the guts ActiveRecord itself, or write an acts_as_* plugin, which is not really the case here.
The requirement is to connect to a non-RESTful API at a 3rd...
I have this problem all the time in my rails apps and I still need the correct solution. Whenever a user edits their own record the password field is being populated. I suspect its Firefox as setting @user.password = nil in the edit action doesn't help.
The problem is the password confirmation isn't populated so validation fails due to ...
I just froze rails to prepare for my first production release and now I get these warnings when starting my script/server on development:
RAILS_ROOT/vendor/rails/railties/lib/rails/version.rb:3: warning: already initialized constant MAJOR
RAILS_ROOT/vendor/rails/railties/lib/rails/version.rb:4: warning: already initialized constant MINO...
I need help on figuring out how to create a repository on github to store a rails plug-in that i wrote.
...
I'd like some thoughts on whether using fork{} to 'background' a process from a rails app is such a good idea or not...
From what I gather fork{my_method; Process#setsid} does in fact do what it's supposed to do.
1) creates another processes with a different PID
2) doesn't interrupt the calling process (e.g. it continues w/o waiting f...
I need to implement fine-grained access control in a Ruby on Rails app. The permissions for individual users are saved in a database table and I thought that it would be best to let the respective resource (i.e. the instance of a model) decide whether a certain user is allowed to read from or write to it. Making this decision in the cont...
Im modeling an online book with ruby on rails. The book has chapters, each chapter has pages. Modeling this part is easy. What id like to do is keep track of what pages each user has read and when and whether they liked that page / whether the user completed the book. How would one recommend modeling keeping track of this in rails? Id id...