i am thinking of releasing a rails application as a gem. it's sort of a wiki application which also stores user data in the db directory. what would be a good way to go to avoid the user data being overwritten, when a gem update is done?
example:
1) user gets version 1 of the gem/application. the data is stored in the gem directory.
...
hello!
does somebody know how i can handle n:m relations with facets in solr with the sunspot_rails gem?
i have a model item, which has 4 has_and_belongs_to_many relations. now i ´d like to create a search with facets, where an user can select different parts of this 4 relations and after that search the page..
mattherick
...
Just started learning Rails (3). I am tearing my hair out trying to find how to do something presumably utterly trivial: access the value of a model instance's field, from inside a method on that model.
In my case:
def formal_name
@title + " " + @forename + " " + @surname
end
All three @properties (which are all fields on the tabl...
I was using a github repository from a previous developer.
I am the only coder on this project, so I forked the project over to my own github repository.
Now I would like to commit soley to my repo.
Unfortunately, I realized that I never changed my .git/config , so I was still committing to the old repo. I just changed it to the appro...
I am trying to take an html file created by MSWord (don't ask) clean it up and create a form out of it on the fly. I am doing this work in the model (clean it up, create the form, stuff it in a DB). I would like to use the form_tag helpers, but can't quite get the hang of including them for use in the model. When I do an "include ActionV...
I'm trying to write a rake task for loadin data into my database. My plan is do something like
system "mysql -u foo -pbar database < backup.sql"
but I need to access the config/database.yml data for getting the user, pass and database info. The trik is I don't want to "parse" this file but to access this info in the same way tasks lik...
Where title is a field on the table in the database, why does calling @title return nil?
Unbelievably, accessing model fields from inside a method on that model is undocumented.
...
I have this
Then /^the "([^\"]*)" tag with the id "([^\"]*)" should have the style "([^\"]*)"$/ do |tag,id,style|
if page.respond_to? :should
page.should have_selector(tag, :id => id, :style => style)
else
assert page.has_selector?(tag, :id => id, :style => style)
end
end
And This is my cuke step
And the "di...
Hello,
I'm currently working on a heavy app, and I need the same kind of information in many views.
Is there something existing to replace my model name? I would like to use a generic partial.
For example :
Created <%=h date_format(@project.created_at) %> par <%=h @project.user_create.aka rescue nil %>
You could have the same thing f...
Currently I have several models set up like so,
class Account < ActiveRecord::Base
has_many :office_hours
has_many :staff_positions
end
class OfficeHour < ActiveRecord::Base
belongs_to :account
end
class StaffPosition < ActiveRecord::Base
belongs_to :account
end
class Document < ActiveRecord::Base
end
Now I need to set up a...
I have a type I want to save to the database, say, email addresses, and I want to save them in the most efficient way possible. I also want to associate posts with email addresses, so if it exists, I want to assign the post to that email address. Should I do a search first and then go based on that result, or is there a more efficient wa...
Hello there, I'm trying to find some cool and nice way to manage the session control of my application, just like authologic, clearance. But the issue is that I don't have a database, all the users are stored in a external webservice and the Login function is basically call the LoginDB(user,password, salt) and then it returns true or fal...
I am writing a Rails back-end API for a Steam game that is only accessed via REST calls, so no user-specific authentication is required. I am trying to implement the authlogic_api plug-in for the Authlogic gem, which uses an api_key/signature mechanism to restrict access. I have implemented the ApplicationSession and ApplicationAccount m...
What is the rails convention regarding names of boolean fields?
For example, if I have a User model that needs a flag for its "activeness", should I call the db field is_active or active ?
Note: Rails automatically generates question-marked methods for accessing boolean fields: User.is_active? and User.active?.
...
params[:codes] = "9,10"
@result = Candidate.find :all,
:joins =>
params[:codes].split(',').collect {|c| ["INNER JOIN candidates_codes on candidates_codes.candidate_id = candidates.id, INNER JOIN codes on codes.code_id = candidates_codes.code_id AND codes.value = ?", c]}
Error
Association named 'INNER JOIN cand...
I would like to run my cucumber tests individually.. but with one command
I would also like to know how to write rake files that take parameters
...
Hello,
I'm new to rails and having trouble figuring out how to do this RESTfully. I have a route set as map.resources :products and what I want to do is have some way to filter the results returned from the index action. For example, you go to /products which calls the index action per the resources default, then on that page there is a...
I'm adding a feature to a web app where users can click a button to enter a link, and then paste in an address. I then want to be parse out the string entered, and extract the domain from the URL so that I can display the domain separately next to the link. The idea here is something similar to what Slashdot does, where links are display...
Like in the cucumber tests, there are color-coded outputs... how do I do that?
...
Hi guys.
I am migrating my 1.8.7 rails app to rails 3. But I have a problem with a partial:
I have the following partial:
in my cms controller :
@clients = Client.all
group = render_to_string :layout => 'layouts/window', :partial => 'clients/index'
in my "clients/index" partial:
<%= render :partial => 'clients/item', :collection ...