ruby-on-rails-3.1

.tooltip() is not a function

混江龙づ霸主 提交于 2019-12-01 13:47:31
问题 I am trying to use the .tooltip() that I found from the following: Jquery-ui tooltip. What I have is a rails app that has some information in a table. In separate cells. Currently you can view the full information of a cell by clicking it which opens up jquery dialog which works fine. What I am trying to add to it is so that there will be two options. 1) Click the cell which brings up jquery dialog - which works already 2) Or hover a cell which shows an overview. Image From the image

Ruby on Rails: How can I add a css file with rails project?

爷,独闯天下 提交于 2019-12-01 13:36:14
问题 The application.html.erb file: <!DOCTYPE html> <html> <head> <title>Site</title> <%= stylesheet_link_tag :all %> <%= javascript_include_tag "application" %> <%= csrf_meta_tags %> </head> <body> <%= yield %> </body> </html> I have a file "cake.generic.css" in public/ folder. But when I reload the page the effect of css file is not working. If I see the page view source I see something like this: <!DOCTYPE html> <html> <head> <title>Site</title> <link href="/assets/all.css" media="screen" rel=

Rails 3.1 Need to do in place editing on an Index page

时间秒杀一切 提交于 2019-12-01 13:14:06
问题 I have an index page with a free form comment field. The Comment field is part of another model that is not associated-- long story, part me, part user. What I need to figure out is what to use to do that. I ran into a problem with Best In Place (here) and am not sure if that is a resolvable path. So, does anyone have a tutorial or advice to point me to regarding doing in place editing for an index? 回答1: What I wound up doing was: Create a row in the table that was a TextArea and assigned the

custom validations errors form controller inside other parent controller rails 3.1

女生的网名这么多〃 提交于 2019-12-01 13:07:09
I have a House model in my rails app that has_many deals. I am displaying these deals on the house's show page. When I submit the form everything works fine if is with redirect_to; however, if there are validation errors on the Deal model, then my system not working fine. If there are validation errors on the Deal model. In my routes.rb I have resources :houses do resources :deals end In deals_controller.rb I have the next method create: def create @house = House.find_by_slug(params[:house_id]) @deal = @house.deals.build(params[:deal]) @deal.user = current_user respond_to do |format| if @deal

Rails separate array items with comma inside partial

戏子无情 提交于 2019-12-01 12:08:54
What is the most elegant way in Rails to create a comma-separated list inside a partial? I've just recently discovered that you can use partials to iterate through a collection sent from another view template. So in the view template I have: <% render @dvd.director %> Then in /view/directors/_director.html.erb: <%= director.director %> This actually does something like: @dvd.director.each { |d| puts d.director } Now, I know I could use a .join like so: <% @dvd.director.map { |t| t.director }.join(", ") %> But since the partial already iterates through each entry in the array, how can I

in rails how to limit users post count saved in database before asking to upgrade their account

冷暖自知 提交于 2019-12-01 11:56:13
I'm adding a small way of controlling a non-subscribed user and a subscribed user. Basically my idea is that all users that sign up with the use of Devise, get an account. However, my model or the number of posts a user can have in the database stored based on user ID found should be 25 posts. I'm guessing the following would work; Model class Post belongs_to :user validate :quota, :on => :refresh def quota Posts = Posts.find(params[:id]) if user.posts.count >= 25 flash[:error] = "Sorry you need to upgrade" end end end :refresh is something I'm working on where it grabs posts and adds these

nested_form, has_many :through, updating attribute on join model

强颜欢笑 提交于 2019-12-01 10:52:39
问题 I'm using ryan bates' plugin nested_form and i have been trying to write my form for a has_many :through relationship. I have 3 models: Profile has_many :memberships has_many :organizations, :through => :memberships accepts_attributes_for :organizations attr_accessible :organization_attribtues Membership has_many :profiles has_many :organizations Organization has_many :memberships has_many :profiles, :though => :memberships The below form is for the profile but with the organization nested

How to link form after creating rails join table

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 10:52:30
问题 Hi have a products model in my Rails 3.1 app which looked like this: +----------------+---------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------------+---------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | type | text | YES | | NULL | | | title | text | YES | | NULL | | | description | text | YES | | NULL | | | price | text | YES | | NULL | | | img_src | text | YES | | NULL | | |

in rails how to limit users post count saved in database before asking to upgrade their account

爱⌒轻易说出口 提交于 2019-12-01 10:03:45
问题 I'm adding a small way of controlling a non-subscribed user and a subscribed user. Basically my idea is that all users that sign up with the use of Devise, get an account. However, my model or the number of posts a user can have in the database stored based on user ID found should be 25 posts. I'm guessing the following would work; Model class Post belongs_to :user validate :quota, :on => :refresh def quota Posts = Posts.find(params[:id]) if user.posts.count >= 25 flash[:error] = "Sorry you

custom validations errors form controller inside other parent controller rails 3.1

故事扮演 提交于 2019-12-01 09:59:34
问题 I have a House model in my rails app that has_many deals. I am displaying these deals on the house's show page. When I submit the form everything works fine if is with redirect_to; however, if there are validation errors on the Deal model, then my system not working fine. If there are validation errors on the Deal model. In my routes.rb I have resources :houses do resources :deals end In deals_controller.rb I have the next method create: def create @house = House.find_by_slug(params[:house_id